@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.
@@ -1385,7 +1385,21 @@ var ShapeStream = class {
1385
1385
  fetchUrl = result.fetchUrl;
1386
1386
  fetchOptions = { headers: result.requestHeaders };
1387
1387
  }
1388
- const response = await __privateGet(this, _fetchClient2).call(this, fetchUrl.toString(), fetchOptions);
1388
+ const usedHandle = __privateGet(this, _shapeHandle);
1389
+ let response;
1390
+ try {
1391
+ response = await __privateGet(this, _fetchClient2).call(this, fetchUrl.toString(), fetchOptions);
1392
+ } catch (e) {
1393
+ if (e instanceof FetchError && e.status === 409) {
1394
+ if (usedHandle) {
1395
+ const shapeKey = canonicalShapeKey(fetchUrl);
1396
+ expiredShapesCache.markExpired(shapeKey, usedHandle);
1397
+ }
1398
+ __privateSet(this, _shapeHandle, e.headers[SHAPE_HANDLE_HEADER] || `${usedHandle != null ? usedHandle : `handle`}-next`);
1399
+ return this.fetchSnapshot(opts);
1400
+ }
1401
+ throw e;
1402
+ }
1389
1403
  if (!response.ok) {
1390
1404
  throw await FetchError.fromResponse(response, fetchUrl.toString());
1391
1405
  }
@@ -1714,8 +1728,9 @@ onInitialResponse_fn = async function(response) {
1714
1728
  );
1715
1729
  } else {
1716
1730
  console.warn(
1717
- `[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 handle and continuing with handle "${__privateGet(this, _shapeHandle)}".`
1731
+ `[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)}".`
1718
1732
  );
1733
+ return;
1719
1734
  }
1720
1735
  }
1721
1736
  const lastOffset = headers.get(CHUNK_LAST_OFFSET_HEADER);