@le-space/ui 0.3.26 → 0.3.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@le-space/ui",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
4
4
  "description": "Floating Aleph sponsor relay UI components for Svelte and React.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,8 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "@le-space/browser": "0.3.26",
40
- "@le-space/core": "0.3.26",
39
+ "@le-space/browser": "0.3.27",
40
+ "@le-space/core": "0.3.27",
41
41
  "viem": "^2.38.5"
42
42
  },
43
43
  "peerDependencies": {
package/react/index.js CHANGED
@@ -28,7 +28,7 @@ var RECENT_INSTANCE_RUNTIME_GRACE_MS = 10 * 60 * 1e3;
28
28
  var DEPLOYMENT_PENDING_WARNING_MS = 3 * 60 * 1e3;
29
29
 
30
30
  // src/shared/package-version.ts
31
- var UI_PACKAGE_VERSION = "0.3.26";
31
+ var UI_PACKAGE_VERSION = "0.3.27";
32
32
 
33
33
  // src/shared/format.ts
34
34
  function shortHash(value, head = 8, tail = 6) {
@@ -1237,16 +1237,6 @@ function normalizeBroadcastStatus(httpStatus, responseStatus) {
1237
1237
  if (httpStatus === 202) return "pending";
1238
1238
  return normalizeMessageStatus2(responseStatus);
1239
1239
  }
1240
- function isInvalidMessageFormatResponse2(response, payload) {
1241
- if (response.status !== 422) return false;
1242
- const details = payload?.details;
1243
- if (typeof details === "string" && details.includes("InvalidMessageFormat")) return true;
1244
- if (details && typeof details === "object") {
1245
- const detailMessage = details.message;
1246
- if (typeof detailMessage === "string" && detailMessage.includes("InvalidMessageFormat")) return true;
1247
- }
1248
- return false;
1249
- }
1250
1240
  function isRetryableBroadcastFailure(response, payload) {
1251
1241
  if (response.status >= 500) return true;
1252
1242
  const publicationStatus = payload?.publication_status?.status;
@@ -1268,25 +1258,22 @@ async function postBroadcastPayload2(body, options) {
1268
1258
  };
1269
1259
  }
1270
1260
  async function broadcastAlephMessage2(message, options) {
1271
- const attempts = [
1272
- { sync: options.sync ?? false, message },
1273
- { ...message, sync: options.sync ?? false },
1274
- { ...message }
1275
- ];
1276
- for (let index = 0; index < attempts.length; index += 1) {
1277
- const result = await postBroadcastPayload2(attempts[index], {
1261
+ const requestBody = { sync: options.sync ?? false, message };
1262
+ const maxAttempts = 3;
1263
+ for (let index = 0; index < maxAttempts; index += 1) {
1264
+ const result = await postBroadcastPayload2(requestBody, {
1278
1265
  apiHost: options.apiHost,
1279
1266
  fetch: options.fetch
1280
1267
  });
1281
1268
  if (result.httpStatus === 202 || normalizeBroadcastStatus(result.httpStatus, result.response?.message_status) !== "unknown" || result.httpStatus >= 200 && result.httpStatus < 300) {
1282
1269
  return result;
1283
1270
  }
1284
- const canRetry = index < attempts.length - 1 && (isInvalidMessageFormatResponse2({ status: result.httpStatus }, result.response) || isRetryableBroadcastFailure({ status: result.httpStatus }, result.response));
1271
+ const canRetry = index < maxAttempts - 1 && isRetryableBroadcastFailure({ status: result.httpStatus }, result.response);
1285
1272
  if (!canRetry) {
1286
1273
  throw new Error(`Broadcast failed: ${result.httpStatus} ${JSON.stringify(result.response ?? {})}`);
1287
1274
  }
1288
1275
  }
1289
- throw new Error("Broadcast failed: no compatible request format was accepted");
1276
+ throw new Error("Broadcast failed: retry budget exhausted");
1290
1277
  }
1291
1278
 
1292
1279
  // ../core/src/forget.ts
package/shared/index.d.ts CHANGED
@@ -290,7 +290,7 @@ declare const STALE_INSTANCE_ALLOCATION_COOLDOWN_MS: number;
290
290
  declare const RECENT_INSTANCE_RUNTIME_GRACE_MS: number;
291
291
  declare const DEPLOYMENT_PENDING_WARNING_MS: number;
292
292
 
293
- declare const UI_PACKAGE_VERSION = "0.3.26";
293
+ declare const UI_PACKAGE_VERSION = "0.3.27";
294
294
 
295
295
  interface RootfsRequiredPortForward {
296
296
  port: number;
package/shared/index.js CHANGED
@@ -27,7 +27,7 @@ var RECENT_INSTANCE_RUNTIME_GRACE_MS = 10 * 60 * 1e3;
27
27
  var DEPLOYMENT_PENDING_WARNING_MS = 3 * 60 * 1e3;
28
28
 
29
29
  // src/shared/package-version.ts
30
- var UI_PACKAGE_VERSION = "0.3.26";
30
+ var UI_PACKAGE_VERSION = "0.3.27";
31
31
 
32
32
  // src/shared/format.ts
33
33
  function shortHash(value, head = 8, tail = 6) {
@@ -1236,16 +1236,6 @@ function normalizeBroadcastStatus(httpStatus, responseStatus) {
1236
1236
  if (httpStatus === 202) return "pending";
1237
1237
  return normalizeMessageStatus2(responseStatus);
1238
1238
  }
1239
- function isInvalidMessageFormatResponse2(response, payload) {
1240
- if (response.status !== 422) return false;
1241
- const details = payload?.details;
1242
- if (typeof details === "string" && details.includes("InvalidMessageFormat")) return true;
1243
- if (details && typeof details === "object") {
1244
- const detailMessage = details.message;
1245
- if (typeof detailMessage === "string" && detailMessage.includes("InvalidMessageFormat")) return true;
1246
- }
1247
- return false;
1248
- }
1249
1239
  function isRetryableBroadcastFailure(response, payload) {
1250
1240
  if (response.status >= 500) return true;
1251
1241
  const publicationStatus = payload?.publication_status?.status;
@@ -1267,25 +1257,22 @@ async function postBroadcastPayload2(body, options) {
1267
1257
  };
1268
1258
  }
1269
1259
  async function broadcastAlephMessage2(message, options) {
1270
- const attempts = [
1271
- { sync: options.sync ?? false, message },
1272
- { ...message, sync: options.sync ?? false },
1273
- { ...message }
1274
- ];
1275
- for (let index = 0; index < attempts.length; index += 1) {
1276
- const result = await postBroadcastPayload2(attempts[index], {
1260
+ const requestBody = { sync: options.sync ?? false, message };
1261
+ const maxAttempts = 3;
1262
+ for (let index = 0; index < maxAttempts; index += 1) {
1263
+ const result = await postBroadcastPayload2(requestBody, {
1277
1264
  apiHost: options.apiHost,
1278
1265
  fetch: options.fetch
1279
1266
  });
1280
1267
  if (result.httpStatus === 202 || normalizeBroadcastStatus(result.httpStatus, result.response?.message_status) !== "unknown" || result.httpStatus >= 200 && result.httpStatus < 300) {
1281
1268
  return result;
1282
1269
  }
1283
- const canRetry = index < attempts.length - 1 && (isInvalidMessageFormatResponse2({ status: result.httpStatus }, result.response) || isRetryableBroadcastFailure({ status: result.httpStatus }, result.response));
1270
+ const canRetry = index < maxAttempts - 1 && isRetryableBroadcastFailure({ status: result.httpStatus }, result.response);
1284
1271
  if (!canRetry) {
1285
1272
  throw new Error(`Broadcast failed: ${result.httpStatus} ${JSON.stringify(result.response ?? {})}`);
1286
1273
  }
1287
1274
  }
1288
- throw new Error("Broadcast failed: no compatible request format was accepted");
1275
+ throw new Error("Broadcast failed: retry budget exhausted");
1289
1276
  }
1290
1277
 
1291
1278
  // ../core/src/forget.ts