@le-space/ui 0.6.2 → 0.6.4
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 +3 -3
- package/react/index.js +65 -16
- package/shared/index.d.ts +8 -2
- package/shared/index.js +71 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "Floating Aleph sponsor relay UI components for Svelte and React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"url": "https://github.com/NiKrause/relay-button/issues"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@le-space/browser": "0.6.
|
|
48
|
-
"@le-space/core": "0.6.
|
|
47
|
+
"@le-space/browser": "0.6.4",
|
|
48
|
+
"@le-space/core": "0.6.4",
|
|
49
49
|
"viem": "^2.38.5"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
package/react/index.js
CHANGED
|
@@ -5,6 +5,21 @@ import React from "react";
|
|
|
5
5
|
var DEFAULT_INSTANCE_NAME = "sponsor-relay";
|
|
6
6
|
var DEFAULT_MANIFEST_URL = "./rootfs-manifest.json";
|
|
7
7
|
var DEFAULT_TIER_ID = "tier-1";
|
|
8
|
+
var DEFAULT_UCAN_STORE_PWA_ORIGIN = "https://ucan.nicokrause.com";
|
|
9
|
+
var DEFAULT_UCAN_STORE_SERVICE_ORIGIN = "https://ucan-api.nicokrause.com";
|
|
10
|
+
var DEFAULT_UCAN_STORE_SERVICE_DID = "did:web:ucan-api.nicokrause.com";
|
|
11
|
+
var DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES = [
|
|
12
|
+
"space/blob/add",
|
|
13
|
+
"space/blob/list",
|
|
14
|
+
"space/index/add",
|
|
15
|
+
"space/index/list",
|
|
16
|
+
"filecoin/offer",
|
|
17
|
+
"upload/add",
|
|
18
|
+
"upload/list",
|
|
19
|
+
"store/add"
|
|
20
|
+
];
|
|
21
|
+
var DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS = "31536000";
|
|
22
|
+
var DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS = "315360000";
|
|
8
23
|
var ROOTFS_MISSING_STATE = {
|
|
9
24
|
tone: "idle",
|
|
10
25
|
label: "manifest missing",
|
|
@@ -28,7 +43,7 @@ var RECENT_INSTANCE_RUNTIME_GRACE_MS = 10 * 60 * 1e3;
|
|
|
28
43
|
var DEPLOYMENT_PENDING_WARNING_MS = 3 * 60 * 1e3;
|
|
29
44
|
|
|
30
45
|
// src/shared/package-version.ts
|
|
31
|
-
var UI_PACKAGE_VERSION = "0.6.
|
|
46
|
+
var UI_PACKAGE_VERSION = "0.6.4";
|
|
32
47
|
|
|
33
48
|
// src/shared/format.ts
|
|
34
49
|
function shortHash(value, head = 8, tail = 6) {
|
|
@@ -871,7 +886,7 @@ async function fetchInstancePricing(apiHost = DEFAULT_ALEPH_API_HOST, aggregateA
|
|
|
871
886
|
}
|
|
872
887
|
|
|
873
888
|
// ../core/src/constants.ts
|
|
874
|
-
var DEFAULT_ALEPH_CHANNEL = "
|
|
889
|
+
var DEFAULT_ALEPH_CHANNEL = "ALEPH-CLOUDSOLUTIONS";
|
|
875
890
|
|
|
876
891
|
// ../core/src/manifests.ts
|
|
877
892
|
var DEFAULT_ALEPH_API_HOST2 = "https://api.aleph.im";
|
|
@@ -1153,6 +1168,13 @@ function normalizeExecution2(item, crnUrl) {
|
|
|
1153
1168
|
}
|
|
1154
1169
|
|
|
1155
1170
|
// ../core/src/deployment-inspection.ts
|
|
1171
|
+
var TRANSIENT_MESSAGE_LOOKUP_STATUSES = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
1172
|
+
function isTransientMessageLookupError(error) {
|
|
1173
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1174
|
+
const match = message.match(/Message lookup failed: (\d{3})/);
|
|
1175
|
+
if (!match) return false;
|
|
1176
|
+
return TRANSIENT_MESSAGE_LOOKUP_STATUSES.has(Number(match[1]));
|
|
1177
|
+
}
|
|
1156
1178
|
async function fetchMessageEnvelope2(itemHash, options) {
|
|
1157
1179
|
const response = await options.fetch(`${options.apiHost ?? DEFAULT_ALEPH_API_HOST2}/api/v0/messages/${itemHash}`, {
|
|
1158
1180
|
cache: "no-cache"
|
|
@@ -1209,15 +1231,32 @@ async function waitForDeploymentResult2(itemHash, options) {
|
|
|
1209
1231
|
const attempts = Math.max(1, Number(options.attempts ?? 15));
|
|
1210
1232
|
const delayMs = Math.max(0, Number(options.delayMs ?? 2e3));
|
|
1211
1233
|
const sleep2 = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1212
|
-
let lastResult =
|
|
1213
|
-
|
|
1214
|
-
|
|
1234
|
+
let lastResult = {
|
|
1235
|
+
status: "unknown",
|
|
1236
|
+
errorCode: null,
|
|
1237
|
+
details: null,
|
|
1238
|
+
rejectionReason: null,
|
|
1239
|
+
references: []
|
|
1240
|
+
};
|
|
1241
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
1242
|
+
try {
|
|
1243
|
+
lastResult = await inspectDeploymentResult2(itemHash, options);
|
|
1244
|
+
} catch (error) {
|
|
1245
|
+
if (!isTransientMessageLookupError(error)) {
|
|
1246
|
+
throw error;
|
|
1247
|
+
}
|
|
1248
|
+
lastResult = {
|
|
1249
|
+
...lastResult,
|
|
1250
|
+
rejectionReason: error instanceof Error ? error.message : String(error)
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
options.onAttempt?.(lastResult, attempt, attempts);
|
|
1215
1254
|
if (lastResult.status === "processed" || lastResult.status === "rejected") {
|
|
1216
1255
|
return lastResult;
|
|
1217
1256
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1257
|
+
if (attempt < attempts) {
|
|
1258
|
+
await sleep2(delayMs);
|
|
1259
|
+
}
|
|
1221
1260
|
}
|
|
1222
1261
|
return lastResult;
|
|
1223
1262
|
}
|
|
@@ -1259,7 +1298,9 @@ async function postBroadcastPayload2(body, options) {
|
|
|
1259
1298
|
}
|
|
1260
1299
|
async function broadcastAlephMessage2(message, options) {
|
|
1261
1300
|
const requestBody = { sync: options.sync ?? false, message };
|
|
1262
|
-
const maxAttempts = 3;
|
|
1301
|
+
const maxAttempts = Math.max(1, Number(options.attempts ?? 3));
|
|
1302
|
+
const retryDelayMs = Math.max(0, Number(options.retryDelayMs ?? 0));
|
|
1303
|
+
const sleep2 = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1263
1304
|
for (let index = 0; index < maxAttempts; index += 1) {
|
|
1264
1305
|
const result = await postBroadcastPayload2(requestBody, {
|
|
1265
1306
|
apiHost: options.apiHost,
|
|
@@ -1272,6 +1313,9 @@ async function broadcastAlephMessage2(message, options) {
|
|
|
1272
1313
|
if (!canRetry) {
|
|
1273
1314
|
throw new Error(`Broadcast failed: ${result.httpStatus} ${JSON.stringify(result.response ?? {})}`);
|
|
1274
1315
|
}
|
|
1316
|
+
if (retryDelayMs > 0) {
|
|
1317
|
+
await sleep2(retryDelayMs);
|
|
1318
|
+
}
|
|
1275
1319
|
}
|
|
1276
1320
|
throw new Error("Broadcast failed: retry budget exhausted");
|
|
1277
1321
|
}
|
|
@@ -2079,7 +2123,10 @@ async function deployInstance(args) {
|
|
|
2079
2123
|
const { response, httpStatus } = await broadcastAlephMessage2(message, {
|
|
2080
2124
|
apiHost: args.apiHost,
|
|
2081
2125
|
sync: args.sync,
|
|
2082
|
-
fetch: args.fetch
|
|
2126
|
+
fetch: args.fetch,
|
|
2127
|
+
attempts: args.broadcastAttempts,
|
|
2128
|
+
retryDelayMs: args.broadcastRetryDelayMs,
|
|
2129
|
+
sleep: args.broadcastSleep
|
|
2083
2130
|
});
|
|
2084
2131
|
const status = httpStatus === 202 ? "pending" : typeof response.message_status === "string" ? response.message_status : "unknown";
|
|
2085
2132
|
args.onProgress?.({
|
|
@@ -2284,6 +2331,8 @@ async function configureUcanStore(args) {
|
|
|
2284
2331
|
public_ipv4: args.hostIpv4,
|
|
2285
2332
|
public_ipv6: args.publicIpv6 ?? void 0,
|
|
2286
2333
|
proxy_url: args.proxyUrl ?? void 0,
|
|
2334
|
+
service_did: args.serviceDid ?? void 0,
|
|
2335
|
+
service_origin: args.serviceOrigin ?? void 0,
|
|
2287
2336
|
webauthn_origin: args.webauthnOrigin ?? void 0,
|
|
2288
2337
|
webauthn_origin_fallbacks: args.webauthnOriginFallbacks ?? void 0,
|
|
2289
2338
|
admin_did: args.adminDid ?? void 0,
|
|
@@ -3451,14 +3500,14 @@ function isConfirmedGuestSetupResult(value) {
|
|
|
3451
3500
|
function defaultUcanStoreBootstrapInput(props) {
|
|
3452
3501
|
return {
|
|
3453
3502
|
adminDid: props.ucanStoreBootstrap?.adminDid ?? "",
|
|
3454
|
-
serviceDid: props.ucanStoreBootstrap?.serviceDid ??
|
|
3503
|
+
serviceDid: props.ucanStoreBootstrap?.serviceDid ?? DEFAULT_UCAN_STORE_SERVICE_DID,
|
|
3455
3504
|
spaceDid: props.ucanStoreBootstrap?.spaceDid ?? "",
|
|
3456
3505
|
rootDelegationProof: props.ucanStoreBootstrap?.rootDelegationProof ?? "",
|
|
3457
|
-
allowedCapabilities: props.ucanStoreBootstrap?.allowedCapabilities ?? "",
|
|
3458
|
-
defaultUserDelegationExpiration: props.ucanStoreBootstrap?.defaultUserDelegationExpiration ??
|
|
3459
|
-
maxUserDelegationExpiration: props.ucanStoreBootstrap?.maxUserDelegationExpiration ??
|
|
3460
|
-
pwaOrigin: props.ucanStoreBootstrap?.pwaOrigin ??
|
|
3461
|
-
serviceOrigin: props.ucanStoreBootstrap?.serviceOrigin ??
|
|
3506
|
+
allowedCapabilities: props.ucanStoreBootstrap?.allowedCapabilities ?? DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES.join("\n"),
|
|
3507
|
+
defaultUserDelegationExpiration: props.ucanStoreBootstrap?.defaultUserDelegationExpiration ?? DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS,
|
|
3508
|
+
maxUserDelegationExpiration: props.ucanStoreBootstrap?.maxUserDelegationExpiration ?? DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS,
|
|
3509
|
+
pwaOrigin: props.ucanStoreBootstrap?.pwaOrigin ?? DEFAULT_UCAN_STORE_PWA_ORIGIN,
|
|
3510
|
+
serviceOrigin: props.ucanStoreBootstrap?.serviceOrigin ?? DEFAULT_UCAN_STORE_SERVICE_ORIGIN
|
|
3462
3511
|
};
|
|
3463
3512
|
}
|
|
3464
3513
|
function currentPageOrigin() {
|
package/shared/index.d.ts
CHANGED
|
@@ -313,6 +313,12 @@ type SponsorRelaySubscriber = (state: SponsorRelayState) => void;
|
|
|
313
313
|
declare const DEFAULT_INSTANCE_NAME = "sponsor-relay";
|
|
314
314
|
declare const DEFAULT_MANIFEST_URL = "./rootfs-manifest.json";
|
|
315
315
|
declare const DEFAULT_TIER_ID = "tier-1";
|
|
316
|
+
declare const DEFAULT_UCAN_STORE_PWA_ORIGIN = "https://ucan.nicokrause.com";
|
|
317
|
+
declare const DEFAULT_UCAN_STORE_SERVICE_ORIGIN = "https://ucan-api.nicokrause.com";
|
|
318
|
+
declare const DEFAULT_UCAN_STORE_SERVICE_DID = "did:web:ucan-api.nicokrause.com";
|
|
319
|
+
declare const DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES: string[];
|
|
320
|
+
declare const DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS = "31536000";
|
|
321
|
+
declare const DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS = "315360000";
|
|
316
322
|
declare const ROOTFS_MISSING_STATE: SponsorRelayRootfsHealth;
|
|
317
323
|
declare const IDLE_DEPLOYMENT_PROGRESS: DeploymentProgressEvent;
|
|
318
324
|
declare const REFRESH_INTERVAL_MS = 30000;
|
|
@@ -324,7 +330,7 @@ declare const STALE_INSTANCE_ALLOCATION_COOLDOWN_MS: number;
|
|
|
324
330
|
declare const RECENT_INSTANCE_RUNTIME_GRACE_MS: number;
|
|
325
331
|
declare const DEPLOYMENT_PENDING_WARNING_MS: number;
|
|
326
332
|
|
|
327
|
-
declare const UI_PACKAGE_VERSION = "0.6.
|
|
333
|
+
declare const UI_PACKAGE_VERSION = "0.6.4";
|
|
328
334
|
|
|
329
335
|
interface RootfsRequiredPortForward {
|
|
330
336
|
port: number;
|
|
@@ -419,4 +425,4 @@ interface DeploymentProgressEmitter {
|
|
|
419
425
|
}
|
|
420
426
|
declare function createDeploymentProgressEmitter(): DeploymentProgressEmitter;
|
|
421
427
|
|
|
422
|
-
export { type CompactBootstrapRegistrationRecord, type CompactInstanceDetails, type CompactInstanceRecord, DEFAULT_INSTANCE_NAME, DEFAULT_MANIFEST_URL, DEFAULT_TIER_ID, DEPLOYMENT_PENDING_WARNING_MS, type DeploymentProgressEmitter, type EthereumProviderLike, IDLE_DEPLOYMENT_PROGRESS, INSTANCE_RUNTIME_PENDING_REFRESH_MS, INSTANCE_RUNTIME_READY_REFRESH_MS, INSTANCE_RUNTIME_STALE_REFRESH_MS, MANIFEST_SOURCE_REFRESH_DEBOUNCE_MS, RECENT_INSTANCE_RUNTIME_GRACE_MS, REFRESH_INTERVAL_MS, ROOTFS_MISSING_STATE, STALE_INSTANCE_ALLOCATION_COOLDOWN_MS, SponsorRelayController, type SponsorRelayHealthTone, type SponsorRelayPricingSummary, type SponsorRelayProps, type SponsorRelayRootfsHealth, type SponsorRelayState, type SponsorRelaySubscriber, type SponsorRelayUcanStoreBootstrapInput, type SponsorRelayWalletState, UI_PACKAGE_VERSION, buildSshCommand, connectWallet, createDeploymentProgressEmitter, createSponsorRelayController, formatDateTime, formatNumber, formatTierSpecLabel, getEthereumProvider, joinMappedPorts, joinRequiredPortForwards, personalSign, resolveManifestSource, shortHash, toChecksumAddress, watchWallet };
|
|
428
|
+
export { type CompactBootstrapRegistrationRecord, type CompactInstanceDetails, type CompactInstanceRecord, DEFAULT_INSTANCE_NAME, DEFAULT_MANIFEST_URL, DEFAULT_TIER_ID, DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES, DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS, DEFAULT_UCAN_STORE_PWA_ORIGIN, DEFAULT_UCAN_STORE_SERVICE_DID, DEFAULT_UCAN_STORE_SERVICE_ORIGIN, DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS, DEPLOYMENT_PENDING_WARNING_MS, type DeploymentProgressEmitter, type EthereumProviderLike, IDLE_DEPLOYMENT_PROGRESS, INSTANCE_RUNTIME_PENDING_REFRESH_MS, INSTANCE_RUNTIME_READY_REFRESH_MS, INSTANCE_RUNTIME_STALE_REFRESH_MS, MANIFEST_SOURCE_REFRESH_DEBOUNCE_MS, RECENT_INSTANCE_RUNTIME_GRACE_MS, REFRESH_INTERVAL_MS, ROOTFS_MISSING_STATE, STALE_INSTANCE_ALLOCATION_COOLDOWN_MS, SponsorRelayController, type SponsorRelayHealthTone, type SponsorRelayPricingSummary, type SponsorRelayProps, type SponsorRelayRootfsHealth, type SponsorRelayState, type SponsorRelaySubscriber, type SponsorRelayUcanStoreBootstrapInput, type SponsorRelayWalletState, UI_PACKAGE_VERSION, buildSshCommand, connectWallet, createDeploymentProgressEmitter, createSponsorRelayController, formatDateTime, formatNumber, formatTierSpecLabel, getEthereumProvider, joinMappedPorts, joinRequiredPortForwards, personalSign, resolveManifestSource, shortHash, toChecksumAddress, watchWallet };
|
package/shared/index.js
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
var DEFAULT_INSTANCE_NAME = "sponsor-relay";
|
|
3
3
|
var DEFAULT_MANIFEST_URL = "./rootfs-manifest.json";
|
|
4
4
|
var DEFAULT_TIER_ID = "tier-1";
|
|
5
|
+
var DEFAULT_UCAN_STORE_PWA_ORIGIN = "https://ucan.nicokrause.com";
|
|
6
|
+
var DEFAULT_UCAN_STORE_SERVICE_ORIGIN = "https://ucan-api.nicokrause.com";
|
|
7
|
+
var DEFAULT_UCAN_STORE_SERVICE_DID = "did:web:ucan-api.nicokrause.com";
|
|
8
|
+
var DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES = [
|
|
9
|
+
"space/blob/add",
|
|
10
|
+
"space/blob/list",
|
|
11
|
+
"space/index/add",
|
|
12
|
+
"space/index/list",
|
|
13
|
+
"filecoin/offer",
|
|
14
|
+
"upload/add",
|
|
15
|
+
"upload/list",
|
|
16
|
+
"store/add"
|
|
17
|
+
];
|
|
18
|
+
var DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS = "31536000";
|
|
19
|
+
var DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS = "315360000";
|
|
5
20
|
var ROOTFS_MISSING_STATE = {
|
|
6
21
|
tone: "idle",
|
|
7
22
|
label: "manifest missing",
|
|
@@ -27,7 +42,7 @@ var RECENT_INSTANCE_RUNTIME_GRACE_MS = 10 * 60 * 1e3;
|
|
|
27
42
|
var DEPLOYMENT_PENDING_WARNING_MS = 3 * 60 * 1e3;
|
|
28
43
|
|
|
29
44
|
// src/shared/package-version.ts
|
|
30
|
-
var UI_PACKAGE_VERSION = "0.6.
|
|
45
|
+
var UI_PACKAGE_VERSION = "0.6.4";
|
|
31
46
|
|
|
32
47
|
// src/shared/format.ts
|
|
33
48
|
function shortHash(value, head = 8, tail = 6) {
|
|
@@ -870,7 +885,7 @@ async function fetchInstancePricing(apiHost = DEFAULT_ALEPH_API_HOST, aggregateA
|
|
|
870
885
|
}
|
|
871
886
|
|
|
872
887
|
// ../core/src/constants.ts
|
|
873
|
-
var DEFAULT_ALEPH_CHANNEL = "
|
|
888
|
+
var DEFAULT_ALEPH_CHANNEL = "ALEPH-CLOUDSOLUTIONS";
|
|
874
889
|
|
|
875
890
|
// ../core/src/manifests.ts
|
|
876
891
|
var DEFAULT_ALEPH_API_HOST2 = "https://api.aleph.im";
|
|
@@ -1152,6 +1167,13 @@ function normalizeExecution2(item, crnUrl) {
|
|
|
1152
1167
|
}
|
|
1153
1168
|
|
|
1154
1169
|
// ../core/src/deployment-inspection.ts
|
|
1170
|
+
var TRANSIENT_MESSAGE_LOOKUP_STATUSES = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
1171
|
+
function isTransientMessageLookupError(error) {
|
|
1172
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1173
|
+
const match = message.match(/Message lookup failed: (\d{3})/);
|
|
1174
|
+
if (!match) return false;
|
|
1175
|
+
return TRANSIENT_MESSAGE_LOOKUP_STATUSES.has(Number(match[1]));
|
|
1176
|
+
}
|
|
1155
1177
|
async function fetchMessageEnvelope2(itemHash, options) {
|
|
1156
1178
|
const response = await options.fetch(`${options.apiHost ?? DEFAULT_ALEPH_API_HOST2}/api/v0/messages/${itemHash}`, {
|
|
1157
1179
|
cache: "no-cache"
|
|
@@ -1208,15 +1230,32 @@ async function waitForDeploymentResult2(itemHash, options) {
|
|
|
1208
1230
|
const attempts = Math.max(1, Number(options.attempts ?? 15));
|
|
1209
1231
|
const delayMs = Math.max(0, Number(options.delayMs ?? 2e3));
|
|
1210
1232
|
const sleep2 = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1211
|
-
let lastResult =
|
|
1212
|
-
|
|
1213
|
-
|
|
1233
|
+
let lastResult = {
|
|
1234
|
+
status: "unknown",
|
|
1235
|
+
errorCode: null,
|
|
1236
|
+
details: null,
|
|
1237
|
+
rejectionReason: null,
|
|
1238
|
+
references: []
|
|
1239
|
+
};
|
|
1240
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
1241
|
+
try {
|
|
1242
|
+
lastResult = await inspectDeploymentResult2(itemHash, options);
|
|
1243
|
+
} catch (error) {
|
|
1244
|
+
if (!isTransientMessageLookupError(error)) {
|
|
1245
|
+
throw error;
|
|
1246
|
+
}
|
|
1247
|
+
lastResult = {
|
|
1248
|
+
...lastResult,
|
|
1249
|
+
rejectionReason: error instanceof Error ? error.message : String(error)
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
options.onAttempt?.(lastResult, attempt, attempts);
|
|
1214
1253
|
if (lastResult.status === "processed" || lastResult.status === "rejected") {
|
|
1215
1254
|
return lastResult;
|
|
1216
1255
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1256
|
+
if (attempt < attempts) {
|
|
1257
|
+
await sleep2(delayMs);
|
|
1258
|
+
}
|
|
1220
1259
|
}
|
|
1221
1260
|
return lastResult;
|
|
1222
1261
|
}
|
|
@@ -1258,7 +1297,9 @@ async function postBroadcastPayload2(body, options) {
|
|
|
1258
1297
|
}
|
|
1259
1298
|
async function broadcastAlephMessage2(message, options) {
|
|
1260
1299
|
const requestBody = { sync: options.sync ?? false, message };
|
|
1261
|
-
const maxAttempts = 3;
|
|
1300
|
+
const maxAttempts = Math.max(1, Number(options.attempts ?? 3));
|
|
1301
|
+
const retryDelayMs = Math.max(0, Number(options.retryDelayMs ?? 0));
|
|
1302
|
+
const sleep2 = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
1262
1303
|
for (let index = 0; index < maxAttempts; index += 1) {
|
|
1263
1304
|
const result = await postBroadcastPayload2(requestBody, {
|
|
1264
1305
|
apiHost: options.apiHost,
|
|
@@ -1271,6 +1312,9 @@ async function broadcastAlephMessage2(message, options) {
|
|
|
1271
1312
|
if (!canRetry) {
|
|
1272
1313
|
throw new Error(`Broadcast failed: ${result.httpStatus} ${JSON.stringify(result.response ?? {})}`);
|
|
1273
1314
|
}
|
|
1315
|
+
if (retryDelayMs > 0) {
|
|
1316
|
+
await sleep2(retryDelayMs);
|
|
1317
|
+
}
|
|
1274
1318
|
}
|
|
1275
1319
|
throw new Error("Broadcast failed: retry budget exhausted");
|
|
1276
1320
|
}
|
|
@@ -2078,7 +2122,10 @@ async function deployInstance(args) {
|
|
|
2078
2122
|
const { response, httpStatus } = await broadcastAlephMessage2(message, {
|
|
2079
2123
|
apiHost: args.apiHost,
|
|
2080
2124
|
sync: args.sync,
|
|
2081
|
-
fetch: args.fetch
|
|
2125
|
+
fetch: args.fetch,
|
|
2126
|
+
attempts: args.broadcastAttempts,
|
|
2127
|
+
retryDelayMs: args.broadcastRetryDelayMs,
|
|
2128
|
+
sleep: args.broadcastSleep
|
|
2082
2129
|
});
|
|
2083
2130
|
const status = httpStatus === 202 ? "pending" : typeof response.message_status === "string" ? response.message_status : "unknown";
|
|
2084
2131
|
args.onProgress?.({
|
|
@@ -2283,6 +2330,8 @@ async function configureUcanStore(args) {
|
|
|
2283
2330
|
public_ipv4: args.hostIpv4,
|
|
2284
2331
|
public_ipv6: args.publicIpv6 ?? void 0,
|
|
2285
2332
|
proxy_url: args.proxyUrl ?? void 0,
|
|
2333
|
+
service_did: args.serviceDid ?? void 0,
|
|
2334
|
+
service_origin: args.serviceOrigin ?? void 0,
|
|
2286
2335
|
webauthn_origin: args.webauthnOrigin ?? void 0,
|
|
2287
2336
|
webauthn_origin_fallbacks: args.webauthnOriginFallbacks ?? void 0,
|
|
2288
2337
|
admin_did: args.adminDid ?? void 0,
|
|
@@ -3450,14 +3499,14 @@ function isConfirmedGuestSetupResult(value) {
|
|
|
3450
3499
|
function defaultUcanStoreBootstrapInput(props) {
|
|
3451
3500
|
return {
|
|
3452
3501
|
adminDid: props.ucanStoreBootstrap?.adminDid ?? "",
|
|
3453
|
-
serviceDid: props.ucanStoreBootstrap?.serviceDid ??
|
|
3502
|
+
serviceDid: props.ucanStoreBootstrap?.serviceDid ?? DEFAULT_UCAN_STORE_SERVICE_DID,
|
|
3454
3503
|
spaceDid: props.ucanStoreBootstrap?.spaceDid ?? "",
|
|
3455
3504
|
rootDelegationProof: props.ucanStoreBootstrap?.rootDelegationProof ?? "",
|
|
3456
|
-
allowedCapabilities: props.ucanStoreBootstrap?.allowedCapabilities ?? "",
|
|
3457
|
-
defaultUserDelegationExpiration: props.ucanStoreBootstrap?.defaultUserDelegationExpiration ??
|
|
3458
|
-
maxUserDelegationExpiration: props.ucanStoreBootstrap?.maxUserDelegationExpiration ??
|
|
3459
|
-
pwaOrigin: props.ucanStoreBootstrap?.pwaOrigin ??
|
|
3460
|
-
serviceOrigin: props.ucanStoreBootstrap?.serviceOrigin ??
|
|
3505
|
+
allowedCapabilities: props.ucanStoreBootstrap?.allowedCapabilities ?? DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES.join("\n"),
|
|
3506
|
+
defaultUserDelegationExpiration: props.ucanStoreBootstrap?.defaultUserDelegationExpiration ?? DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS,
|
|
3507
|
+
maxUserDelegationExpiration: props.ucanStoreBootstrap?.maxUserDelegationExpiration ?? DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS,
|
|
3508
|
+
pwaOrigin: props.ucanStoreBootstrap?.pwaOrigin ?? DEFAULT_UCAN_STORE_PWA_ORIGIN,
|
|
3509
|
+
serviceOrigin: props.ucanStoreBootstrap?.serviceOrigin ?? DEFAULT_UCAN_STORE_SERVICE_ORIGIN
|
|
3461
3510
|
};
|
|
3462
3511
|
}
|
|
3463
3512
|
function currentPageOrigin() {
|
|
@@ -5842,6 +5891,12 @@ export {
|
|
|
5842
5891
|
DEFAULT_INSTANCE_NAME,
|
|
5843
5892
|
DEFAULT_MANIFEST_URL,
|
|
5844
5893
|
DEFAULT_TIER_ID,
|
|
5894
|
+
DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES,
|
|
5895
|
+
DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS,
|
|
5896
|
+
DEFAULT_UCAN_STORE_PWA_ORIGIN,
|
|
5897
|
+
DEFAULT_UCAN_STORE_SERVICE_DID,
|
|
5898
|
+
DEFAULT_UCAN_STORE_SERVICE_ORIGIN,
|
|
5899
|
+
DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS,
|
|
5845
5900
|
DEPLOYMENT_PENDING_WARNING_MS,
|
|
5846
5901
|
IDLE_DEPLOYMENT_PROGRESS,
|
|
5847
5902
|
INSTANCE_RUNTIME_PENDING_REFRESH_MS,
|