kaafil-js 0.6.0 → 0.6.2
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/client-entry.cjs +14 -1
- package/dist/client-entry.cjs.map +1 -1
- package/dist/client-entry.js +14 -1
- package/dist/client-entry.js.map +1 -1
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1813,7 +1813,8 @@ function parseRetryAfterSeconds(headerValue) {
|
|
|
1813
1813
|
return Number.isFinite(seconds) && seconds >= 0 ? seconds : void 0;
|
|
1814
1814
|
}
|
|
1815
1815
|
function attachMeta(data, meta, facets) {
|
|
1816
|
-
const
|
|
1816
|
+
const base = data === void 0 || data === null ? {} : data;
|
|
1817
|
+
const withMeta = Object.assign(base, { meta });
|
|
1817
1818
|
return facets === void 0 ? withMeta : Object.assign(withMeta, { facets });
|
|
1818
1819
|
}
|
|
1819
1820
|
function describeCrossOriginSuspect(url) {
|
|
@@ -1877,6 +1878,18 @@ function sendOnce(ctx, request, idempotencyKey) {
|
|
|
1877
1878
|
return sendOnceWith(ctx, request, idempotencyKey, async (response, status, requestId) => {
|
|
1878
1879
|
const text = await response.text();
|
|
1879
1880
|
const body = text.length > 0 ? tryParseJson(text) : void 0;
|
|
1881
|
+
if (body === void 0 && status >= 200 && status < 300) {
|
|
1882
|
+
const serverDate = response.headers.get("date");
|
|
1883
|
+
return {
|
|
1884
|
+
data: void 0,
|
|
1885
|
+
meta: {
|
|
1886
|
+
status,
|
|
1887
|
+
requestId,
|
|
1888
|
+
...serverDate === null ? {} : { serverTime: new Date(serverDate).toISOString() }
|
|
1889
|
+
},
|
|
1890
|
+
facets: void 0
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1880
1893
|
if (!isSuccessEnvelope(body)) {
|
|
1881
1894
|
throw new KaafilNetworkError(`Received an unrecognizable success body for HTTP ${status}`, {
|
|
1882
1895
|
status,
|