@apollo/client 3.8.0-alpha.7 → 3.8.0-alpha.9
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 +1 -1
- package/apollo-client.cjs +219 -183
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +34 -24
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +34 -24
- package/cache/core/types/DataProxy.d.ts +3 -2
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +2 -2
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +2 -2
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +14 -3
- package/cache/inmemory/policies.js.map +1 -1
- package/core/ApolloClient.d.ts +3 -3
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +10 -4
- package/core/ApolloClient.js.map +1 -1
- package/core/core.cjs +11 -5
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +11 -5
- package/invariantErrorCodes.js +4 -3
- package/link/core/types.d.ts +3 -4
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/package.json +16 -17
- package/react/hooks/hooks.cjs +19 -11
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +19 -11
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +2 -1
- package/react/hooks/useMutation.js.map +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/useSuspenseCache.d.ts +2 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +6 -4
- package/react/hooks/useSuspenseCache.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +10 -5
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/types/types.d.ts +2 -0
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/itAsync.js.map +1 -1
- package/utilities/common/arrays.d.ts +1 -0
- package/utilities/common/arrays.d.ts.map +1 -1
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +7 -3
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +167 -90
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +2 -2
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/utilities.cjs +177 -105
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +177 -105
- package/version.js +1 -1
|
@@ -123,7 +123,6 @@ var hasOwn = Object.prototype.hasOwnProperty;
|
|
|
123
123
|
function isNullish(value) {
|
|
124
124
|
return value === null || value === void 0;
|
|
125
125
|
}
|
|
126
|
-
var isArray = Array.isArray;
|
|
127
126
|
function defaultDataIdFromObject(_a, context) {
|
|
128
127
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
129
128
|
if (typeof __typename === "string") {
|
|
@@ -167,7 +166,7 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
167
166
|
}
|
|
168
167
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
169
168
|
if (utilities.isNonNullObject(result)) {
|
|
170
|
-
return isArray(result)
|
|
169
|
+
return utilities.isArray(result)
|
|
171
170
|
? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); })
|
|
172
171
|
: selectionSet.selections.every(function (field) {
|
|
173
172
|
if (utilities.isField(field) && utilities.shouldInclude(field, variables)) {
|
|
@@ -184,7 +183,7 @@ function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
|
184
183
|
function storeValueIsStoreObject(value) {
|
|
185
184
|
return utilities.isNonNullObject(value) &&
|
|
186
185
|
!utilities.isReference(value) &&
|
|
187
|
-
!isArray(value);
|
|
186
|
+
!utilities.isArray(value);
|
|
188
187
|
}
|
|
189
188
|
function makeProcessedFieldsMerger() {
|
|
190
189
|
return new utilities.DeepMerger;
|
|
@@ -664,7 +663,7 @@ function supportsResultCaching(store) {
|
|
|
664
663
|
|
|
665
664
|
function shallowCopy(value) {
|
|
666
665
|
if (utilities.isNonNullObject(value)) {
|
|
667
|
-
return isArray(value)
|
|
666
|
+
return utilities.isArray(value)
|
|
668
667
|
? value.slice(0)
|
|
669
668
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
670
669
|
}
|
|
@@ -916,7 +915,7 @@ var StoreReader = (function () {
|
|
|
916
915
|
_a));
|
|
917
916
|
}
|
|
918
917
|
}
|
|
919
|
-
else if (isArray(fieldValue)) {
|
|
918
|
+
else if (utilities.isArray(fieldValue)) {
|
|
920
919
|
fieldValue = handleMissing(_this.executeSubSelectedArray({
|
|
921
920
|
field: selection,
|
|
922
921
|
array: fieldValue,
|
|
@@ -980,7 +979,7 @@ var StoreReader = (function () {
|
|
|
980
979
|
if (item === null) {
|
|
981
980
|
return null;
|
|
982
981
|
}
|
|
983
|
-
if (isArray(item)) {
|
|
982
|
+
if (utilities.isArray(item)) {
|
|
984
983
|
return handleMissing(_this.executeSubSelectedArray({
|
|
985
984
|
field: field,
|
|
986
985
|
array: item,
|
|
@@ -1174,13 +1173,13 @@ function getSpecifierPaths(spec) {
|
|
|
1174
1173
|
var paths_1 = info.paths = [];
|
|
1175
1174
|
var currentPath_1 = [];
|
|
1176
1175
|
spec.forEach(function (s, i) {
|
|
1177
|
-
if (isArray(s)) {
|
|
1176
|
+
if (utilities.isArray(s)) {
|
|
1178
1177
|
getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); });
|
|
1179
1178
|
currentPath_1.length = 0;
|
|
1180
1179
|
}
|
|
1181
1180
|
else {
|
|
1182
1181
|
currentPath_1.push(s);
|
|
1183
|
-
if (!isArray(spec[i + 1])) {
|
|
1182
|
+
if (!utilities.isArray(spec[i + 1])) {
|
|
1184
1183
|
paths_1.push(currentPath_1.slice(0));
|
|
1185
1184
|
currentPath_1.length = 0;
|
|
1186
1185
|
}
|
|
@@ -1195,14 +1194,14 @@ function extractKey(object, key) {
|
|
|
1195
1194
|
function extractKeyPath(object, path, extract) {
|
|
1196
1195
|
extract = extract || extractKey;
|
|
1197
1196
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
1198
|
-
return isArray(obj)
|
|
1197
|
+
return utilities.isArray(obj)
|
|
1199
1198
|
? obj.map(function (child) { return reducer(child, key); })
|
|
1200
1199
|
: obj && extract(obj, key);
|
|
1201
1200
|
}, object));
|
|
1202
1201
|
}
|
|
1203
1202
|
function normalize(value) {
|
|
1204
1203
|
if (utilities.isNonNullObject(value)) {
|
|
1205
|
-
if (isArray(value)) {
|
|
1204
|
+
if (utilities.isArray(value)) {
|
|
1206
1205
|
return value.map(normalize);
|
|
1207
1206
|
}
|
|
1208
1207
|
return collectSpecifierPaths(Object.keys(value).sort(), function (path) { return extractKeyPath(value, path); });
|
|
@@ -1265,7 +1264,7 @@ var Policies = (function () {
|
|
|
1265
1264
|
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
1266
1265
|
while (keyFn) {
|
|
1267
1266
|
var specifierOrId = keyFn(object, context);
|
|
1268
|
-
if (isArray(specifierOrId)) {
|
|
1267
|
+
if (utilities.isArray(specifierOrId)) {
|
|
1269
1268
|
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
1270
1269
|
}
|
|
1271
1270
|
else {
|
|
@@ -1308,7 +1307,7 @@ var Policies = (function () {
|
|
|
1308
1307
|
setMerge(existing, incoming.merge);
|
|
1309
1308
|
existing.keyFn =
|
|
1310
1309
|
keyFields === false ? nullKeyFieldsFn :
|
|
1311
|
-
isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :
|
|
1310
|
+
utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :
|
|
1312
1311
|
typeof keyFields === "function" ? keyFields :
|
|
1313
1312
|
existing.keyFn;
|
|
1314
1313
|
if (fields) {
|
|
@@ -1322,7 +1321,7 @@ var Policies = (function () {
|
|
|
1322
1321
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
1323
1322
|
existing.keyFn =
|
|
1324
1323
|
keyArgs === false ? simpleKeyArgsFn :
|
|
1325
|
-
isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :
|
|
1324
|
+
utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :
|
|
1326
1325
|
typeof keyArgs === "function" ? keyArgs :
|
|
1327
1326
|
existing.keyFn;
|
|
1328
1327
|
if (typeof read === "function") {
|
|
@@ -1367,9 +1366,20 @@ var Policies = (function () {
|
|
|
1367
1366
|
if (!hasOwn.call(this.typePolicies, typename)) {
|
|
1368
1367
|
var policy_1 = this.typePolicies[typename] = Object.create(null);
|
|
1369
1368
|
policy_1.fields = Object.create(null);
|
|
1370
|
-
var
|
|
1371
|
-
if (
|
|
1372
|
-
|
|
1369
|
+
var supertypes_1 = this.supertypeMap.get(typename);
|
|
1370
|
+
if (!supertypes_1 && this.fuzzySubtypes.size) {
|
|
1371
|
+
supertypes_1 = this.getSupertypeSet(typename, true);
|
|
1372
|
+
this.fuzzySubtypes.forEach(function (regExp, fuzzy) {
|
|
1373
|
+
if (regExp.test(typename)) {
|
|
1374
|
+
var fuzzySupertypes = _this.supertypeMap.get(fuzzy);
|
|
1375
|
+
if (fuzzySupertypes) {
|
|
1376
|
+
fuzzySupertypes.forEach(function (supertype) { return supertypes_1.add(supertype); });
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
if (supertypes_1 && supertypes_1.size) {
|
|
1382
|
+
supertypes_1.forEach(function (supertype) {
|
|
1373
1383
|
var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = tslib.__rest(_a, ["fields"]);
|
|
1374
1384
|
Object.assign(policy_1, rest);
|
|
1375
1385
|
Object.assign(policy_1.fields, fields);
|
|
@@ -1467,7 +1477,7 @@ var Policies = (function () {
|
|
|
1467
1477
|
var args = argsFromFieldSpecifier(fieldSpec);
|
|
1468
1478
|
while (keyFn) {
|
|
1469
1479
|
var specifierOrString = keyFn(args, context);
|
|
1470
|
-
if (isArray(specifierOrString)) {
|
|
1480
|
+
if (utilities.isArray(specifierOrString)) {
|
|
1471
1481
|
keyFn = keyArgsFnFromSpecifier(specifierOrString);
|
|
1472
1482
|
}
|
|
1473
1483
|
else {
|
|
@@ -1588,7 +1598,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1588
1598
|
}
|
|
1589
1599
|
function makeMergeObjectsFunction(store) {
|
|
1590
1600
|
return function mergeObjects(existing, incoming) {
|
|
1591
|
-
if (isArray(existing) || isArray(incoming)) {
|
|
1601
|
+
if (utilities.isArray(existing) || utilities.isArray(incoming)) {
|
|
1592
1602
|
throw globals.__DEV__ ? new globals.InvariantError("Cannot automatically merge arrays") : new globals.InvariantError(4);
|
|
1593
1603
|
}
|
|
1594
1604
|
if (utilities.isNonNullObject(existing) &&
|
|
@@ -1806,7 +1816,7 @@ var StoreWriter = (function () {
|
|
|
1806
1816
|
if (!field.selectionSet || value === null) {
|
|
1807
1817
|
return globals.__DEV__ ? utilities.cloneDeep(value) : value;
|
|
1808
1818
|
}
|
|
1809
|
-
if (isArray(value)) {
|
|
1819
|
+
if (utilities.isArray(value)) {
|
|
1810
1820
|
return value.map(function (item, i) {
|
|
1811
1821
|
var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));
|
|
1812
1822
|
maybeRecycleChildMergeTree(mergeTree, i);
|
|
@@ -1874,7 +1884,7 @@ var StoreWriter = (function () {
|
|
|
1874
1884
|
var _a;
|
|
1875
1885
|
var _this = this;
|
|
1876
1886
|
if (mergeTree.map.size && !utilities.isReference(incoming)) {
|
|
1877
|
-
var e_1 = (!isArray(incoming) &&
|
|
1887
|
+
var e_1 = (!utilities.isArray(incoming) &&
|
|
1878
1888
|
(utilities.isReference(existing) || storeValueIsStoreObject(existing))) ? existing : void 0;
|
|
1879
1889
|
var i_1 = incoming;
|
|
1880
1890
|
if (e_1 && !getStorageArgs) {
|
|
@@ -1882,7 +1892,7 @@ var StoreWriter = (function () {
|
|
|
1882
1892
|
}
|
|
1883
1893
|
var changedFields_1;
|
|
1884
1894
|
var getValue_1 = function (from, name) {
|
|
1885
|
-
return isArray(from)
|
|
1895
|
+
return utilities.isArray(from)
|
|
1886
1896
|
? (typeof name === "number" ? from[name] : void 0)
|
|
1887
1897
|
: context.store.getFieldValue(from, String(name));
|
|
1888
1898
|
};
|
|
@@ -1904,7 +1914,7 @@ var StoreWriter = (function () {
|
|
|
1904
1914
|
}
|
|
1905
1915
|
});
|
|
1906
1916
|
if (changedFields_1) {
|
|
1907
|
-
incoming = (isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1));
|
|
1917
|
+
incoming = (utilities.isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1));
|
|
1908
1918
|
changedFields_1.forEach(function (value, name) {
|
|
1909
1919
|
incoming[name] = value;
|
|
1910
1920
|
});
|
|
@@ -1985,8 +1995,8 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
1985
1995
|
return;
|
|
1986
1996
|
warnings.add(typeDotName);
|
|
1987
1997
|
var childTypenames = [];
|
|
1988
|
-
if (!isArray(existing) &&
|
|
1989
|
-
!isArray(incoming)) {
|
|
1998
|
+
if (!utilities.isArray(existing) &&
|
|
1999
|
+
!utilities.isArray(incoming)) {
|
|
1990
2000
|
[existing, incoming].forEach(function (child) {
|
|
1991
2001
|
var typename = store.getFieldValue(child, "__typename");
|
|
1992
2002
|
if (typeof typename === "string" &&
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DocumentNode } from 'graphql';
|
|
2
2
|
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
3
3
|
import { MissingFieldError } from './common';
|
|
4
|
+
import { Reference } from '../../../utilities';
|
|
4
5
|
export declare namespace DataProxy {
|
|
5
6
|
interface Query<TVariables, TData> {
|
|
6
7
|
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
@@ -46,7 +47,7 @@ export declare namespace DataProxy {
|
|
|
46
47
|
export interface DataProxy {
|
|
47
48
|
readQuery<QueryType, TVariables = any>(options: DataProxy.ReadQueryOptions<QueryType, TVariables>, optimistic?: boolean): QueryType | null;
|
|
48
49
|
readFragment<FragmentType, TVariables = any>(options: DataProxy.ReadFragmentOptions<FragmentType, TVariables>, optimistic?: boolean): FragmentType | null;
|
|
49
|
-
writeQuery<TData = any, TVariables = any>(options: DataProxy.WriteQueryOptions<TData, TVariables>):
|
|
50
|
-
writeFragment<TData = any, TVariables = any>(options: DataProxy.WriteFragmentOptions<TData, TVariables>):
|
|
50
|
+
writeQuery<TData = any, TVariables = any>(options: DataProxy.WriteQueryOptions<TData, TVariables>): Reference | undefined;
|
|
51
|
+
writeFragment<TData = any, TVariables = any>(options: DataProxy.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
|
|
51
52
|
}
|
|
52
53
|
//# sourceMappingURL=DataProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProxy.d.ts","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;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AS,CAAC,mBAAmB,CAAC,YAAY,EAAE,UAAU,CAAC,EAChE,UAAU,CAAC,EAAE,OAAO,GACnB,YAAY,GAAG,IAAI,CAAC;IAKvB,UAAU,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACtC,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,GACtD,SAAS,GAAG,SAAS,CAAC;IAOzB,aAAa,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACzC,OAAO,EAAE,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,GACzD,SAAS,GAAG,SAAS,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql'; // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { MissingFieldError } from './common';\n\nexport namespace DataProxy {\n export interface Query<TVariables, TData> {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n }\n\n export interface Fragment<TVariables, TData> {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by your `dataIdFromObject` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n }\n\n export interface ReadQueryOptions<TData, TVariables>\n extends Query<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface ReadFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface WriteOptions<TData> {\n /**\n * The data you will be writing to the store.\n */\n data: TData;\n /**\n * Whether to notify query watchers (default: true).\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data (default: false).\n */\n overwrite?: boolean;\n }\n\n export interface WriteQueryOptions<TData, TVariables>\n extends Query<TVariables, TData>, WriteOptions<TData> {}\n\n export interface WriteFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData>, WriteOptions<TData> {}\n\n export interface UpdateQueryOptions<TData, TVariables>\n extends Omit<(\n ReadQueryOptions<TData, TVariables> &\n WriteQueryOptions<TData, TVariables>\n ), 'data'> {}\n\n export interface UpdateFragmentOptions<TData, TVariables>\n extends Omit<(\n ReadFragmentOptions<TData, TVariables> &\n WriteFragmentOptions<TData, TVariables>\n ), 'data'> {}\n\n export type DiffResult<T> = {\n result?: T;\n complete?: boolean;\n missing?: MissingFieldError[];\n fromOptimisticTransaction?: boolean;\n }\n}\n\n/**\n * A proxy to the normalized data living in our store. This interface allows a\n * user to read and write denormalized data which feels natural to the user\n * whilst in the background this data is being converted into the normalized\n * store format.\n */\nexport interface DataProxy {\n /**\n * Reads a GraphQL query from the root query id.\n */\n readQuery<QueryType, TVariables = any>(\n options: DataProxy.ReadQueryOptions<QueryType, TVariables>,\n optimistic?: boolean,\n ): QueryType | null;\n\n /**\n * Reads a GraphQL fragment from any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n readFragment<FragmentType, TVariables = any>(\n options: DataProxy.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic?: boolean,\n ): FragmentType | null;\n\n /**\n * Writes a GraphQL query to the root query id.\n */\n writeQuery<TData = any, TVariables = any>(\n options: DataProxy.WriteQueryOptions<TData, TVariables>,\n ):
|
|
1
|
+
{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql'; // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { MissingFieldError } from './common';\nimport { Reference } from '../../../utilities';\n\nexport namespace DataProxy {\n export interface Query<TVariables, TData> {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n }\n\n export interface Fragment<TVariables, TData> {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by your `dataIdFromObject` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n }\n\n export interface ReadQueryOptions<TData, TVariables>\n extends Query<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface ReadFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface WriteOptions<TData> {\n /**\n * The data you will be writing to the store.\n */\n data: TData;\n /**\n * Whether to notify query watchers (default: true).\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data (default: false).\n */\n overwrite?: boolean;\n }\n\n export interface WriteQueryOptions<TData, TVariables>\n extends Query<TVariables, TData>, WriteOptions<TData> {}\n\n export interface WriteFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData>, WriteOptions<TData> {}\n\n export interface UpdateQueryOptions<TData, TVariables>\n extends Omit<(\n ReadQueryOptions<TData, TVariables> &\n WriteQueryOptions<TData, TVariables>\n ), 'data'> {}\n\n export interface UpdateFragmentOptions<TData, TVariables>\n extends Omit<(\n ReadFragmentOptions<TData, TVariables> &\n WriteFragmentOptions<TData, TVariables>\n ), 'data'> {}\n\n export type DiffResult<T> = {\n result?: T;\n complete?: boolean;\n missing?: MissingFieldError[];\n fromOptimisticTransaction?: boolean;\n }\n}\n\n/**\n * A proxy to the normalized data living in our store. This interface allows a\n * user to read and write denormalized data which feels natural to the user\n * whilst in the background this data is being converted into the normalized\n * store format.\n */\nexport interface DataProxy {\n /**\n * Reads a GraphQL query from the root query id.\n */\n readQuery<QueryType, TVariables = any>(\n options: DataProxy.ReadQueryOptions<QueryType, TVariables>,\n optimistic?: boolean,\n ): QueryType | null;\n\n /**\n * Reads a GraphQL fragment from any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n readFragment<FragmentType, TVariables = any>(\n options: DataProxy.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic?: boolean,\n ): FragmentType | null;\n\n /**\n * Writes a GraphQL query to the root query id.\n */\n writeQuery<TData = any, TVariables = any>(\n options: DataProxy.WriteQueryOptions<TData, TVariables>,\n ): Reference | undefined;\n\n /**\n * Writes a GraphQL fragment to any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n writeFragment<TData = any, TVariables = any>(\n options: DataProxy.WriteFragmentOptions<TData, TVariables>,\n ): Reference | undefined;\n}\n"]}
|
|
@@ -2,10 +2,10 @@ import { DocumentNode, SelectionSetNode } from 'graphql';
|
|
|
2
2
|
import { NormalizedCache, InMemoryCacheConfig } from './types';
|
|
3
3
|
import { KeyFieldsContext } from './policies';
|
|
4
4
|
import { FragmentRegistryAPI } from './fragmentRegistry';
|
|
5
|
-
import { Reference, StoreValue, StoreObject, DeepMerger, FragmentMap, FragmentMapFunction } from '../../utilities';
|
|
5
|
+
import { Reference, StoreValue, StoreObject, DeepMerger, FragmentMap, FragmentMapFunction, isArray } from '../../utilities';
|
|
6
6
|
export declare const hasOwn: (v: PropertyKey) => boolean;
|
|
7
7
|
export declare function isNullish(value: any): value is null | undefined;
|
|
8
|
-
export
|
|
8
|
+
export { isArray };
|
|
9
9
|
export declare function defaultDataIdFromObject({ __typename, id, _id }: Readonly<StoreObject>, context?: KeyFieldsContext): string | undefined;
|
|
10
10
|
export declare function normalizeConfig(config: InMemoryCacheConfig): {
|
|
11
11
|
dataIdFromObject: typeof defaultDataIdFromObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/cache/inmemory/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EACL,eAAe,EACf,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EACL,SAAS,EAET,UAAU,EACV,WAAW,EAEX,UAAU,EAKV,WAAW,EACX,mBAAmB,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/cache/inmemory/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EACL,eAAe,EACf,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EA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BAAmB,GAC9B;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,mBAAmB,CAAC;CACrC,CAcA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isReference, isField, DeepMerger, resultKeyNameFromField, shouldInclude, isNonNullObject, compact, createFragmentMap, getFragmentDefinitions, } from "../../utilities/index.js";
|
|
1
|
+
import { isReference, isField, DeepMerger, resultKeyNameFromField, shouldInclude, isNonNullObject, compact, createFragmentMap, getFragmentDefinitions, isArray, } from "../../utilities/index.js";
|
|
2
2
|
export var hasOwn = Object.prototype.hasOwnProperty;
|
|
3
3
|
export function isNullish(value) {
|
|
4
4
|
return value === null || value === void 0;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export { isArray };
|
|
7
7
|
export function defaultDataIdFromObject(_a, context) {
|
|
8
8
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
9
9
|
if (typeof __typename === "string") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/cache/inmemory/helpers.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,WAAW,EAGX,OAAO,EACP,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,OAAO,EAGP,iBAAiB,EACjB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/cache/inmemory/helpers.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,WAAW,EAGX,OAAO,EACP,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,OAAO,EAGP,iBAAiB,EACjB,sBAAsB,EACtB,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CACJ,IAAgB,MAAM,GACpB,MAAM,CAAC,SAAS,eADI,CACH;AAErB,MAAM,UAAU,SAAS,CAAC,KAAU;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC,CAAC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SAAS,CAAC,CAAC,CAAC;iBAC3E;gBAMD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;KACN;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAiB;IAEjB,OAAO,eAAe,CAAC,KAAK,CAAC;QAC3B,CAAC,WAAW,CAAC,KAAK,CAAC;QACnB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,UAAU,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAsB,EACtB,SAA+B;IAO/B,IAAM,WAAW,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxE,OAAO;QACL,WAAW,aAAA;QACX,cAAc,YAAC,IAAI;YACjB,IAAI,GAAG,GAAkC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC3D,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE;gBACrB,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAC9B;YACD,OAAO,GAAG,IAAI,IAAI,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { DocumentNode, FragmentDefinitionNode, SelectionSetNode } from 'graphql';\n\nimport {\n NormalizedCache,\n InMemoryCacheConfig,\n} from './types';\n\nimport { KeyFieldsContext } from './policies';\nimport { FragmentRegistryAPI } from './fragmentRegistry';\n\nimport {\n Reference,\n isReference,\n StoreValue,\n StoreObject,\n isField,\n DeepMerger,\n resultKeyNameFromField,\n shouldInclude,\n isNonNullObject,\n compact,\n FragmentMap,\n FragmentMapFunction,\n createFragmentMap,\n getFragmentDefinitions,\n isArray,\n} from '../../utilities';\n\nexport const {\n hasOwnProperty: hasOwn,\n} = Object.prototype;\n\nexport function isNullish(value: any): value is null | undefined {\n return value === null || value === void 0;\n}\n\nexport { isArray };\n\nexport function defaultDataIdFromObject(\n { __typename, id, _id }: Readonly<StoreObject>,\n context?: KeyFieldsContext,\n): string | undefined {\n if (typeof __typename === \"string\") {\n if (context) {\n context.keyObject =\n !isNullish(id) ? { id } :\n !isNullish(_id) ? { _id } :\n void 0;\n }\n\n // If there is no object.id, fall back to object._id.\n if (isNullish(id) && !isNullish(_id)) {\n id = _id;\n }\n\n if (!isNullish(id)) {\n return `${__typename}:${(\n typeof id === \"number\" ||\n typeof id === \"string\"\n ) ? id : JSON.stringify(id)}`;\n }\n }\n}\n\nconst defaultConfig = {\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n // Thanks to the shouldCanonizeResults helper, this should be the only line\n // you have to change to reenable canonization by default in the future.\n canonizeResults: false,\n};\n\nexport function normalizeConfig(config: InMemoryCacheConfig) {\n return compact(defaultConfig, config);\n}\n\nexport function shouldCanonizeResults(\n config: Pick<InMemoryCacheConfig, \"canonizeResults\">,\n): boolean {\n const value = config.canonizeResults;\n return value === void 0 ? defaultConfig.canonizeResults : value;\n}\n\nexport function getTypenameFromStoreObject(\n store: NormalizedCache,\n objectOrReference: StoreObject | Reference,\n): string | undefined {\n return isReference(objectOrReference)\n ? store.get(objectOrReference.__ref, \"__typename\") as string\n : objectOrReference && objectOrReference.__typename;\n}\n\nexport const TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;\n\nexport function fieldNameFromStoreName(storeFieldName: string): string {\n const match = storeFieldName.match(TypeOrFieldNameRegExp);\n return match ? match[0] : storeFieldName;\n}\n\nexport function selectionSetMatchesResult(\n selectionSet: SelectionSetNode,\n result: Record<string, any>,\n variables?: Record<string, any>,\n): boolean {\n if (isNonNullObject(result)) {\n return isArray(result)\n ? result.every(item => selectionSetMatchesResult(selectionSet, item, variables))\n : selectionSet.selections.every(field => {\n if (isField(field) && shouldInclude(field, variables)) {\n const key = resultKeyNameFromField(field);\n return hasOwn.call(result, key) &&\n (!field.selectionSet ||\n selectionSetMatchesResult(field.selectionSet, result[key], variables));\n }\n // If the selection has been skipped with @skip(true) or\n // @include(false), it should not count against the matching. If\n // the selection is not a field, it must be a fragment (inline or\n // named). We will determine if selectionSetMatchesResult for that\n // fragment when we get to it, so for now we return true.\n return true;\n });\n }\n return false;\n}\n\nexport function storeValueIsStoreObject(\n value: StoreValue,\n): value is StoreObject {\n return isNonNullObject(value) &&\n !isReference(value) &&\n !isArray(value);\n}\n\nexport function makeProcessedFieldsMerger() {\n return new DeepMerger;\n}\n\nexport function extractFragmentContext(\n document: DocumentNode,\n fragments?: FragmentRegistryAPI,\n): {\n fragmentMap: FragmentMap;\n lookupFragment: FragmentMapFunction;\n} {\n // FragmentMap consisting only of fragments defined directly in document, not\n // including other fragments registered in the FragmentRegistry.\n const fragmentMap = createFragmentMap(getFragmentDefinitions(document));\n return {\n fragmentMap,\n lookupFragment(name) {\n let def: FragmentDefinitionNode | null = fragmentMap[name];\n if (!def && fragments) {\n def = fragments.lookup(name);\n }\n return def || null;\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/cache/inmemory/policies.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,WAAW,EAEX,UAAU,EACV,WAAW,EAEX,SAAS,EACT,WAAW,EAIZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,QAAQ,EACR,SAAS,EAET,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAWjB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C,MAAM,MAAM,YAAY,GAAG;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pB,QAAQ,EAAE,kBAAkB,GAAG,sBAAsB,EACrD,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9B,OAAO;IAsFH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM;IAK1D,iBAAiB,CAAC,SAAS,EAAE,cAAc,GAAG,MAAM;IA+CpD,SAAS,CAAC,CAAC,GAAG,UAAU,EAC7B,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,sBAAsB,GAC9B,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IA2CvB,eAAe,CACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,MAAM,GAChB,iBAAiB,GAAG,SAAS;IAKzB,gBAAgB,CACrB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,kBAAkB,GAAG,SAAS;IAc1B,gBAAgB,CACrB,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,UAAU,EACpB,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,EACrC,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,WAAW;CA+CxB;AAmCD,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,UAAU,EACzB,iBAAiB,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,EACtD,SAAS,CAAC,EAAE,sBAAsB,CAAC,WAAW,CAAC,GAC9C,gBAAgB,CAqClB"}
|
|
@@ -162,9 +162,20 @@ var Policies = (function () {
|
|
|
162
162
|
if (!hasOwn.call(this.typePolicies, typename)) {
|
|
163
163
|
var policy_1 = this.typePolicies[typename] = Object.create(null);
|
|
164
164
|
policy_1.fields = Object.create(null);
|
|
165
|
-
var
|
|
166
|
-
if (
|
|
167
|
-
|
|
165
|
+
var supertypes_1 = this.supertypeMap.get(typename);
|
|
166
|
+
if (!supertypes_1 && this.fuzzySubtypes.size) {
|
|
167
|
+
supertypes_1 = this.getSupertypeSet(typename, true);
|
|
168
|
+
this.fuzzySubtypes.forEach(function (regExp, fuzzy) {
|
|
169
|
+
if (regExp.test(typename)) {
|
|
170
|
+
var fuzzySupertypes = _this.supertypeMap.get(fuzzy);
|
|
171
|
+
if (fuzzySupertypes) {
|
|
172
|
+
fuzzySupertypes.forEach(function (supertype) { return supertypes_1.add(supertype); });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
if (supertypes_1 && supertypes_1.size) {
|
|
178
|
+
supertypes_1.forEach(function (supertype) {
|
|
168
179
|
var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = __rest(_a, ["fields"]);
|
|
169
180
|
Object.assign(policy_1, rest);
|
|
170
181
|
Object.assign(policy_1.fields, fields);
|