@calimero-network/mero-react 5.0.0 → 6.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/dist/index.cjs +230 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +122 -7
- package/dist/index.d.ts +122 -7
- package/dist/index.js +227 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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, 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';
|
|
5
|
+
import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, DeleteGroupRequest, DeleteNamespaceRequest, DetachContextFromGroupRequest, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, 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, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
7
|
+
export { CAPABILITIES, Codec, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, EphemeralClient, EphemeralEntry, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Types for mero-react
|
|
@@ -336,6 +336,50 @@ interface MigrationAdminPanelProps {
|
|
|
336
336
|
*/
|
|
337
337
|
declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
|
|
338
338
|
|
|
339
|
+
interface UseEphemeralOptions<T> {
|
|
340
|
+
/** Encoding for the presence slice. Defaults to JSON. */
|
|
341
|
+
codec?: Codec<T>;
|
|
342
|
+
/** Base value for the first `setPresence` merge. */
|
|
343
|
+
initial?: T;
|
|
344
|
+
/** Minimum ms between publishes. Trailing edge — the latest value wins. */
|
|
345
|
+
throttleMs?: number;
|
|
346
|
+
/** Include your own echoed presence in `peers`. Default false. */
|
|
347
|
+
includeSelf?: boolean;
|
|
348
|
+
}
|
|
349
|
+
/** Shape returned by {@link useEphemeral}. */
|
|
350
|
+
interface UseEphemeralResult<T> {
|
|
351
|
+
peers: Map<string, T>;
|
|
352
|
+
setPresence: (partial: Partial<T>) => void;
|
|
353
|
+
ageOf: (author: string) => number | undefined;
|
|
354
|
+
error: Error | null;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Observe and publish ephemeral presence (cursors, typing, online) for a
|
|
358
|
+
* context.
|
|
359
|
+
*
|
|
360
|
+
* ONE read path: the subscription. When a client subscribes, the node replays
|
|
361
|
+
* that context's current presence to that connection as ordinary entries
|
|
362
|
+
* before the live deltas start, so seeding and updating share a single shape
|
|
363
|
+
* ({@link EphemeralEntry}) and a reconnect — `SseClient` auto-reconnects and
|
|
364
|
+
* re-subscribes — re-seeds itself. There is no snapshot fetch and no
|
|
365
|
+
* client-side reconciliation pass.
|
|
366
|
+
*
|
|
367
|
+
* Freshness is computed entirely from local clock deltas: a replayed entry is
|
|
368
|
+
* current as of `Date.now() - ageMs`, a live delta as of `Date.now()`. No
|
|
369
|
+
* cross-machine clock comparison is ever performed.
|
|
370
|
+
*
|
|
371
|
+
* No client-side TTL or heartbeat: the node sweeps at 7s and emits removals,
|
|
372
|
+
* and re-publishes on your behalf every 2.5s. A replay is treated as
|
|
373
|
+
* AUTHORITATIVE — see the replay-reconcile pass in the read effect — so a peer
|
|
374
|
+
* swept while the SSE connection was down does not survive the reconnect.
|
|
375
|
+
*
|
|
376
|
+
* `error` is derived, not accumulated: standing conditions (no `ephemeral`
|
|
377
|
+
* surface) are recomputed every render, one-shot async failures are latched
|
|
378
|
+
* keyed by the context they happened in, and whether a latched failure is even
|
|
379
|
+
* relevant (an unresolved identity when `includeSelf` is true) is decided at
|
|
380
|
+
* read time. Nothing survives a context switch.
|
|
381
|
+
*/
|
|
382
|
+
declare function useEphemeral<T>(contextId: string | null, options?: UseEphemeralOptions<T>): UseEphemeralResult<T>;
|
|
339
383
|
/**
|
|
340
384
|
* Shape accepted by the metadata-setter hooks — re-exported from mero-js so
|
|
341
385
|
* callers have one canonical type. A `set*Metadata` call **replaces the whole
|
|
@@ -403,6 +447,11 @@ declare function useJoinGroup(): {
|
|
|
403
447
|
loading: boolean;
|
|
404
448
|
error: Error | null;
|
|
405
449
|
};
|
|
450
|
+
/**
|
|
451
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
452
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
453
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
454
|
+
*/
|
|
406
455
|
declare function useGroupCapabilities(groupId?: string | null, memberId?: string | null): {
|
|
407
456
|
capabilities: number | null;
|
|
408
457
|
loading: boolean;
|
|
@@ -453,11 +502,22 @@ declare function useSyncGroup(): {
|
|
|
453
502
|
loading: boolean;
|
|
454
503
|
error: Error | null;
|
|
455
504
|
};
|
|
505
|
+
/**
|
|
506
|
+
* Takes the invitee's signing KEY (bs58) - the one call on this resource that
|
|
507
|
+
* does, because someone being added may have no account here yet. Every other
|
|
508
|
+
* member call, including `useRemoveGroupMembers`, takes the ACCOUNT, so a value
|
|
509
|
+
* round-tripped from an add is the wrong one to remove with.
|
|
510
|
+
*/
|
|
456
511
|
declare function useAddGroupMembers(): {
|
|
457
512
|
addGroupMembers: (groupId: string, request: AddGroupMembersRequest) => Promise<void | null>;
|
|
458
513
|
loading: boolean;
|
|
459
514
|
error: Error | null;
|
|
460
515
|
};
|
|
516
|
+
/**
|
|
517
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
518
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
519
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
520
|
+
*/
|
|
461
521
|
declare function useRemoveGroupMembers(): {
|
|
462
522
|
removeGroupMembers: (groupId: string, request: RemoveGroupMembersRequest) => Promise<void | null>;
|
|
463
523
|
loading: boolean;
|
|
@@ -475,6 +535,24 @@ declare function useNamespace(namespaceId?: string | null): {
|
|
|
475
535
|
error: Error | null;
|
|
476
536
|
refetch: () => Promise<void>;
|
|
477
537
|
};
|
|
538
|
+
/**
|
|
539
|
+
* Who this node is: `accountId` is what member-addressing takes and what
|
|
540
|
+
* `useGroupMembers` rows are keyed by — `publicKey` is the signing key and
|
|
541
|
+
* addresses nobody. Both are 32-byte strings, so a swap fails silently.
|
|
542
|
+
*/
|
|
543
|
+
declare function useNodeIdentity(): {
|
|
544
|
+
identity: NodeIdentity | null;
|
|
545
|
+
loading: boolean;
|
|
546
|
+
error: Error | null;
|
|
547
|
+
refetch: () => Promise<void>;
|
|
548
|
+
};
|
|
549
|
+
/**
|
|
550
|
+
* @deprecated Use {@link useNodeIdentity}. Identity is per-node, not
|
|
551
|
+
* per-namespace, and this no longer gates on participation: it answers for a
|
|
552
|
+
* namespace this node never joined, so `identity != null` is not "am I a
|
|
553
|
+
* member?" — ask `useNamespaces` for that. Its `publicKey` is the signing key,
|
|
554
|
+
* NOT the account member-addressing wants.
|
|
555
|
+
*/
|
|
478
556
|
declare function useNamespaceIdentity(namespaceId?: string | null): {
|
|
479
557
|
identity: NamespaceIdentity | null;
|
|
480
558
|
loading: boolean;
|
|
@@ -518,6 +596,11 @@ declare function useNamespaceGroups(namespaceId?: string | null): {
|
|
|
518
596
|
error: Error | null;
|
|
519
597
|
refetch: () => Promise<void>;
|
|
520
598
|
};
|
|
599
|
+
/**
|
|
600
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
601
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
602
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
603
|
+
*/
|
|
521
604
|
declare function useUpdateMemberRole(): {
|
|
522
605
|
updateMemberRole: (groupId: string, identity: string, request: UpdateMemberRoleRequest) => Promise<void | null>;
|
|
523
606
|
loading: boolean;
|
|
@@ -555,6 +638,11 @@ declare function useSetGroupMetadata(): {
|
|
|
555
638
|
loading: boolean;
|
|
556
639
|
error: Error | null;
|
|
557
640
|
};
|
|
641
|
+
/**
|
|
642
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
643
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
644
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
645
|
+
*/
|
|
558
646
|
declare function useSetMemberMetadata(): {
|
|
559
647
|
setMemberMetadata: (groupId: string, identity: string, request: SetMetadataInput) => Promise<void | null>;
|
|
560
648
|
loading: boolean;
|
|
@@ -632,9 +720,31 @@ declare function useDetachContextFromGroup(): {
|
|
|
632
720
|
error: Error | null;
|
|
633
721
|
};
|
|
634
722
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
723
|
+
* Subscribe to a namespace's `GroupMigration` events, invoking `onEvent` per
|
|
724
|
+
* frame and unsubscribing on unmount.
|
|
725
|
+
*
|
|
726
|
+
* A non-admin subscriber never sees `CascadeProgress`; core delivers that to
|
|
727
|
+
* namespace admins only, so a UI must not wait on it to decide progress.
|
|
728
|
+
*/
|
|
729
|
+
/**
|
|
730
|
+
* Fallback poll cadence for `useMigrationStatus` when the SSE stream is
|
|
731
|
+
* unavailable (no token, a proxy that buffers, an older node) and the caller
|
|
732
|
+
* named no interval of its own. Chosen to match the heartbeat cadence that
|
|
733
|
+
* migration facts actually arrive on; an explicit `pollIntervalMs` overrides it.
|
|
734
|
+
*/
|
|
735
|
+
declare const DEFAULT_MIGRATION_POLL_INTERVAL_MS = 5000;
|
|
736
|
+
declare function useMigrationEvents(namespaceId: string | null | undefined, onEvent: (event: GroupMigrationEventData) => void): boolean;
|
|
737
|
+
/**
|
|
738
|
+
* Migration-status rollup for a namespace (skew #3).
|
|
739
|
+
*
|
|
740
|
+
* Live: subscribes to the `GroupMigration` event family and re-reads on each
|
|
741
|
+
* frame. It re-READS rather than folding the event's counters in, because the
|
|
742
|
+
* rollup is recomputed from raw member rows and is the authoritative answer.
|
|
743
|
+
* `pollIntervalMs` stays as the fallback when SSE is unavailable, and when the
|
|
744
|
+
* caller names none it defaults to `DEFAULT_MIGRATION_POLL_INTERVAL_MS` for
|
|
745
|
+
* exactly as long as the stream is down - so the panel can never sit silently
|
|
746
|
+
* frozen with neither transport.
|
|
747
|
+
* Derived counters are null-safe before the first load.
|
|
638
748
|
*/
|
|
639
749
|
declare function useMigrationStatus(namespaceId?: string | null, options?: {
|
|
640
750
|
pollIntervalMs?: number;
|
|
@@ -643,6 +753,12 @@ declare function useMigrationStatus(namespaceId?: string | null, options?: {
|
|
|
643
753
|
rollup: MigrationStatusRollup | null;
|
|
644
754
|
members: MemberMigrationStatusEntry[];
|
|
645
755
|
allMigrated: boolean;
|
|
756
|
+
/**
|
|
757
|
+
* When this node watched the fleet converge, or `null`. Durable, unlike
|
|
758
|
+
* `allMigrated`, which is recomputed from in-TTL heartbeats and lapses back
|
|
759
|
+
* to false when a member simply goes quiet.
|
|
760
|
+
*/
|
|
761
|
+
fleetCompletedAt: number | null;
|
|
646
762
|
membersPendingSignature: number;
|
|
647
763
|
/** Members whose migrate aborted (migration-check failed or apply errored). */
|
|
648
764
|
failed: number;
|
|
@@ -707,7 +823,6 @@ declare function useGroupAppVersion(groupId?: string): {
|
|
|
707
823
|
applicationId: string | null;
|
|
708
824
|
/** The installed blob differs from the one the group targets (see hook doc). */
|
|
709
825
|
pendingApply: boolean;
|
|
710
|
-
upgradePolicy: string | null;
|
|
711
826
|
/** Only populated via the group-info path; `null` in the namespace path. */
|
|
712
827
|
activeUpgrade: GroupUpgradeStatusResponseData;
|
|
713
828
|
};
|
|
@@ -803,4 +918,4 @@ declare function clearContextIdentity(): void;
|
|
|
803
918
|
*/
|
|
804
919
|
declare function clearAllStorage(): void;
|
|
805
920
|
|
|
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 };
|
|
921
|
+
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, 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, type UseEphemeralOptions, type UseEphemeralResult, 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, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, 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, 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';
|
|
5
|
+
import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, DeleteGroupRequest, DeleteNamespaceRequest, DetachContextFromGroupRequest, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, 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, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
7
|
+
export { CAPABILITIES, Codec, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, EphemeralClient, EphemeralEntry, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Types for mero-react
|
|
@@ -336,6 +336,50 @@ interface MigrationAdminPanelProps {
|
|
|
336
336
|
*/
|
|
337
337
|
declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
|
|
338
338
|
|
|
339
|
+
interface UseEphemeralOptions<T> {
|
|
340
|
+
/** Encoding for the presence slice. Defaults to JSON. */
|
|
341
|
+
codec?: Codec<T>;
|
|
342
|
+
/** Base value for the first `setPresence` merge. */
|
|
343
|
+
initial?: T;
|
|
344
|
+
/** Minimum ms between publishes. Trailing edge — the latest value wins. */
|
|
345
|
+
throttleMs?: number;
|
|
346
|
+
/** Include your own echoed presence in `peers`. Default false. */
|
|
347
|
+
includeSelf?: boolean;
|
|
348
|
+
}
|
|
349
|
+
/** Shape returned by {@link useEphemeral}. */
|
|
350
|
+
interface UseEphemeralResult<T> {
|
|
351
|
+
peers: Map<string, T>;
|
|
352
|
+
setPresence: (partial: Partial<T>) => void;
|
|
353
|
+
ageOf: (author: string) => number | undefined;
|
|
354
|
+
error: Error | null;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Observe and publish ephemeral presence (cursors, typing, online) for a
|
|
358
|
+
* context.
|
|
359
|
+
*
|
|
360
|
+
* ONE read path: the subscription. When a client subscribes, the node replays
|
|
361
|
+
* that context's current presence to that connection as ordinary entries
|
|
362
|
+
* before the live deltas start, so seeding and updating share a single shape
|
|
363
|
+
* ({@link EphemeralEntry}) and a reconnect — `SseClient` auto-reconnects and
|
|
364
|
+
* re-subscribes — re-seeds itself. There is no snapshot fetch and no
|
|
365
|
+
* client-side reconciliation pass.
|
|
366
|
+
*
|
|
367
|
+
* Freshness is computed entirely from local clock deltas: a replayed entry is
|
|
368
|
+
* current as of `Date.now() - ageMs`, a live delta as of `Date.now()`. No
|
|
369
|
+
* cross-machine clock comparison is ever performed.
|
|
370
|
+
*
|
|
371
|
+
* No client-side TTL or heartbeat: the node sweeps at 7s and emits removals,
|
|
372
|
+
* and re-publishes on your behalf every 2.5s. A replay is treated as
|
|
373
|
+
* AUTHORITATIVE — see the replay-reconcile pass in the read effect — so a peer
|
|
374
|
+
* swept while the SSE connection was down does not survive the reconnect.
|
|
375
|
+
*
|
|
376
|
+
* `error` is derived, not accumulated: standing conditions (no `ephemeral`
|
|
377
|
+
* surface) are recomputed every render, one-shot async failures are latched
|
|
378
|
+
* keyed by the context they happened in, and whether a latched failure is even
|
|
379
|
+
* relevant (an unresolved identity when `includeSelf` is true) is decided at
|
|
380
|
+
* read time. Nothing survives a context switch.
|
|
381
|
+
*/
|
|
382
|
+
declare function useEphemeral<T>(contextId: string | null, options?: UseEphemeralOptions<T>): UseEphemeralResult<T>;
|
|
339
383
|
/**
|
|
340
384
|
* Shape accepted by the metadata-setter hooks — re-exported from mero-js so
|
|
341
385
|
* callers have one canonical type. A `set*Metadata` call **replaces the whole
|
|
@@ -403,6 +447,11 @@ declare function useJoinGroup(): {
|
|
|
403
447
|
loading: boolean;
|
|
404
448
|
error: Error | null;
|
|
405
449
|
};
|
|
450
|
+
/**
|
|
451
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
452
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
453
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
454
|
+
*/
|
|
406
455
|
declare function useGroupCapabilities(groupId?: string | null, memberId?: string | null): {
|
|
407
456
|
capabilities: number | null;
|
|
408
457
|
loading: boolean;
|
|
@@ -453,11 +502,22 @@ declare function useSyncGroup(): {
|
|
|
453
502
|
loading: boolean;
|
|
454
503
|
error: Error | null;
|
|
455
504
|
};
|
|
505
|
+
/**
|
|
506
|
+
* Takes the invitee's signing KEY (bs58) - the one call on this resource that
|
|
507
|
+
* does, because someone being added may have no account here yet. Every other
|
|
508
|
+
* member call, including `useRemoveGroupMembers`, takes the ACCOUNT, so a value
|
|
509
|
+
* round-tripped from an add is the wrong one to remove with.
|
|
510
|
+
*/
|
|
456
511
|
declare function useAddGroupMembers(): {
|
|
457
512
|
addGroupMembers: (groupId: string, request: AddGroupMembersRequest) => Promise<void | null>;
|
|
458
513
|
loading: boolean;
|
|
459
514
|
error: Error | null;
|
|
460
515
|
};
|
|
516
|
+
/**
|
|
517
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
518
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
519
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
520
|
+
*/
|
|
461
521
|
declare function useRemoveGroupMembers(): {
|
|
462
522
|
removeGroupMembers: (groupId: string, request: RemoveGroupMembersRequest) => Promise<void | null>;
|
|
463
523
|
loading: boolean;
|
|
@@ -475,6 +535,24 @@ declare function useNamespace(namespaceId?: string | null): {
|
|
|
475
535
|
error: Error | null;
|
|
476
536
|
refetch: () => Promise<void>;
|
|
477
537
|
};
|
|
538
|
+
/**
|
|
539
|
+
* Who this node is: `accountId` is what member-addressing takes and what
|
|
540
|
+
* `useGroupMembers` rows are keyed by — `publicKey` is the signing key and
|
|
541
|
+
* addresses nobody. Both are 32-byte strings, so a swap fails silently.
|
|
542
|
+
*/
|
|
543
|
+
declare function useNodeIdentity(): {
|
|
544
|
+
identity: NodeIdentity | null;
|
|
545
|
+
loading: boolean;
|
|
546
|
+
error: Error | null;
|
|
547
|
+
refetch: () => Promise<void>;
|
|
548
|
+
};
|
|
549
|
+
/**
|
|
550
|
+
* @deprecated Use {@link useNodeIdentity}. Identity is per-node, not
|
|
551
|
+
* per-namespace, and this no longer gates on participation: it answers for a
|
|
552
|
+
* namespace this node never joined, so `identity != null` is not "am I a
|
|
553
|
+
* member?" — ask `useNamespaces` for that. Its `publicKey` is the signing key,
|
|
554
|
+
* NOT the account member-addressing wants.
|
|
555
|
+
*/
|
|
478
556
|
declare function useNamespaceIdentity(namespaceId?: string | null): {
|
|
479
557
|
identity: NamespaceIdentity | null;
|
|
480
558
|
loading: boolean;
|
|
@@ -518,6 +596,11 @@ declare function useNamespaceGroups(namespaceId?: string | null): {
|
|
|
518
596
|
error: Error | null;
|
|
519
597
|
refetch: () => Promise<void>;
|
|
520
598
|
};
|
|
599
|
+
/**
|
|
600
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
601
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
602
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
603
|
+
*/
|
|
521
604
|
declare function useUpdateMemberRole(): {
|
|
522
605
|
updateMemberRole: (groupId: string, identity: string, request: UpdateMemberRoleRequest) => Promise<void | null>;
|
|
523
606
|
loading: boolean;
|
|
@@ -555,6 +638,11 @@ declare function useSetGroupMetadata(): {
|
|
|
555
638
|
loading: boolean;
|
|
556
639
|
error: Error | null;
|
|
557
640
|
};
|
|
641
|
+
/**
|
|
642
|
+
* Takes the member's ACCOUNT (64 hex), as `useGroupMembers` rows are keyed by
|
|
643
|
+
* and `useNodeIdentity().identity?.accountId` returns - NOT a signing key.
|
|
644
|
+
* Both are 32-byte strings, so passing a key names nobody and raises nothing.
|
|
645
|
+
*/
|
|
558
646
|
declare function useSetMemberMetadata(): {
|
|
559
647
|
setMemberMetadata: (groupId: string, identity: string, request: SetMetadataInput) => Promise<void | null>;
|
|
560
648
|
loading: boolean;
|
|
@@ -632,9 +720,31 @@ declare function useDetachContextFromGroup(): {
|
|
|
632
720
|
error: Error | null;
|
|
633
721
|
};
|
|
634
722
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
723
|
+
* Subscribe to a namespace's `GroupMigration` events, invoking `onEvent` per
|
|
724
|
+
* frame and unsubscribing on unmount.
|
|
725
|
+
*
|
|
726
|
+
* A non-admin subscriber never sees `CascadeProgress`; core delivers that to
|
|
727
|
+
* namespace admins only, so a UI must not wait on it to decide progress.
|
|
728
|
+
*/
|
|
729
|
+
/**
|
|
730
|
+
* Fallback poll cadence for `useMigrationStatus` when the SSE stream is
|
|
731
|
+
* unavailable (no token, a proxy that buffers, an older node) and the caller
|
|
732
|
+
* named no interval of its own. Chosen to match the heartbeat cadence that
|
|
733
|
+
* migration facts actually arrive on; an explicit `pollIntervalMs` overrides it.
|
|
734
|
+
*/
|
|
735
|
+
declare const DEFAULT_MIGRATION_POLL_INTERVAL_MS = 5000;
|
|
736
|
+
declare function useMigrationEvents(namespaceId: string | null | undefined, onEvent: (event: GroupMigrationEventData) => void): boolean;
|
|
737
|
+
/**
|
|
738
|
+
* Migration-status rollup for a namespace (skew #3).
|
|
739
|
+
*
|
|
740
|
+
* Live: subscribes to the `GroupMigration` event family and re-reads on each
|
|
741
|
+
* frame. It re-READS rather than folding the event's counters in, because the
|
|
742
|
+
* rollup is recomputed from raw member rows and is the authoritative answer.
|
|
743
|
+
* `pollIntervalMs` stays as the fallback when SSE is unavailable, and when the
|
|
744
|
+
* caller names none it defaults to `DEFAULT_MIGRATION_POLL_INTERVAL_MS` for
|
|
745
|
+
* exactly as long as the stream is down - so the panel can never sit silently
|
|
746
|
+
* frozen with neither transport.
|
|
747
|
+
* Derived counters are null-safe before the first load.
|
|
638
748
|
*/
|
|
639
749
|
declare function useMigrationStatus(namespaceId?: string | null, options?: {
|
|
640
750
|
pollIntervalMs?: number;
|
|
@@ -643,6 +753,12 @@ declare function useMigrationStatus(namespaceId?: string | null, options?: {
|
|
|
643
753
|
rollup: MigrationStatusRollup | null;
|
|
644
754
|
members: MemberMigrationStatusEntry[];
|
|
645
755
|
allMigrated: boolean;
|
|
756
|
+
/**
|
|
757
|
+
* When this node watched the fleet converge, or `null`. Durable, unlike
|
|
758
|
+
* `allMigrated`, which is recomputed from in-TTL heartbeats and lapses back
|
|
759
|
+
* to false when a member simply goes quiet.
|
|
760
|
+
*/
|
|
761
|
+
fleetCompletedAt: number | null;
|
|
646
762
|
membersPendingSignature: number;
|
|
647
763
|
/** Members whose migrate aborted (migration-check failed or apply errored). */
|
|
648
764
|
failed: number;
|
|
@@ -707,7 +823,6 @@ declare function useGroupAppVersion(groupId?: string): {
|
|
|
707
823
|
applicationId: string | null;
|
|
708
824
|
/** The installed blob differs from the one the group targets (see hook doc). */
|
|
709
825
|
pendingApply: boolean;
|
|
710
|
-
upgradePolicy: string | null;
|
|
711
826
|
/** Only populated via the group-info path; `null` in the namespace path. */
|
|
712
827
|
activeUpgrade: GroupUpgradeStatusResponseData;
|
|
713
828
|
};
|
|
@@ -803,4 +918,4 @@ declare function clearContextIdentity(): void;
|
|
|
803
918
|
*/
|
|
804
919
|
declare function clearAllStorage(): void;
|
|
805
920
|
|
|
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 };
|
|
921
|
+
export { type AppContext, AppMode, type ApplicationContextRecord, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, 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, type UseEphemeralOptions, type UseEphemeralResult, 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, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup };
|