@apollo/client 3.7.13 → 3.7.15
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 +29 -18
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +1 -1
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +1 -1
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/http/http.cjs +14 -13
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +14 -13
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +14 -13
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +7 -3
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +7 -3
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +7 -3
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/package.json +22 -19
- package/react/hooks/useFragment.d.ts +2 -1
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +1 -1
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +13 -3
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/utilities.cjs +13 -3
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +13 -3
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -340,9 +340,7 @@ function resultKeyNameFromField(field) {
|
|
|
340
340
|
return field.alias ? field.alias.value : field.name.value;
|
|
341
341
|
}
|
|
342
342
|
function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
343
|
-
|
|
344
|
-
return result.__typename;
|
|
345
|
-
}
|
|
343
|
+
var fragments;
|
|
346
344
|
for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
|
|
347
345
|
var selection = _a[_i];
|
|
348
346
|
if (isField(selection)) {
|
|
@@ -350,7 +348,19 @@ function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
|
350
348
|
return result[resultKeyNameFromField(selection)];
|
|
351
349
|
}
|
|
352
350
|
}
|
|
351
|
+
else if (fragments) {
|
|
352
|
+
fragments.push(selection);
|
|
353
|
+
}
|
|
353
354
|
else {
|
|
355
|
+
fragments = [selection];
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (typeof result.__typename === 'string') {
|
|
359
|
+
return result.__typename;
|
|
360
|
+
}
|
|
361
|
+
if (fragments) {
|
|
362
|
+
for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {
|
|
363
|
+
var selection = fragments_1[_b];
|
|
354
364
|
var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
|
|
355
365
|
if (typeof typename === 'string') {
|
|
356
366
|
return typename;
|
|
@@ -1360,7 +1370,7 @@ var concat = ApolloLink.concat;
|
|
|
1360
1370
|
|
|
1361
1371
|
var execute = ApolloLink.execute;
|
|
1362
1372
|
|
|
1363
|
-
var version = '3.7.
|
|
1373
|
+
var version = '3.7.15';
|
|
1364
1374
|
|
|
1365
1375
|
function isNodeResponse(value) {
|
|
1366
1376
|
return !!value.body;
|
|
@@ -1565,7 +1575,7 @@ var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
|
1565
1575
|
function readMultipartBody(response, observer) {
|
|
1566
1576
|
var _a, _b, _c, _d, _e;
|
|
1567
1577
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1568
|
-
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _f, value, done, chunk, bi, message, i, headers, contentType_1, body, result, next;
|
|
1578
|
+
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _f, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;
|
|
1569
1579
|
var _g, _h;
|
|
1570
1580
|
return tslib.__generator(this, function (_j) {
|
|
1571
1581
|
switch (_j.label) {
|
|
@@ -1579,7 +1589,7 @@ function readMultipartBody(response, observer) {
|
|
|
1579
1589
|
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter))
|
|
1580
1590
|
? contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim()
|
|
1581
1591
|
: "-";
|
|
1582
|
-
boundary = "--".concat(boundaryVal);
|
|
1592
|
+
boundary = "\r\n--".concat(boundaryVal);
|
|
1583
1593
|
buffer = "";
|
|
1584
1594
|
iterator = responseIterator(response);
|
|
1585
1595
|
running = true;
|
|
@@ -1590,26 +1600,27 @@ function readMultipartBody(response, observer) {
|
|
|
1590
1600
|
case 2:
|
|
1591
1601
|
_f = _j.sent(), value = _f.value, done = _f.done;
|
|
1592
1602
|
chunk = typeof value === "string" ? value : decoder.decode(value);
|
|
1603
|
+
searchFrom = buffer.length - boundary.length + 1;
|
|
1593
1604
|
running = !done;
|
|
1594
1605
|
buffer += chunk;
|
|
1595
|
-
bi = buffer.indexOf(boundary);
|
|
1606
|
+
bi = buffer.indexOf(boundary, searchFrom);
|
|
1596
1607
|
while (bi > -1) {
|
|
1597
1608
|
message = void 0;
|
|
1598
1609
|
_g = [
|
|
1599
1610
|
buffer.slice(0, bi),
|
|
1600
1611
|
buffer.slice(bi + boundary.length),
|
|
1601
1612
|
], message = _g[0], buffer = _g[1];
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1613
|
+
i = message.indexOf("\r\n\r\n");
|
|
1614
|
+
headers = parseHeaders(message.slice(0, i));
|
|
1615
|
+
contentType_1 = headers["content-type"];
|
|
1616
|
+
if (contentType_1 &&
|
|
1617
|
+
contentType_1.toLowerCase().indexOf("application/json") === -1) {
|
|
1618
|
+
throw new Error("Unsupported patch content type: application/json is required.");
|
|
1619
|
+
}
|
|
1620
|
+
body = message.slice(i);
|
|
1621
|
+
if (body) {
|
|
1611
1622
|
try {
|
|
1612
|
-
result = parseJsonBody(response, body
|
|
1623
|
+
result = parseJsonBody(response, body);
|
|
1613
1624
|
if (Object.keys(result).length > 1 ||
|
|
1614
1625
|
"data" in result ||
|
|
1615
1626
|
"incremental" in result ||
|
|
@@ -3265,7 +3276,7 @@ var Policies = (function () {
|
|
|
3265
3276
|
var policy = typename && this.getTypePolicy(typename);
|
|
3266
3277
|
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
3267
3278
|
while (keyFn) {
|
|
3268
|
-
var specifierOrId = keyFn(object, context);
|
|
3279
|
+
var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context);
|
|
3269
3280
|
if (isArray(specifierOrId)) {
|
|
3270
3281
|
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
3271
3282
|
}
|