@le-space/core 0.8.0 → 0.9.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.
- package/index.d.ts +49 -2
- package/index.js +144 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ declare function resolveRootfsReference(itemHash: string, options: {
|
|
|
31
31
|
declare const DEFAULT_CRN_LIST_URL = "https://crns-list.aleph.sh/crns.json";
|
|
32
32
|
declare const DEFAULT_COUNTRY_LOOKUP_BASE_URL = "https://api.country.is";
|
|
33
33
|
declare const DEFAULT_DNS_RESOLVE_URL = "https://dns.google/resolve";
|
|
34
|
+
declare const DEFAULT_CRN_AGGREGATE_ADDRESS = "0xa1B3bb7d2332383D96b7796B908fB7f7F3c2Be10";
|
|
35
|
+
declare const DEFAULT_CRN_AGGREGATE_KEY = "corechannel";
|
|
36
|
+
declare const DEFAULT_CRN_AGGREGATE_API_HOSTS: readonly string[];
|
|
37
|
+
type CrnSource = 'list' | 'aggregate';
|
|
34
38
|
interface CrnCapacitySpec {
|
|
35
39
|
vcpus: number;
|
|
36
40
|
memoryMiB: number;
|
|
@@ -40,10 +44,38 @@ declare function filterDeployableCrns<TCrn extends CrnRecord>(crns: ReadonlyArra
|
|
|
40
44
|
excludedHashes?: ReadonlyArray<string>;
|
|
41
45
|
spec?: CrnCapacitySpec | null;
|
|
42
46
|
}): TCrn[];
|
|
43
|
-
declare function
|
|
47
|
+
declare function fetchCrnsFromList(options: {
|
|
44
48
|
url?: string;
|
|
45
49
|
fetch: FetchLike;
|
|
46
50
|
}): Promise<CrnRecord[]>;
|
|
51
|
+
declare function mapResourceNodesToCrns(resourceNodes: unknown): CrnRecord[];
|
|
52
|
+
declare function fetchCrnsFromAggregate(options: {
|
|
53
|
+
fetch: FetchLike;
|
|
54
|
+
apiHosts?: readonly string[];
|
|
55
|
+
address?: string;
|
|
56
|
+
aggregateKey?: string;
|
|
57
|
+
}): Promise<CrnRecord[]>;
|
|
58
|
+
interface CrnSourceOptions {
|
|
59
|
+
fetch: FetchLike;
|
|
60
|
+
url?: string;
|
|
61
|
+
aggregateApiHosts?: readonly string[];
|
|
62
|
+
aggregateAddress?: string;
|
|
63
|
+
/** Skip crns.json entirely and read the core channel aggregate directly. */
|
|
64
|
+
preferAggregate?: boolean;
|
|
65
|
+
onDiagnostic?: (message: string) => void;
|
|
66
|
+
}
|
|
67
|
+
interface CrnSourceResult {
|
|
68
|
+
crns: CrnRecord[];
|
|
69
|
+
source: CrnSource;
|
|
70
|
+
listError?: Error;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Reads the CRN candidate set, preferring the polled crns.json list because it
|
|
74
|
+
* carries live status, capacity and qemu support, and falling back to the core
|
|
75
|
+
* channel aggregate whenever that single HTTP service is unavailable.
|
|
76
|
+
*/
|
|
77
|
+
declare function fetchCrnsWithSource(options: CrnSourceOptions): Promise<CrnSourceResult>;
|
|
78
|
+
declare function fetchCrns(options: CrnSourceOptions): Promise<CrnRecord[]>;
|
|
47
79
|
declare function enrichCrnsWithGeo(crns: ReadonlyArray<CrnRecord>, options: {
|
|
48
80
|
fetch: FetchLike;
|
|
49
81
|
dnsResolveUrl?: string;
|
|
@@ -64,6 +96,21 @@ declare function rankCandidateCrns(crns: ReadonlyArray<CrnRecord>, options: {
|
|
|
64
96
|
dnsResolveUrl?: string;
|
|
65
97
|
countryLookupBaseUrl?: string;
|
|
66
98
|
}): Promise<CrnRecord[]>;
|
|
99
|
+
declare function probeCrnAvailability(crn: CrnRecord, options: {
|
|
100
|
+
fetch: FetchLike;
|
|
101
|
+
}): Promise<boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* Drops candidates that do not answer their executions endpoint, preserving
|
|
104
|
+
* the incoming ranking. Only the head of the list is probed: failover walks the
|
|
105
|
+
* ordered tail anyway, and probing every registered node would cost more than
|
|
106
|
+
* it saves. Returns the input unchanged when nothing answers, so a runner that
|
|
107
|
+
* cannot reach CRNs directly still gets to attempt a deploy.
|
|
108
|
+
*/
|
|
109
|
+
declare function filterReachableCrns<TCrn extends CrnRecord>(crns: ReadonlyArray<TCrn>, options: {
|
|
110
|
+
fetch: FetchLike;
|
|
111
|
+
limit?: number;
|
|
112
|
+
onDiagnostic?: (message: string) => void;
|
|
113
|
+
}): Promise<TCrn[]>;
|
|
67
114
|
declare function selectPreferredCrn(crns: ReadonlyArray<CrnRecord>, options: {
|
|
68
115
|
fetch: FetchLike;
|
|
69
116
|
preferredCountryCode?: string;
|
|
@@ -979,4 +1026,4 @@ declare function reconcileOwnerRelayBootstrapRegistrations(args: {
|
|
|
979
1026
|
} | null;
|
|
980
1027
|
}): Promise<OwnerRelayBootstrapReconcileResult>;
|
|
981
1028
|
|
|
982
|
-
export { type CrnCapacitySpec, type CrnEraseResult, type CrnResolutionResult, DEFAULT_ALEPH_API_HOST, DEFAULT_ALEPH_CHANNEL, DEFAULT_COUNTRY_LOOKUP_BASE_URL, DEFAULT_CRN_LIST_URL, DEFAULT_DNS_RESOLVE_URL, DEFAULT_INSTANCE_PORT_FORWARDS, DEFAULT_IPFS_GATEWAY_BASE_URL, DEFAULT_SCHEDULER_ALLOCATION_URL, DEFAULT_TWO_N_SIX_HASH_URL, type FetchLike, type FetchLikeResponse, type HttpProbeResult, ITEM_HASH_RE, type JsonFetchLike$1 as JsonFetchLike, type JsonFetchLikeResponse, type OwnerRelayBootstrapReconcileResult, type PaymentQuote, type RelayBootstrapPublicationResult, type RelayBootstrapVisibilityResult, type RelayMetadataShape, type RetentionRecord, SSH_PUBLIC_KEY_PATTERN, SUCCESSFUL_DEPLOYMENTS_AGGREGATE_KEY, type TcpProbeResult, type TierSpec, VM_BOOTSTRAP_CONFIG_AGGREGATE_KEY, VM_BOOTSTRAP_CONFIG_HISTORY_RETENTION_MS, VM_BOOTSTRAP_CONFIG_SIGNAL_POST_TYPE, VM_BOOTSTRAP_CONFIG_SIGNAL_REF, appendDeploymentTokenToSshPublicKey, broadcastAlephMessage, buildPaymentQuote, cleanupFailedDeployment, configureOrbitdbRelaySetup, configureUcGoPeer, configureUcanStore, createDeploymentIntent, createDeploymentToken, createInstanceContent, createPortForwardAggregateContent, createRelayBootstrapRegistrationId, createReleaseMetadata, createUnsignedAggregateMessage, createUnsignedForgetMessage, createUnsignedInstanceMessage, createVmBootstrapConfigAggregateContent, crnExecutionAbsent, deleteVmBootstrapConfig, deployInstance, describeRejectedDeployment, describeRuntimeAvailability, enrichCrnsWithGeo, ensureInstancePortForwards, eraseInstanceOnCrn, extractInsufficientBalanceMessage, extractProxyUrl, extractReferenceHashes, fetch2n6WebAccessUrl, fetchAggregateKey, fetchCrnExecutionMap, fetchCrns, fetchMessageEnvelope, fetchPortForwardAggregate, fetchRelayMetadataForRuntime, fetchSchedulerAllocation, fetchUcGoPeerMetadata, fetchVmBootstrapConfigAggregate, fetchVmBootstrapConfigSignals, fetchVmRuntime, filterDeployableCrns, findCrnByHash, forgetAlephMessages, inspectDeploymentResult, inspectMessageResult, isInvalidMessageFormatResponse, isRetryableBroadcastFailure, isTransientMessageLookupError, isValidSshPublicKey, listGeocodedCrns, listStaleVmBootstrapConfigAggregateMessageHashes, mergePortFlagMaps, mergeRequiredPortForwards, messageTypeFromEnvelope, normalizeBroadcastStatus, normalizeExecution, normalizeExistingPortForwardEntry, normalizeMessageStatus, normalizeProxyUrl, normalizeSshPublicKey, notifyCrnAllocation, notifyCrnAllocationWithRetry, portForwardLabel, postBroadcastPayload, probeRootfsGateway, publishAggregateKey, publishRelayBootstrapRegistration, publishVmBootstrapConfig, quoteRequiredBudgetUnits, rankCandidateCrns, reconcileOwnerRelayBootstrapRegistrations, requestedPortFlags, requiredInstancePortForwards, resolveInstanceCrn, resolveRootfsReference, retainSuccessfulDeployments, selectPreferredCrn, selectedTier, signAlephMessage, signaturePayload, tierSpec, validateRootfsManifest, verifyRootfsExists, verifyUcGoPeerReachability, waitForDeploymentResult, waitForRelayBootstrapRegistration, waitForSetupEndpoint, waitForVmBootstrapConfigSignal, waitForVmRuntime };
|
|
1029
|
+
export { type CrnCapacitySpec, type CrnEraseResult, type CrnResolutionResult, type CrnSource, type CrnSourceOptions, type CrnSourceResult, DEFAULT_ALEPH_API_HOST, DEFAULT_ALEPH_CHANNEL, DEFAULT_COUNTRY_LOOKUP_BASE_URL, DEFAULT_CRN_AGGREGATE_ADDRESS, DEFAULT_CRN_AGGREGATE_API_HOSTS, DEFAULT_CRN_AGGREGATE_KEY, DEFAULT_CRN_LIST_URL, DEFAULT_DNS_RESOLVE_URL, DEFAULT_INSTANCE_PORT_FORWARDS, DEFAULT_IPFS_GATEWAY_BASE_URL, DEFAULT_SCHEDULER_ALLOCATION_URL, DEFAULT_TWO_N_SIX_HASH_URL, type FetchLike, type FetchLikeResponse, type HttpProbeResult, ITEM_HASH_RE, type JsonFetchLike$1 as JsonFetchLike, type JsonFetchLikeResponse, type OwnerRelayBootstrapReconcileResult, type PaymentQuote, type RelayBootstrapPublicationResult, type RelayBootstrapVisibilityResult, type RelayMetadataShape, type RetentionRecord, SSH_PUBLIC_KEY_PATTERN, SUCCESSFUL_DEPLOYMENTS_AGGREGATE_KEY, type TcpProbeResult, type TierSpec, VM_BOOTSTRAP_CONFIG_AGGREGATE_KEY, VM_BOOTSTRAP_CONFIG_HISTORY_RETENTION_MS, VM_BOOTSTRAP_CONFIG_SIGNAL_POST_TYPE, VM_BOOTSTRAP_CONFIG_SIGNAL_REF, appendDeploymentTokenToSshPublicKey, broadcastAlephMessage, buildPaymentQuote, cleanupFailedDeployment, configureOrbitdbRelaySetup, configureUcGoPeer, configureUcanStore, createDeploymentIntent, createDeploymentToken, createInstanceContent, createPortForwardAggregateContent, createRelayBootstrapRegistrationId, createReleaseMetadata, createUnsignedAggregateMessage, createUnsignedForgetMessage, createUnsignedInstanceMessage, createVmBootstrapConfigAggregateContent, crnExecutionAbsent, deleteVmBootstrapConfig, deployInstance, describeRejectedDeployment, describeRuntimeAvailability, enrichCrnsWithGeo, ensureInstancePortForwards, eraseInstanceOnCrn, extractInsufficientBalanceMessage, extractProxyUrl, extractReferenceHashes, fetch2n6WebAccessUrl, fetchAggregateKey, fetchCrnExecutionMap, fetchCrns, fetchCrnsFromAggregate, fetchCrnsFromList, fetchCrnsWithSource, fetchMessageEnvelope, fetchPortForwardAggregate, fetchRelayMetadataForRuntime, fetchSchedulerAllocation, fetchUcGoPeerMetadata, fetchVmBootstrapConfigAggregate, fetchVmBootstrapConfigSignals, fetchVmRuntime, filterDeployableCrns, filterReachableCrns, findCrnByHash, forgetAlephMessages, inspectDeploymentResult, inspectMessageResult, isInvalidMessageFormatResponse, isRetryableBroadcastFailure, isTransientMessageLookupError, isValidSshPublicKey, listGeocodedCrns, listStaleVmBootstrapConfigAggregateMessageHashes, mapResourceNodesToCrns, mergePortFlagMaps, mergeRequiredPortForwards, messageTypeFromEnvelope, normalizeBroadcastStatus, normalizeExecution, normalizeExistingPortForwardEntry, normalizeMessageStatus, normalizeProxyUrl, normalizeSshPublicKey, notifyCrnAllocation, notifyCrnAllocationWithRetry, portForwardLabel, postBroadcastPayload, probeCrnAvailability, probeRootfsGateway, publishAggregateKey, publishRelayBootstrapRegistration, publishVmBootstrapConfig, quoteRequiredBudgetUnits, rankCandidateCrns, reconcileOwnerRelayBootstrapRegistrations, requestedPortFlags, requiredInstancePortForwards, resolveInstanceCrn, resolveRootfsReference, retainSuccessfulDeployments, selectPreferredCrn, selectedTier, signAlephMessage, signaturePayload, tierSpec, validateRootfsManifest, verifyRootfsExists, verifyUcGoPeerReachability, waitForDeploymentResult, waitForRelayBootstrapRegistration, waitForSetupEndpoint, waitForVmBootstrapConfigSignal, waitForVmRuntime };
|
package/index.js
CHANGED
|
@@ -202,6 +202,12 @@ async function resolveRootfsReference(itemHash, options) {
|
|
|
202
202
|
var DEFAULT_CRN_LIST_URL = "https://crns-list.aleph.sh/crns.json";
|
|
203
203
|
var DEFAULT_COUNTRY_LOOKUP_BASE_URL = "https://api.country.is";
|
|
204
204
|
var DEFAULT_DNS_RESOLVE_URL = "https://dns.google/resolve";
|
|
205
|
+
var DEFAULT_CRN_AGGREGATE_ADDRESS = "0xa1B3bb7d2332383D96b7796B908fB7f7F3c2Be10";
|
|
206
|
+
var DEFAULT_CRN_AGGREGATE_KEY = "corechannel";
|
|
207
|
+
var DEFAULT_CRN_AGGREGATE_API_HOSTS = [
|
|
208
|
+
"https://api2.aleph.im",
|
|
209
|
+
"https://api.aleph.im"
|
|
210
|
+
];
|
|
205
211
|
function asString(value) {
|
|
206
212
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
207
213
|
}
|
|
@@ -317,7 +323,7 @@ async function lookupIpLocation(ip, options) {
|
|
|
317
323
|
geo_source: "country.is"
|
|
318
324
|
};
|
|
319
325
|
}
|
|
320
|
-
async function
|
|
326
|
+
async function fetchCrnsFromList(options) {
|
|
321
327
|
const requestUrl = new URL(options.url ?? DEFAULT_CRN_LIST_URL);
|
|
322
328
|
requestUrl.searchParams.set("filter_inactive", "true");
|
|
323
329
|
const response = await options.fetch(requestUrl.toString(), {
|
|
@@ -329,6 +335,101 @@ async function fetchCrns(options) {
|
|
|
329
335
|
const payload = await response.json();
|
|
330
336
|
return Array.isArray(payload?.crns) ? payload.crns : [];
|
|
331
337
|
}
|
|
338
|
+
function normalizeCrnAddress(value) {
|
|
339
|
+
const address = asString(value);
|
|
340
|
+
if (!address) return null;
|
|
341
|
+
const withScheme = /^https?:\/\//i.test(address) ? address : `https://${address}`;
|
|
342
|
+
try {
|
|
343
|
+
return new URL(withScheme).toString().replace(/\/+$/, "");
|
|
344
|
+
} catch {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function aggregateScore(node) {
|
|
349
|
+
for (const candidate of [node.score, node.scoreV1]) {
|
|
350
|
+
if (candidate == null || candidate === "") continue;
|
|
351
|
+
const numeric = typeof candidate === "number" ? candidate : Number(candidate);
|
|
352
|
+
if (Number.isFinite(numeric)) return numeric;
|
|
353
|
+
}
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
function isDeployableResourceNode(node) {
|
|
357
|
+
if (!asString(node.hash)) return false;
|
|
358
|
+
if (!normalizeCrnAddress(node.address)) return false;
|
|
359
|
+
if (node.inactive_since != null) return false;
|
|
360
|
+
if (node.locked === true) return false;
|
|
361
|
+
const type = asString(node.type)?.toLowerCase();
|
|
362
|
+
if (type && type !== "compute") return false;
|
|
363
|
+
const status = asString(node.status)?.toLowerCase();
|
|
364
|
+
if (status && status !== "linked" && status !== "active") return false;
|
|
365
|
+
return Boolean(asString(node.parent));
|
|
366
|
+
}
|
|
367
|
+
function mapResourceNodesToCrns(resourceNodes) {
|
|
368
|
+
if (!Array.isArray(resourceNodes)) return [];
|
|
369
|
+
return resourceNodes.filter((node) => Boolean(node) && typeof node === "object").filter(isDeployableResourceNode).map((node) => {
|
|
370
|
+
const record = {
|
|
371
|
+
hash: asString(node.hash),
|
|
372
|
+
address: normalizeCrnAddress(node.address)
|
|
373
|
+
};
|
|
374
|
+
const name = asString(node.name);
|
|
375
|
+
if (name) record.name = name;
|
|
376
|
+
const score = aggregateScore(node);
|
|
377
|
+
if (score != null) record.score = score;
|
|
378
|
+
return record;
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
async function fetchCrnsFromAggregate(options) {
|
|
382
|
+
const apiHosts = options.apiHosts?.length ? options.apiHosts : DEFAULT_CRN_AGGREGATE_API_HOSTS;
|
|
383
|
+
const address = options.address ?? DEFAULT_CRN_AGGREGATE_ADDRESS;
|
|
384
|
+
const aggregateKey = options.aggregateKey ?? DEFAULT_CRN_AGGREGATE_KEY;
|
|
385
|
+
let lastError = null;
|
|
386
|
+
for (const apiHost of apiHosts) {
|
|
387
|
+
try {
|
|
388
|
+
const url = new URL(`/api/v0/aggregates/${address}.json`, apiHost);
|
|
389
|
+
url.searchParams.set("keys", aggregateKey);
|
|
390
|
+
const response = await options.fetch(url.toString(), { cache: "no-cache" });
|
|
391
|
+
if (!response.ok) {
|
|
392
|
+
lastError = new Error(`CRN aggregate request failed: ${response.status}`);
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
const payload = await response.json();
|
|
396
|
+
const crns = mapResourceNodesToCrns(payload?.data?.corechannel?.resource_nodes);
|
|
397
|
+
if (crns.length > 0) return crns;
|
|
398
|
+
lastError = new Error("CRN aggregate contained no deployable resource nodes");
|
|
399
|
+
} catch (error) {
|
|
400
|
+
lastError = error;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError ?? "CRN aggregate request failed"));
|
|
404
|
+
}
|
|
405
|
+
async function fetchCrnsWithSource(options) {
|
|
406
|
+
const aggregateOptions = {
|
|
407
|
+
fetch: options.fetch,
|
|
408
|
+
apiHosts: options.aggregateApiHosts,
|
|
409
|
+
address: options.aggregateAddress
|
|
410
|
+
};
|
|
411
|
+
if (options.preferAggregate) {
|
|
412
|
+
return { crns: await fetchCrnsFromAggregate(aggregateOptions), source: "aggregate" };
|
|
413
|
+
}
|
|
414
|
+
let listError;
|
|
415
|
+
try {
|
|
416
|
+
const crns = await fetchCrnsFromList({ url: options.url, fetch: options.fetch });
|
|
417
|
+
if (crns.length > 0) return { crns, source: "list" };
|
|
418
|
+
listError = new Error("CRN list returned no entries");
|
|
419
|
+
} catch (error) {
|
|
420
|
+
listError = error instanceof Error ? error : new Error(String(error));
|
|
421
|
+
}
|
|
422
|
+
options.onDiagnostic?.(`CRN list unavailable (${listError.message}); falling back to the ${DEFAULT_CRN_AGGREGATE_KEY} aggregate`);
|
|
423
|
+
try {
|
|
424
|
+
return { crns: await fetchCrnsFromAggregate(aggregateOptions), source: "aggregate", listError };
|
|
425
|
+
} catch (aggregateError) {
|
|
426
|
+
const message = aggregateError instanceof Error ? aggregateError.message : String(aggregateError);
|
|
427
|
+
throw new Error(`${listError.message}; CRN aggregate fallback failed: ${message}`);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
async function fetchCrns(options) {
|
|
431
|
+
return (await fetchCrnsWithSource(options)).crns;
|
|
432
|
+
}
|
|
332
433
|
async function enrichCrnsWithGeo(crns, options) {
|
|
333
434
|
return Promise.all(
|
|
334
435
|
crns.map(async (crn) => {
|
|
@@ -392,6 +493,39 @@ async function rankCandidateCrns(crns, options) {
|
|
|
392
493
|
return (originalIndex.get(left.hash) ?? Number.MAX_SAFE_INTEGER) - (originalIndex.get(right.hash) ?? Number.MAX_SAFE_INTEGER);
|
|
393
494
|
});
|
|
394
495
|
}
|
|
496
|
+
var CRN_PROBE_PATHS = ["/v2/about/executions/list", "/about/executions/list"];
|
|
497
|
+
async function probeCrnAvailability(crn, options) {
|
|
498
|
+
const address = crn.address ? String(crn.address).replace(/\/+$/, "") : "";
|
|
499
|
+
if (!address) return false;
|
|
500
|
+
for (const path of CRN_PROBE_PATHS) {
|
|
501
|
+
try {
|
|
502
|
+
const response = await options.fetch(`${address}${path}`, { cache: "no-cache" });
|
|
503
|
+
if (response.ok) return true;
|
|
504
|
+
if (response.status !== 404) return response.status < 500;
|
|
505
|
+
} catch {
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
async function filterReachableCrns(crns, options) {
|
|
512
|
+
const limit = Math.max(1, Number(options.limit) || 10);
|
|
513
|
+
const probed = crns.slice(0, limit);
|
|
514
|
+
if (probed.length === 0) return [...crns];
|
|
515
|
+
const reachable = await Promise.all(
|
|
516
|
+
probed.map(async (crn) => ({ crn, ok: await probeCrnAvailability(crn, { fetch: options.fetch }) }))
|
|
517
|
+
);
|
|
518
|
+
const live = reachable.filter((entry) => entry.ok).map((entry) => entry.crn);
|
|
519
|
+
if (live.length === 0) {
|
|
520
|
+
options.onDiagnostic?.(`No CRN answered its executions endpoint (${probed.length} probed); keeping the unverified ranking`);
|
|
521
|
+
return [...crns];
|
|
522
|
+
}
|
|
523
|
+
const skipped = probed.length - live.length;
|
|
524
|
+
if (skipped > 0) {
|
|
525
|
+
options.onDiagnostic?.(`Skipping ${skipped} unreachable CRN${skipped === 1 ? "" : "s"} of ${probed.length} probed`);
|
|
526
|
+
}
|
|
527
|
+
return [...live, ...crns.slice(limit)];
|
|
528
|
+
}
|
|
395
529
|
async function selectPreferredCrn(crns, options) {
|
|
396
530
|
return (await rankCandidateCrns(crns, options))[0] ?? null;
|
|
397
531
|
}
|
|
@@ -3595,6 +3729,9 @@ export {
|
|
|
3595
3729
|
DEFAULT_ALEPH_API_HOST,
|
|
3596
3730
|
DEFAULT_ALEPH_CHANNEL,
|
|
3597
3731
|
DEFAULT_COUNTRY_LOOKUP_BASE_URL,
|
|
3732
|
+
DEFAULT_CRN_AGGREGATE_ADDRESS,
|
|
3733
|
+
DEFAULT_CRN_AGGREGATE_API_HOSTS,
|
|
3734
|
+
DEFAULT_CRN_AGGREGATE_KEY,
|
|
3598
3735
|
DEFAULT_CRN_LIST_URL,
|
|
3599
3736
|
DEFAULT_DNS_RESOLVE_URL,
|
|
3600
3737
|
DEFAULT_INSTANCE_PORT_FORWARDS,
|
|
@@ -3640,6 +3777,9 @@ export {
|
|
|
3640
3777
|
fetchAggregateKey,
|
|
3641
3778
|
fetchCrnExecutionMap,
|
|
3642
3779
|
fetchCrns,
|
|
3780
|
+
fetchCrnsFromAggregate,
|
|
3781
|
+
fetchCrnsFromList,
|
|
3782
|
+
fetchCrnsWithSource,
|
|
3643
3783
|
fetchMessageEnvelope,
|
|
3644
3784
|
fetchPortForwardAggregate,
|
|
3645
3785
|
fetchRelayMetadataForRuntime,
|
|
@@ -3649,6 +3789,7 @@ export {
|
|
|
3649
3789
|
fetchVmBootstrapConfigSignals,
|
|
3650
3790
|
fetchVmRuntime,
|
|
3651
3791
|
filterDeployableCrns,
|
|
3792
|
+
filterReachableCrns,
|
|
3652
3793
|
findCrnByHash,
|
|
3653
3794
|
forgetAlephMessages,
|
|
3654
3795
|
inspectDeploymentResult,
|
|
@@ -3659,6 +3800,7 @@ export {
|
|
|
3659
3800
|
isValidSshPublicKey,
|
|
3660
3801
|
listGeocodedCrns,
|
|
3661
3802
|
listStaleVmBootstrapConfigAggregateMessageHashes,
|
|
3803
|
+
mapResourceNodesToCrns,
|
|
3662
3804
|
mergePortFlagMaps,
|
|
3663
3805
|
mergeRequiredPortForwards,
|
|
3664
3806
|
messageTypeFromEnvelope,
|
|
@@ -3672,6 +3814,7 @@ export {
|
|
|
3672
3814
|
notifyCrnAllocationWithRetry,
|
|
3673
3815
|
portForwardLabel,
|
|
3674
3816
|
postBroadcastPayload,
|
|
3817
|
+
probeCrnAvailability,
|
|
3675
3818
|
probeRootfsGateway,
|
|
3676
3819
|
publishAggregateKey,
|
|
3677
3820
|
publishRelayBootstrapRegistration,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
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.
|
|
28
|
-
"@le-space/shared-types": "0.
|
|
27
|
+
"@le-space/aleph-bootstrap": "0.9.1",
|
|
28
|
+
"@le-space/shared-types": "0.9.1"
|
|
29
29
|
}
|
|
30
30
|
}
|