@calimero-network/mero-react 4.0.1 → 4.1.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/dist/index.cjs +324 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +320 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -274,11 +274,17 @@ interface LoginModalProps {
|
|
|
274
274
|
isOpen: boolean;
|
|
275
275
|
/** Theme overrides — accepts any subset of `MeroTheme` tokens */
|
|
276
276
|
theme?: MeroTheme;
|
|
277
|
+
/**
|
|
278
|
+
* Ports probed when discovering remote/local nodes. Defaults to the
|
|
279
|
+
* well-known Calimero dev ports (2428, 2429, 2528, 2529). Mostly an escape
|
|
280
|
+
* hatch for non-standard setups and tests.
|
|
281
|
+
*/
|
|
282
|
+
localNodePorts?: readonly number[];
|
|
277
283
|
}
|
|
278
284
|
/**
|
|
279
285
|
* LoginModal - Connection modal component
|
|
280
286
|
*/
|
|
281
|
-
declare function LoginModal({ onConnect, onClose, connectionType, isOpen, theme, }: LoginModalProps): React.ReactPortal | null;
|
|
287
|
+
declare function LoginModal({ onConnect, onClose, connectionType, isOpen, theme, localNodePorts, }: LoginModalProps): React.ReactPortal | null;
|
|
282
288
|
|
|
283
289
|
interface CalimeroLogoProps extends React__default.SVGAttributes<SVGSVGElement> {
|
|
284
290
|
/** Width / height shorthand (applied to both). Default: 24. */
|
|
@@ -316,6 +322,54 @@ interface MigrationAdminPanelProps {
|
|
|
316
322
|
*/
|
|
317
323
|
declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
|
|
318
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Local-node discovery.
|
|
327
|
+
*
|
|
328
|
+
* Calimero dev/desktop nodes expose a public, unauthenticated health endpoint
|
|
329
|
+
* at `GET {nodeUrl}/admin-api/health` that returns `{ "data": { "status":
|
|
330
|
+
* "alive" } }`. The most common local layouts run on a small, well-known set of
|
|
331
|
+
* ports, so instead of forcing the user to type a URL we probe those ports and
|
|
332
|
+
* offer whatever is actually running.
|
|
333
|
+
*/
|
|
334
|
+
/**
|
|
335
|
+
* Default ports probed when discovering local nodes. Covers the two-node dev
|
|
336
|
+
* stacks used across the Calimero apps (RPC + alt ports for node1 / node2).
|
|
337
|
+
*/
|
|
338
|
+
declare const DEFAULT_LOCAL_NODE_PORTS: readonly [2428, 2429, 2528, 2529];
|
|
339
|
+
interface DiscoverLocalNodesOptions {
|
|
340
|
+
/** Ports to probe. Defaults to {@link DEFAULT_LOCAL_NODE_PORTS}. */
|
|
341
|
+
ports?: readonly number[];
|
|
342
|
+
/** Per-probe timeout in ms. Defaults to 2000. */
|
|
343
|
+
timeoutMs?: number;
|
|
344
|
+
/** Abort the whole discovery (e.g. when the modal closes). */
|
|
345
|
+
signal?: AbortSignal;
|
|
346
|
+
}
|
|
347
|
+
/** Build the canonical base URL for a local node on the given port. */
|
|
348
|
+
declare function localNodeUrl(port: number): string;
|
|
349
|
+
/**
|
|
350
|
+
* Resolve an API `path` against a node `baseUrl`. Ensures the base ends with a
|
|
351
|
+
* slash first, so a base that carries a path prefix (e.g. a `NODE_PATH_PREFIX`
|
|
352
|
+
* deployment like `http://host/node1`) keeps that segment instead of having it
|
|
353
|
+
* stripped by relative URL resolution.
|
|
354
|
+
*/
|
|
355
|
+
declare function nodeEndpoint(baseUrl: string, path: string): string;
|
|
356
|
+
/**
|
|
357
|
+
* Probe a single node's health endpoint. Resolves `true` only when the node
|
|
358
|
+
* answers with a 2xx and (when the body is JSON) reports a non-dead status.
|
|
359
|
+
* Any network error, timeout, or non-ok response resolves `false` — never
|
|
360
|
+
* throws (except on an external abort, which is swallowed as `false`).
|
|
361
|
+
*/
|
|
362
|
+
declare function probeNodeHealth(baseUrl: string, options?: {
|
|
363
|
+
timeoutMs?: number;
|
|
364
|
+
signal?: AbortSignal;
|
|
365
|
+
}): Promise<boolean>;
|
|
366
|
+
/**
|
|
367
|
+
* Probe the configured local ports in parallel and return the base URLs that
|
|
368
|
+
* responded as healthy, in the same order as the `ports` argument (which
|
|
369
|
+
* defaults to ascending). Returns an empty array when nothing local is running.
|
|
370
|
+
*/
|
|
371
|
+
declare function discoverLocalNodes(options?: DiscoverLocalNodesOptions): Promise<string[]>;
|
|
372
|
+
|
|
319
373
|
/**
|
|
320
374
|
* Shape accepted by the metadata-setter hooks — re-exported from mero-js so
|
|
321
375
|
* callers have one canonical type. A `set*Metadata` call **replaces the whole
|
|
@@ -734,4 +788,4 @@ declare function clearContextIdentity(): void;
|
|
|
734
788
|
*/
|
|
735
789
|
declare function clearAllStorage(): void;
|
|
736
790
|
|
|
737
|
-
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, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useExecute, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useRegisterGroupSigningKey, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateGroupSettings, useUpdateMemberRole, useUpgradeGroup };
|
|
791
|
+
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, DEFAULT_LOCAL_NODE_PORTS, type DiscoverLocalNodesOptions, 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, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, cssVar, defaultMeroTheme, discoverLocalNodes, getApplicationId, getContextId, getContextIdentity, getNodeUrl, localNodeUrl, localStorageTokenStorage, nodeEndpoint, probeNodeHealth, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useExecute, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useRegisterGroupSigningKey, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateGroupSettings, useUpdateMemberRole, useUpgradeGroup };
|
package/dist/index.d.ts
CHANGED
|
@@ -274,11 +274,17 @@ interface LoginModalProps {
|
|
|
274
274
|
isOpen: boolean;
|
|
275
275
|
/** Theme overrides — accepts any subset of `MeroTheme` tokens */
|
|
276
276
|
theme?: MeroTheme;
|
|
277
|
+
/**
|
|
278
|
+
* Ports probed when discovering remote/local nodes. Defaults to the
|
|
279
|
+
* well-known Calimero dev ports (2428, 2429, 2528, 2529). Mostly an escape
|
|
280
|
+
* hatch for non-standard setups and tests.
|
|
281
|
+
*/
|
|
282
|
+
localNodePorts?: readonly number[];
|
|
277
283
|
}
|
|
278
284
|
/**
|
|
279
285
|
* LoginModal - Connection modal component
|
|
280
286
|
*/
|
|
281
|
-
declare function LoginModal({ onConnect, onClose, connectionType, isOpen, theme, }: LoginModalProps): React.ReactPortal | null;
|
|
287
|
+
declare function LoginModal({ onConnect, onClose, connectionType, isOpen, theme, localNodePorts, }: LoginModalProps): React.ReactPortal | null;
|
|
282
288
|
|
|
283
289
|
interface CalimeroLogoProps extends React__default.SVGAttributes<SVGSVGElement> {
|
|
284
290
|
/** Width / height shorthand (applied to both). Default: 24. */
|
|
@@ -316,6 +322,54 @@ interface MigrationAdminPanelProps {
|
|
|
316
322
|
*/
|
|
317
323
|
declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
|
|
318
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Local-node discovery.
|
|
327
|
+
*
|
|
328
|
+
* Calimero dev/desktop nodes expose a public, unauthenticated health endpoint
|
|
329
|
+
* at `GET {nodeUrl}/admin-api/health` that returns `{ "data": { "status":
|
|
330
|
+
* "alive" } }`. The most common local layouts run on a small, well-known set of
|
|
331
|
+
* ports, so instead of forcing the user to type a URL we probe those ports and
|
|
332
|
+
* offer whatever is actually running.
|
|
333
|
+
*/
|
|
334
|
+
/**
|
|
335
|
+
* Default ports probed when discovering local nodes. Covers the two-node dev
|
|
336
|
+
* stacks used across the Calimero apps (RPC + alt ports for node1 / node2).
|
|
337
|
+
*/
|
|
338
|
+
declare const DEFAULT_LOCAL_NODE_PORTS: readonly [2428, 2429, 2528, 2529];
|
|
339
|
+
interface DiscoverLocalNodesOptions {
|
|
340
|
+
/** Ports to probe. Defaults to {@link DEFAULT_LOCAL_NODE_PORTS}. */
|
|
341
|
+
ports?: readonly number[];
|
|
342
|
+
/** Per-probe timeout in ms. Defaults to 2000. */
|
|
343
|
+
timeoutMs?: number;
|
|
344
|
+
/** Abort the whole discovery (e.g. when the modal closes). */
|
|
345
|
+
signal?: AbortSignal;
|
|
346
|
+
}
|
|
347
|
+
/** Build the canonical base URL for a local node on the given port. */
|
|
348
|
+
declare function localNodeUrl(port: number): string;
|
|
349
|
+
/**
|
|
350
|
+
* Resolve an API `path` against a node `baseUrl`. Ensures the base ends with a
|
|
351
|
+
* slash first, so a base that carries a path prefix (e.g. a `NODE_PATH_PREFIX`
|
|
352
|
+
* deployment like `http://host/node1`) keeps that segment instead of having it
|
|
353
|
+
* stripped by relative URL resolution.
|
|
354
|
+
*/
|
|
355
|
+
declare function nodeEndpoint(baseUrl: string, path: string): string;
|
|
356
|
+
/**
|
|
357
|
+
* Probe a single node's health endpoint. Resolves `true` only when the node
|
|
358
|
+
* answers with a 2xx and (when the body is JSON) reports a non-dead status.
|
|
359
|
+
* Any network error, timeout, or non-ok response resolves `false` — never
|
|
360
|
+
* throws (except on an external abort, which is swallowed as `false`).
|
|
361
|
+
*/
|
|
362
|
+
declare function probeNodeHealth(baseUrl: string, options?: {
|
|
363
|
+
timeoutMs?: number;
|
|
364
|
+
signal?: AbortSignal;
|
|
365
|
+
}): Promise<boolean>;
|
|
366
|
+
/**
|
|
367
|
+
* Probe the configured local ports in parallel and return the base URLs that
|
|
368
|
+
* responded as healthy, in the same order as the `ports` argument (which
|
|
369
|
+
* defaults to ascending). Returns an empty array when nothing local is running.
|
|
370
|
+
*/
|
|
371
|
+
declare function discoverLocalNodes(options?: DiscoverLocalNodesOptions): Promise<string[]>;
|
|
372
|
+
|
|
319
373
|
/**
|
|
320
374
|
* Shape accepted by the metadata-setter hooks — re-exported from mero-js so
|
|
321
375
|
* callers have one canonical type. A `set*Metadata` call **replaces the whole
|
|
@@ -734,4 +788,4 @@ declare function clearContextIdentity(): void;
|
|
|
734
788
|
*/
|
|
735
789
|
declare function clearAllStorage(): void;
|
|
736
790
|
|
|
737
|
-
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, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useExecute, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useRegisterGroupSigningKey, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateGroupSettings, useUpdateMemberRole, useUpgradeGroup };
|
|
791
|
+
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, DEFAULT_LOCAL_NODE_PORTS, type DiscoverLocalNodesOptions, 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, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, cssVar, defaultMeroTheme, discoverLocalNodes, getApplicationId, getContextId, getContextIdentity, getNodeUrl, localNodeUrl, localStorageTokenStorage, nodeEndpoint, probeNodeHealth, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useExecute, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useRegisterGroupSigningKey, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateGroupSettings, useUpdateMemberRole, useUpgradeGroup };
|