@calimero-network/mero-js 25.0.5 → 25.0.7

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.
@@ -27,7 +27,9 @@ export declare function applicationIdForBundle(pkg: string, signerId: string): P
27
27
  * one rule for "latest", shared by the version lookup and the id derivation so
28
28
  * the two cannot disagree about which bundle an account is founding on.
29
29
  */
30
- export declare function selectLatestBundle<B extends RegistryBundle>(bundles: readonly B[]): B | undefined;
30
+ export declare function selectLatestBundle<B extends RegistryBundle>(bundles: readonly B[]): (B & {
31
+ appVersion: string;
32
+ }) | undefined;
31
33
  /** The registry's listing of `pkg`, every version. */
32
34
  export declare function fetchRegistryBundles(registryUrl: string, pkg: string, fetchFn?: typeof fetch): Promise<RegistryBundle[]>;
33
35
  export interface ResolvedApplication {
@@ -147,7 +147,8 @@ export async function resolveRelayFromInvitation(input) {
147
147
  const candidates = usable.length > 0 ? usable : named;
148
148
  const advisory = usable.length === 0 || !servable;
149
149
  const addressable = candidates.filter((n) => typeof n.relayUrl === 'string' && n.relayUrl.length > 0);
150
- if (addressable.length === 0) {
150
+ const [firstAddressable] = addressable;
151
+ if (firstAddressable === undefined) {
151
152
  return {
152
153
  ok: false,
153
154
  step: 'no-relay-url',
@@ -160,7 +161,7 @@ export async function resolveRelayFromInvitation(input) {
160
161
  // step that cannot proceed without a node, and authorship is not on the
161
162
  // invitation's list at all, so insisting would refuse a perfectly good
162
163
  // admitter for a permission admission never needed.
163
- const chosen = addressable.find((n) => n.canExecute) ?? addressable.find((n) => n.fresh) ?? addressable[0];
164
+ const chosen = addressable.find((n) => n.canExecute) ?? addressable.find((n) => n.fresh) ?? firstAddressable;
164
165
  return {
165
166
  ok: true,
166
167
  relayUrl: chosen.relayUrl,