@electric-sql/client 1.5.0 → 1.5.1
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/dist/cjs/index.cjs +17 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.legacy-esm.js +17 -2
- package/dist/index.legacy-esm.js.map +1 -1
- package/dist/index.mjs +17 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +29 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1420,7 +1420,21 @@ var ShapeStream = class {
|
|
|
1420
1420
|
fetchUrl = result.fetchUrl;
|
|
1421
1421
|
fetchOptions = { headers: result.requestHeaders };
|
|
1422
1422
|
}
|
|
1423
|
-
const
|
|
1423
|
+
const usedHandle = __privateGet(this, _shapeHandle);
|
|
1424
|
+
let response;
|
|
1425
|
+
try {
|
|
1426
|
+
response = await __privateGet(this, _fetchClient2).call(this, fetchUrl.toString(), fetchOptions);
|
|
1427
|
+
} catch (e) {
|
|
1428
|
+
if (e instanceof FetchError && e.status === 409) {
|
|
1429
|
+
if (usedHandle) {
|
|
1430
|
+
const shapeKey = canonicalShapeKey(fetchUrl);
|
|
1431
|
+
expiredShapesCache.markExpired(shapeKey, usedHandle);
|
|
1432
|
+
}
|
|
1433
|
+
__privateSet(this, _shapeHandle, e.headers[SHAPE_HANDLE_HEADER] || `${usedHandle != null ? usedHandle : `handle`}-next`);
|
|
1434
|
+
return this.fetchSnapshot(opts);
|
|
1435
|
+
}
|
|
1436
|
+
throw e;
|
|
1437
|
+
}
|
|
1424
1438
|
if (!response.ok) {
|
|
1425
1439
|
throw await FetchError.fromResponse(response, fetchUrl.toString());
|
|
1426
1440
|
}
|
|
@@ -1749,8 +1763,9 @@ onInitialResponse_fn = async function(response) {
|
|
|
1749
1763
|
);
|
|
1750
1764
|
} else {
|
|
1751
1765
|
console.warn(
|
|
1752
|
-
`[Electric] Received stale cached response with expired shape handle. This should not happen and indicates a proxy/CDN caching misconfiguration. The response contained handle "${shapeHandle}" which was previously marked as expired. Check that your proxy includes all query parameters (especially 'handle' and 'offset') in its cache key. Ignoring the stale
|
|
1766
|
+
`[Electric] Received stale cached response with expired shape handle. This should not happen and indicates a proxy/CDN caching misconfiguration. The response contained handle "${shapeHandle}" which was previously marked as expired. Check that your proxy includes all query parameters (especially 'handle' and 'offset') in its cache key. Ignoring the stale response and continuing with handle "${__privateGet(this, _shapeHandle)}".`
|
|
1753
1767
|
);
|
|
1768
|
+
return;
|
|
1754
1769
|
}
|
|
1755
1770
|
}
|
|
1756
1771
|
const lastOffset = headers.get(CHUNK_LAST_OFFSET_HEADER);
|