@calimero-network/mero-react 4.6.0 → 5.0.0
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/README.md +0 -1
- package/dist/index.cjs +25 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -63
- package/dist/index.d.ts +4 -63
- package/dist/index.js +5 -83
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2,9 +2,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
4
4
|
import * as _calimero_network_mero_js from '@calimero-network/mero-js';
|
|
5
|
-
import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, AddGroupMembersRequest, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, DeleteGroupRequest, DeleteNamespaceRequest, DetachContextFromGroupRequest, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity,
|
|
5
|
+
import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, AddGroupMembersRequest, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, DeleteGroupRequest, DeleteNamespaceRequest, DetachContextFromGroupRequest, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, RetryGroupUpgradeRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, SyncGroupRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, TokenData } from '@calimero-network/mero-js';
|
|
6
6
|
export * from '@calimero-network/mero-js';
|
|
7
|
-
export { CAPABILITIES, MetadataRecord, hasCap, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
7
|
+
export { CAPABILITIES, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Types for mero-react
|
|
@@ -336,54 +336,6 @@ interface MigrationAdminPanelProps {
|
|
|
336
336
|
*/
|
|
337
337
|
declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
|
|
338
338
|
|
|
339
|
-
/**
|
|
340
|
-
* Local-node discovery.
|
|
341
|
-
*
|
|
342
|
-
* Calimero dev/desktop nodes expose a public, unauthenticated health endpoint
|
|
343
|
-
* at `GET {nodeUrl}/admin-api/health` that returns `{ "data": { "status":
|
|
344
|
-
* "alive" } }`. The most common local layouts run on a small, well-known set of
|
|
345
|
-
* ports, so instead of forcing the user to type a URL we probe those ports and
|
|
346
|
-
* offer whatever is actually running.
|
|
347
|
-
*/
|
|
348
|
-
/**
|
|
349
|
-
* Default ports probed when discovering local nodes. Covers the two-node dev
|
|
350
|
-
* stacks used across the Calimero apps (RPC + alt ports for node1 / node2).
|
|
351
|
-
*/
|
|
352
|
-
declare const DEFAULT_LOCAL_NODE_PORTS: readonly [2428, 2429, 2528, 2529];
|
|
353
|
-
interface DiscoverLocalNodesOptions {
|
|
354
|
-
/** Ports to probe. Defaults to {@link DEFAULT_LOCAL_NODE_PORTS}. */
|
|
355
|
-
ports?: readonly number[];
|
|
356
|
-
/** Per-probe timeout in ms. Defaults to 2000. */
|
|
357
|
-
timeoutMs?: number;
|
|
358
|
-
/** Abort the whole discovery (e.g. when the modal closes). */
|
|
359
|
-
signal?: AbortSignal;
|
|
360
|
-
}
|
|
361
|
-
/** Build the canonical base URL for a local node on the given port. */
|
|
362
|
-
declare function localNodeUrl(port: number): string;
|
|
363
|
-
/**
|
|
364
|
-
* Resolve an API `path` against a node `baseUrl`. Ensures the base ends with a
|
|
365
|
-
* slash first, so a base that carries a path prefix (e.g. a `NODE_PATH_PREFIX`
|
|
366
|
-
* deployment like `http://host/node1`) keeps that segment instead of having it
|
|
367
|
-
* stripped by relative URL resolution.
|
|
368
|
-
*/
|
|
369
|
-
declare function nodeEndpoint(baseUrl: string, path: string): string;
|
|
370
|
-
/**
|
|
371
|
-
* Probe a single node's health endpoint. Resolves `true` only when the node
|
|
372
|
-
* answers with a 2xx and (when the body is JSON) reports a non-dead status.
|
|
373
|
-
* Any network error, timeout, or non-ok response resolves `false` — never
|
|
374
|
-
* throws (except on an external abort, which is swallowed as `false`).
|
|
375
|
-
*/
|
|
376
|
-
declare function probeNodeHealth(baseUrl: string, options?: {
|
|
377
|
-
timeoutMs?: number;
|
|
378
|
-
signal?: AbortSignal;
|
|
379
|
-
}): Promise<boolean>;
|
|
380
|
-
/**
|
|
381
|
-
* Probe the configured local ports in parallel and return the base URLs that
|
|
382
|
-
* responded as healthy, in the same order as the `ports` argument (which
|
|
383
|
-
* defaults to ascending). Returns an empty array when nothing local is running.
|
|
384
|
-
*/
|
|
385
|
-
declare function discoverLocalNodes(options?: DiscoverLocalNodesOptions): Promise<string[]>;
|
|
386
|
-
|
|
387
339
|
/**
|
|
388
340
|
* Shape accepted by the metadata-setter hooks — re-exported from mero-js so
|
|
389
341
|
* callers have one canonical type. A `set*Metadata` call **replaces the whole
|
|
@@ -401,7 +353,7 @@ declare function useExecute(contextId: string | null, executorId: string | null)
|
|
|
401
353
|
error: Error | null;
|
|
402
354
|
};
|
|
403
355
|
/** Event payload delivered to a `useSubscription` callback. */
|
|
404
|
-
type SubscriptionEventData = SseEventData | GroupMembershipEventData;
|
|
356
|
+
type SubscriptionEventData = SseEventData | GroupMembershipEventData | GroupMigrationEventData;
|
|
405
357
|
/** Ids to subscribe to. Either can be omitted, but not both. */
|
|
406
358
|
interface SubscriptionInput {
|
|
407
359
|
contextIds?: string[];
|
|
@@ -431,7 +383,6 @@ declare function useApplicationContexts(applicationId?: string | null): {
|
|
|
431
383
|
};
|
|
432
384
|
declare function useGroupMembers(groupId?: string | null): {
|
|
433
385
|
members: _calimero_network_mero_js.GroupMember[];
|
|
434
|
-
selfIdentity: string | null;
|
|
435
386
|
loading: boolean;
|
|
436
387
|
error: Error | null;
|
|
437
388
|
refetch: () => Promise<void>;
|
|
@@ -599,11 +550,6 @@ declare function useSetTeeAdmissionPolicy(): {
|
|
|
599
550
|
loading: boolean;
|
|
600
551
|
error: Error | null;
|
|
601
552
|
};
|
|
602
|
-
declare function useUpdateGroupSettings(): {
|
|
603
|
-
updateGroupSettings: (groupId: string, request: UpdateGroupSettingsRequest) => Promise<void | null>;
|
|
604
|
-
loading: boolean;
|
|
605
|
-
error: Error | null;
|
|
606
|
-
};
|
|
607
553
|
declare function useSetGroupMetadata(): {
|
|
608
554
|
setGroupMetadata: (groupId: string, request: SetMetadataInput) => Promise<void | null>;
|
|
609
555
|
loading: boolean;
|
|
@@ -631,11 +577,6 @@ declare function useMemberMetadata(groupId?: string | null, identity?: string |
|
|
|
631
577
|
error: Error | null;
|
|
632
578
|
refetch: () => Promise<void>;
|
|
633
579
|
};
|
|
634
|
-
declare function useRegisterGroupSigningKey(): {
|
|
635
|
-
registerGroupSigningKey: (groupId: string, request: RegisterGroupSigningKeyRequest) => Promise<_calimero_network_mero_js.RegisterGroupSigningKeyResponseData | null>;
|
|
636
|
-
loading: boolean;
|
|
637
|
-
error: Error | null;
|
|
638
|
-
};
|
|
639
580
|
declare function useUpgradeGroup(): {
|
|
640
581
|
upgradeGroup: (groupId: string, request: UpgradeGroupRequest) => Promise<_calimero_network_mero_js.UpgradeGroupResponseData | null>;
|
|
641
582
|
loading: boolean;
|
|
@@ -862,4 +803,4 @@ declare function clearContextIdentity(): void;
|
|
|
862
803
|
*/
|
|
863
804
|
declare function clearAllStorage(): void;
|
|
864
805
|
|
|
865
|
-
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig,
|
|
806
|
+
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, type ExecutionResult, LoginModal, type LoginModalProps, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
4
4
|
import * as _calimero_network_mero_js from '@calimero-network/mero-js';
|
|
5
|
-
import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, AddGroupMembersRequest, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, DeleteGroupRequest, DeleteNamespaceRequest, DetachContextFromGroupRequest, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity,
|
|
5
|
+
import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, AddGroupMembersRequest, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, DeleteGroupRequest, DeleteNamespaceRequest, DetachContextFromGroupRequest, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, RetryGroupUpgradeRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, SyncGroupRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, TokenData } from '@calimero-network/mero-js';
|
|
6
6
|
export * from '@calimero-network/mero-js';
|
|
7
|
-
export { CAPABILITIES, MetadataRecord, hasCap, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
7
|
+
export { CAPABILITIES, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Types for mero-react
|
|
@@ -336,54 +336,6 @@ interface MigrationAdminPanelProps {
|
|
|
336
336
|
*/
|
|
337
337
|
declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
|
|
338
338
|
|
|
339
|
-
/**
|
|
340
|
-
* Local-node discovery.
|
|
341
|
-
*
|
|
342
|
-
* Calimero dev/desktop nodes expose a public, unauthenticated health endpoint
|
|
343
|
-
* at `GET {nodeUrl}/admin-api/health` that returns `{ "data": { "status":
|
|
344
|
-
* "alive" } }`. The most common local layouts run on a small, well-known set of
|
|
345
|
-
* ports, so instead of forcing the user to type a URL we probe those ports and
|
|
346
|
-
* offer whatever is actually running.
|
|
347
|
-
*/
|
|
348
|
-
/**
|
|
349
|
-
* Default ports probed when discovering local nodes. Covers the two-node dev
|
|
350
|
-
* stacks used across the Calimero apps (RPC + alt ports for node1 / node2).
|
|
351
|
-
*/
|
|
352
|
-
declare const DEFAULT_LOCAL_NODE_PORTS: readonly [2428, 2429, 2528, 2529];
|
|
353
|
-
interface DiscoverLocalNodesOptions {
|
|
354
|
-
/** Ports to probe. Defaults to {@link DEFAULT_LOCAL_NODE_PORTS}. */
|
|
355
|
-
ports?: readonly number[];
|
|
356
|
-
/** Per-probe timeout in ms. Defaults to 2000. */
|
|
357
|
-
timeoutMs?: number;
|
|
358
|
-
/** Abort the whole discovery (e.g. when the modal closes). */
|
|
359
|
-
signal?: AbortSignal;
|
|
360
|
-
}
|
|
361
|
-
/** Build the canonical base URL for a local node on the given port. */
|
|
362
|
-
declare function localNodeUrl(port: number): string;
|
|
363
|
-
/**
|
|
364
|
-
* Resolve an API `path` against a node `baseUrl`. Ensures the base ends with a
|
|
365
|
-
* slash first, so a base that carries a path prefix (e.g. a `NODE_PATH_PREFIX`
|
|
366
|
-
* deployment like `http://host/node1`) keeps that segment instead of having it
|
|
367
|
-
* stripped by relative URL resolution.
|
|
368
|
-
*/
|
|
369
|
-
declare function nodeEndpoint(baseUrl: string, path: string): string;
|
|
370
|
-
/**
|
|
371
|
-
* Probe a single node's health endpoint. Resolves `true` only when the node
|
|
372
|
-
* answers with a 2xx and (when the body is JSON) reports a non-dead status.
|
|
373
|
-
* Any network error, timeout, or non-ok response resolves `false` — never
|
|
374
|
-
* throws (except on an external abort, which is swallowed as `false`).
|
|
375
|
-
*/
|
|
376
|
-
declare function probeNodeHealth(baseUrl: string, options?: {
|
|
377
|
-
timeoutMs?: number;
|
|
378
|
-
signal?: AbortSignal;
|
|
379
|
-
}): Promise<boolean>;
|
|
380
|
-
/**
|
|
381
|
-
* Probe the configured local ports in parallel and return the base URLs that
|
|
382
|
-
* responded as healthy, in the same order as the `ports` argument (which
|
|
383
|
-
* defaults to ascending). Returns an empty array when nothing local is running.
|
|
384
|
-
*/
|
|
385
|
-
declare function discoverLocalNodes(options?: DiscoverLocalNodesOptions): Promise<string[]>;
|
|
386
|
-
|
|
387
339
|
/**
|
|
388
340
|
* Shape accepted by the metadata-setter hooks — re-exported from mero-js so
|
|
389
341
|
* callers have one canonical type. A `set*Metadata` call **replaces the whole
|
|
@@ -401,7 +353,7 @@ declare function useExecute(contextId: string | null, executorId: string | null)
|
|
|
401
353
|
error: Error | null;
|
|
402
354
|
};
|
|
403
355
|
/** Event payload delivered to a `useSubscription` callback. */
|
|
404
|
-
type SubscriptionEventData = SseEventData | GroupMembershipEventData;
|
|
356
|
+
type SubscriptionEventData = SseEventData | GroupMembershipEventData | GroupMigrationEventData;
|
|
405
357
|
/** Ids to subscribe to. Either can be omitted, but not both. */
|
|
406
358
|
interface SubscriptionInput {
|
|
407
359
|
contextIds?: string[];
|
|
@@ -431,7 +383,6 @@ declare function useApplicationContexts(applicationId?: string | null): {
|
|
|
431
383
|
};
|
|
432
384
|
declare function useGroupMembers(groupId?: string | null): {
|
|
433
385
|
members: _calimero_network_mero_js.GroupMember[];
|
|
434
|
-
selfIdentity: string | null;
|
|
435
386
|
loading: boolean;
|
|
436
387
|
error: Error | null;
|
|
437
388
|
refetch: () => Promise<void>;
|
|
@@ -599,11 +550,6 @@ declare function useSetTeeAdmissionPolicy(): {
|
|
|
599
550
|
loading: boolean;
|
|
600
551
|
error: Error | null;
|
|
601
552
|
};
|
|
602
|
-
declare function useUpdateGroupSettings(): {
|
|
603
|
-
updateGroupSettings: (groupId: string, request: UpdateGroupSettingsRequest) => Promise<void | null>;
|
|
604
|
-
loading: boolean;
|
|
605
|
-
error: Error | null;
|
|
606
|
-
};
|
|
607
553
|
declare function useSetGroupMetadata(): {
|
|
608
554
|
setGroupMetadata: (groupId: string, request: SetMetadataInput) => Promise<void | null>;
|
|
609
555
|
loading: boolean;
|
|
@@ -631,11 +577,6 @@ declare function useMemberMetadata(groupId?: string | null, identity?: string |
|
|
|
631
577
|
error: Error | null;
|
|
632
578
|
refetch: () => Promise<void>;
|
|
633
579
|
};
|
|
634
|
-
declare function useRegisterGroupSigningKey(): {
|
|
635
|
-
registerGroupSigningKey: (groupId: string, request: RegisterGroupSigningKeyRequest) => Promise<_calimero_network_mero_js.RegisterGroupSigningKeyResponseData | null>;
|
|
636
|
-
loading: boolean;
|
|
637
|
-
error: Error | null;
|
|
638
|
-
};
|
|
639
580
|
declare function useUpgradeGroup(): {
|
|
640
581
|
upgradeGroup: (groupId: string, request: UpgradeGroupRequest) => Promise<_calimero_network_mero_js.UpgradeGroupResponseData | null>;
|
|
641
582
|
loading: boolean;
|
|
@@ -862,4 +803,4 @@ declare function clearContextIdentity(): void;
|
|
|
862
803
|
*/
|
|
863
804
|
declare function clearAllStorage(): void;
|
|
864
805
|
|
|
865
|
-
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig,
|
|
806
|
+
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, type ExecutionResult, LoginModal, type LoginModalProps, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, useMemo, useState, useRef, useCallback, useEffect, useContext } from 'react';
|
|
2
|
-
import { LocalStorageTokenStore, parseAuthCallback, MeroJs, buildAuthLoginUrl, compareSemver } from '@calimero-network/mero-js';
|
|
2
|
+
import { LocalStorageTokenStore, parseAuthCallback, MeroJs, buildAuthLoginUrl, DEFAULT_LOCAL_NODE_PORTS, discoverLocalNodes, nodeEndpoint, compareSemver } from '@calimero-network/mero-js';
|
|
3
3
|
export * from '@calimero-network/mero-js';
|
|
4
|
-
export { CAPABILITIES, hasCap, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
4
|
+
export { CAPABILITIES, DEFAULT_LOCAL_NODE_PORTS, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
|
|
@@ -569,59 +569,6 @@ function CalimeroLogo({
|
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
-
// src/utils/nodeDiscovery.ts
|
|
573
|
-
var DEFAULT_LOCAL_NODE_PORTS = [2428, 2429, 2528, 2529];
|
|
574
|
-
var LOCAL_HOST = "localhost";
|
|
575
|
-
var DEFAULT_PROBE_TIMEOUT_MS = 2e3;
|
|
576
|
-
function localNodeUrl(port) {
|
|
577
|
-
return `http://${LOCAL_HOST}:${port}`;
|
|
578
|
-
}
|
|
579
|
-
function nodeEndpoint(baseUrl, path) {
|
|
580
|
-
const base = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
|
581
|
-
return new URL(path, base).toString();
|
|
582
|
-
}
|
|
583
|
-
async function probeNodeHealth(baseUrl, options = {}) {
|
|
584
|
-
const { timeoutMs = DEFAULT_PROBE_TIMEOUT_MS, signal } = options;
|
|
585
|
-
if (signal?.aborted) return false;
|
|
586
|
-
const controller = new AbortController();
|
|
587
|
-
const onAbort = () => controller.abort();
|
|
588
|
-
const listenerAdded = !!signal;
|
|
589
|
-
if (listenerAdded) signal.addEventListener("abort", onAbort, { once: true });
|
|
590
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
591
|
-
try {
|
|
592
|
-
const url = nodeEndpoint(baseUrl, "admin-api/health");
|
|
593
|
-
const res = await fetch(url, {
|
|
594
|
-
method: "GET",
|
|
595
|
-
signal: controller.signal
|
|
596
|
-
});
|
|
597
|
-
if (!res.ok) return false;
|
|
598
|
-
try {
|
|
599
|
-
const body = await res.json();
|
|
600
|
-
const status = body?.data?.status !== void 0 ? body?.data?.status : body?.status;
|
|
601
|
-
if (status === void 0) return true;
|
|
602
|
-
return typeof status === "string" && status.toLowerCase() === "alive";
|
|
603
|
-
} catch {
|
|
604
|
-
return true;
|
|
605
|
-
}
|
|
606
|
-
} catch {
|
|
607
|
-
return false;
|
|
608
|
-
} finally {
|
|
609
|
-
clearTimeout(timer);
|
|
610
|
-
if (listenerAdded) signal.removeEventListener("abort", onAbort);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
async function discoverLocalNodes(options = {}) {
|
|
614
|
-
const { ports = DEFAULT_LOCAL_NODE_PORTS, timeoutMs, signal } = options;
|
|
615
|
-
const results = await Promise.all(
|
|
616
|
-
ports.map(async (port) => {
|
|
617
|
-
const url = localNodeUrl(port);
|
|
618
|
-
const ok = await probeNodeHealth(url, { timeoutMs, signal });
|
|
619
|
-
return ok ? url : null;
|
|
620
|
-
})
|
|
621
|
-
);
|
|
622
|
-
return results.filter((url) => url !== null);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
572
|
// src/theme.ts
|
|
626
573
|
var defaultMeroTheme = Object.freeze({
|
|
627
574
|
primary: "#a5ff11",
|
|
@@ -1517,7 +1464,6 @@ function useGroupMembers(groupId) {
|
|
|
1517
1464
|
);
|
|
1518
1465
|
return {
|
|
1519
1466
|
members: data?.members ?? [],
|
|
1520
|
-
selfIdentity: data?.selfIdentity ?? null,
|
|
1521
1467
|
loading,
|
|
1522
1468
|
error,
|
|
1523
1469
|
refetch
|
|
@@ -2018,18 +1964,6 @@ function useSetTeeAdmissionPolicy() {
|
|
|
2018
1964
|
);
|
|
2019
1965
|
return { setTeeAdmissionPolicy, loading, error };
|
|
2020
1966
|
}
|
|
2021
|
-
function useUpdateGroupSettings() {
|
|
2022
|
-
const { mero } = useMero();
|
|
2023
|
-
const { loading, error, run } = useAsyncMutation();
|
|
2024
|
-
const updateGroupSettings = useCallback(
|
|
2025
|
-
async (groupId, request) => {
|
|
2026
|
-
if (!mero) return null;
|
|
2027
|
-
return run(() => mero.admin.updateGroupSettings(groupId, request));
|
|
2028
|
-
},
|
|
2029
|
-
[mero, run]
|
|
2030
|
-
);
|
|
2031
|
-
return { updateGroupSettings, loading, error };
|
|
2032
|
-
}
|
|
2033
1967
|
function useSetGroupMetadata() {
|
|
2034
1968
|
const { mero } = useMero();
|
|
2035
1969
|
const { loading, error, run } = useAsyncMutation();
|
|
@@ -2118,18 +2052,6 @@ function useMemberMetadata(groupId, identity) {
|
|
|
2118
2052
|
}, [run]);
|
|
2119
2053
|
return { metadata, loading, error, refetch };
|
|
2120
2054
|
}
|
|
2121
|
-
function useRegisterGroupSigningKey() {
|
|
2122
|
-
const { mero } = useMero();
|
|
2123
|
-
const { loading, error, run } = useAsyncMutation();
|
|
2124
|
-
const registerGroupSigningKey = useCallback(
|
|
2125
|
-
async (groupId, request) => {
|
|
2126
|
-
if (!mero) return null;
|
|
2127
|
-
return run(() => mero.admin.registerGroupSigningKey(groupId, request));
|
|
2128
|
-
},
|
|
2129
|
-
[mero, run]
|
|
2130
|
-
);
|
|
2131
|
-
return { registerGroupSigningKey, loading, error };
|
|
2132
|
-
}
|
|
2133
2055
|
function useUpgradeGroup() {
|
|
2134
2056
|
const { mero } = useMero();
|
|
2135
2057
|
const { loading, error, run } = useAsyncMutation();
|
|
@@ -2471,12 +2393,12 @@ function useGroupAppVersion(groupId) {
|
|
|
2471
2393
|
if (namespace) {
|
|
2472
2394
|
appKey = namespace.appKey;
|
|
2473
2395
|
applicationId = namespace.targetApplicationId;
|
|
2474
|
-
upgradePolicy = namespace.upgradePolicy;
|
|
2396
|
+
upgradePolicy = namespace.upgradePolicy ?? null;
|
|
2475
2397
|
} else {
|
|
2476
2398
|
const info = await mero.admin.getGroupInfo(groupId);
|
|
2477
2399
|
appKey = info.appKey;
|
|
2478
2400
|
applicationId = info.targetApplicationId;
|
|
2479
|
-
upgradePolicy = info.upgradePolicy;
|
|
2401
|
+
upgradePolicy = info.upgradePolicy ?? null;
|
|
2480
2402
|
activeUpgrade = info.activeUpgrade ?? null;
|
|
2481
2403
|
}
|
|
2482
2404
|
let version = null;
|
|
@@ -2661,6 +2583,6 @@ function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }) {
|
|
|
2661
2583
|
] });
|
|
2662
2584
|
}
|
|
2663
2585
|
|
|
2664
|
-
export { AppMode, CalimeroLogo, ConnectButton, ConnectionType,
|
|
2586
|
+
export { AppMode, CalimeroLogo, ConnectButton, ConnectionType, LoginModal, MERO_CSS_VARS, MeroContext, MeroProvider, MigrationAdminPanel, MigrationPendingBanner, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup };
|
|
2665
2587
|
//# sourceMappingURL=index.js.map
|
|
2666
2588
|
//# sourceMappingURL=index.js.map
|