@le-space/core 0.6.5 → 0.6.6
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/index.d.ts +2 -0
- package/index.js +25 -3
- package/package.json +3 -3
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1474,7 +1474,9 @@ async function publishAggregateKey(args) {
|
|
|
1474
1474
|
const { response, httpStatus } = await broadcastAlephMessage(message, {
|
|
1475
1475
|
apiHost: args.apiHost,
|
|
1476
1476
|
sync: true,
|
|
1477
|
-
fetch: args.fetch
|
|
1477
|
+
fetch: args.fetch,
|
|
1478
|
+
attempts: args.broadcastAttempts,
|
|
1479
|
+
retryDelayMs: args.broadcastRetryDelayMs
|
|
1478
1480
|
});
|
|
1479
1481
|
return {
|
|
1480
1482
|
itemHash: message.item_hash,
|
|
@@ -2462,15 +2464,35 @@ function browserMultiaddrPreference(addr) {
|
|
|
2462
2464
|
if (normalized.includes("/ws")) return 4;
|
|
2463
2465
|
return 5;
|
|
2464
2466
|
}
|
|
2467
|
+
function browserMultiaddrTransport(addr) {
|
|
2468
|
+
const normalized = addr.toLowerCase();
|
|
2469
|
+
if (normalized.includes("/webtransport/")) return "webtransport";
|
|
2470
|
+
if (normalized.includes("/webrtc-direct/")) return "webrtc";
|
|
2471
|
+
if (normalized.includes("/ws") || normalized.includes("/wss")) return "websocket";
|
|
2472
|
+
return "other";
|
|
2473
|
+
}
|
|
2465
2474
|
function selectCompactRelayBootstrapMultiaddrs(addrs, limit = DEFAULT_BOOTSTRAP_COMPACT_MULTIADDR_LIMIT) {
|
|
2466
2475
|
const entries = filterPublicMultiaddrs(addrs, {
|
|
2467
2476
|
browserDialableOnly: true
|
|
2468
|
-
}).map((addr, index) => ({
|
|
2477
|
+
}).map((addr, index) => ({
|
|
2478
|
+
addr,
|
|
2479
|
+
index,
|
|
2480
|
+
transport: browserMultiaddrTransport(addr)
|
|
2481
|
+
}));
|
|
2469
2482
|
entries.sort((left, right) => {
|
|
2470
2483
|
const preference = browserMultiaddrPreference(left.addr) - browserMultiaddrPreference(right.addr);
|
|
2471
2484
|
return preference !== 0 ? preference : left.index - right.index;
|
|
2472
2485
|
});
|
|
2473
|
-
|
|
2486
|
+
const perTransportLimit = Math.max(1, Math.floor(limit));
|
|
2487
|
+
const selectedByTransport = /* @__PURE__ */ new Map();
|
|
2488
|
+
const result = [];
|
|
2489
|
+
for (const entry of entries) {
|
|
2490
|
+
const selected = selectedByTransport.get(entry.transport) ?? 0;
|
|
2491
|
+
if (selected >= perTransportLimit) continue;
|
|
2492
|
+
selectedByTransport.set(entry.transport, selected + 1);
|
|
2493
|
+
result.push(entry.addr);
|
|
2494
|
+
}
|
|
2495
|
+
return result;
|
|
2474
2496
|
}
|
|
2475
2497
|
function asTrimmedString(value) {
|
|
2476
2498
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "Reusable Aleph deployment, runtime, and guest lifecycle logic.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/NiKrause/relay-button/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@le-space/aleph-bootstrap": "0.6.
|
|
28
|
-
"@le-space/shared-types": "0.6.
|
|
27
|
+
"@le-space/aleph-bootstrap": "0.6.6",
|
|
28
|
+
"@le-space/shared-types": "0.6.6"
|
|
29
29
|
}
|
|
30
30
|
}
|