@calimero-network/mero-react 9.7.0 → 9.8.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 +82 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -7
- package/dist/index.d.ts +41 -7
- package/dist/index.js +82 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1086,10 +1086,20 @@ declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
|
|
|
1086
1086
|
};
|
|
1087
1087
|
}, deps?: {
|
|
1088
1088
|
fetch?: typeof fetch;
|
|
1089
|
-
|
|
1089
|
+
/** The cloud to enable HA on; mero-js's default when unset. */
|
|
1090
|
+
cloudBaseUrl?: string;
|
|
1091
|
+
}): Promise<FoundedDelegatedNamespace>;
|
|
1092
|
+
/** What {@link foundDelegatedNamespace} returns. */
|
|
1093
|
+
interface FoundedDelegatedNamespace {
|
|
1090
1094
|
namespaceId: string;
|
|
1091
1095
|
teeEnabled: boolean;
|
|
1092
|
-
|
|
1096
|
+
/** Whether the cloud agreed to host the namespace (HA) right after founding. */
|
|
1097
|
+
haEnabled: boolean;
|
|
1098
|
+
/** Why `haEnabled` is `false`, in words a person can act on. */
|
|
1099
|
+
haError?: string;
|
|
1100
|
+
}
|
|
1101
|
+
/** What an app can tell a person whose account the cloud cannot place. */
|
|
1102
|
+
declare const HA_ACCOUNT_NOT_LINKED_MESSAGE = "link this account to your cloud user in the wallet so invitees can find this namespace";
|
|
1093
1103
|
|
|
1094
1104
|
/**
|
|
1095
1105
|
* An account's group management through a relay: one delegated governance op
|
|
@@ -1132,6 +1142,22 @@ declare class NoRelayError extends Error {
|
|
|
1132
1142
|
readonly method: string;
|
|
1133
1143
|
constructor(method: string);
|
|
1134
1144
|
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Why an account's invitation was not minted: nobody its claimant could reach
|
|
1147
|
+
* would admit them. A claimant with no node finds its admitter through the
|
|
1148
|
+
* cloud's routing, intersected with the invitation's signed admitters, so an
|
|
1149
|
+
* invitation the cloud routes to none of them can only fail in their hands.
|
|
1150
|
+
*
|
|
1151
|
+
* - `not-hosted` — the cloud serves the namespace on no node: HA was never
|
|
1152
|
+
* enabled for it (not linked in the wallet, quota, or founding not attested).
|
|
1153
|
+
* - `no-named-node` — the cloud's nodes are not among the admitters this
|
|
1154
|
+
* invitation would name.
|
|
1155
|
+
*/
|
|
1156
|
+
declare class InvitationNotClaimableError extends Error {
|
|
1157
|
+
readonly namespaceId: string;
|
|
1158
|
+
readonly reason: 'not-hosted' | 'no-named-node';
|
|
1159
|
+
constructor(namespaceId: string, reason: 'not-hosted' | 'no-named-node');
|
|
1160
|
+
}
|
|
1135
1161
|
interface AccountAdminDeps {
|
|
1136
1162
|
govern?: {
|
|
1137
1163
|
group: typeof governGroup;
|
|
@@ -1150,6 +1176,17 @@ interface AccountAdminDeps {
|
|
|
1150
1176
|
join?: (namespaceId: string, invitation: SignedGroupOpenInvitation) => Promise<{
|
|
1151
1177
|
namespaceId: string;
|
|
1152
1178
|
}>;
|
|
1179
|
+
/**
|
|
1180
|
+
* The cloud's routing for a namespace (`CloudClient.getNamespaceRouting`):
|
|
1181
|
+
* the nodes a node-less invitee can be admitted through. Given, an
|
|
1182
|
+
* invitation is minted only if one of them is an admitter it names; a lookup
|
|
1183
|
+
* that fails does not block minting. The provider supplies it.
|
|
1184
|
+
*/
|
|
1185
|
+
routing?: (namespaceId: string) => Promise<{
|
|
1186
|
+
nodes: ReadonlyArray<{
|
|
1187
|
+
account: string | null;
|
|
1188
|
+
}>;
|
|
1189
|
+
}>;
|
|
1153
1190
|
}
|
|
1154
1191
|
declare function createAccountAdmin(input: {
|
|
1155
1192
|
session: DelegatedSession;
|
|
@@ -1552,10 +1589,7 @@ declare function useNamespacesForApplication(applicationId?: string | null): {
|
|
|
1552
1589
|
refetch: () => Promise<void>;
|
|
1553
1590
|
};
|
|
1554
1591
|
declare function useCreateNamespace(): {
|
|
1555
|
-
createNamespace: (request: CreateNamespaceRequest) => Promise<
|
|
1556
|
-
namespaceId: string;
|
|
1557
|
-
teeEnabled: boolean;
|
|
1558
|
-
} | _calimero_network_mero_js.CreateNamespaceResponseData | null>;
|
|
1592
|
+
createNamespace: (request: CreateNamespaceRequest) => Promise<FoundedDelegatedNamespace | _calimero_network_mero_js.CreateNamespaceResponseData | null>;
|
|
1559
1593
|
loading: boolean;
|
|
1560
1594
|
error: Error | null;
|
|
1561
1595
|
};
|
|
@@ -2054,4 +2088,4 @@ declare function clearContextIdentity(): void;
|
|
|
2054
2088
|
*/
|
|
2055
2089
|
declare function clearAllStorage(): void;
|
|
2056
2090
|
|
|
2057
|
-
export { type AccountAdminDeps, type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, type BootstrapFailure, type BootstrapFromInvitationInput, type BootstrapResult, type BootstrapStep, type BootstrapSuccess, CalimeroLogo, type CalimeroLogoProps, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type DelegatedCredential, type DelegatedSession, type ExecutionResult, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, type JoinWithNodeFailure, type JoinWithNodeInput, type JoinWithNodeResult, type JoinWithNodeStep, type JoinWithNodeSuccess, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, NoRelayError, NotForAccountError, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createAccountAdmin, createDelegatedContext, createNodeAdmin, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
2091
|
+
export { type AccountAdminDeps, type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, type BootstrapFailure, type BootstrapFromInvitationInput, type BootstrapResult, type BootstrapStep, type BootstrapSuccess, CalimeroLogo, type CalimeroLogoProps, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type DelegatedCredential, type DelegatedSession, type ExecutionResult, type FoundedDelegatedNamespace, HA_ACCOUNT_NOT_LINKED_MESSAGE, InvitationNotClaimableError, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, type JoinWithNodeFailure, type JoinWithNodeInput, type JoinWithNodeResult, type JoinWithNodeStep, type JoinWithNodeSuccess, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, NoRelayError, NotForAccountError, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createAccountAdmin, createDelegatedContext, createNodeAdmin, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
package/dist/index.d.ts
CHANGED
|
@@ -1086,10 +1086,20 @@ declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
|
|
|
1086
1086
|
};
|
|
1087
1087
|
}, deps?: {
|
|
1088
1088
|
fetch?: typeof fetch;
|
|
1089
|
-
|
|
1089
|
+
/** The cloud to enable HA on; mero-js's default when unset. */
|
|
1090
|
+
cloudBaseUrl?: string;
|
|
1091
|
+
}): Promise<FoundedDelegatedNamespace>;
|
|
1092
|
+
/** What {@link foundDelegatedNamespace} returns. */
|
|
1093
|
+
interface FoundedDelegatedNamespace {
|
|
1090
1094
|
namespaceId: string;
|
|
1091
1095
|
teeEnabled: boolean;
|
|
1092
|
-
|
|
1096
|
+
/** Whether the cloud agreed to host the namespace (HA) right after founding. */
|
|
1097
|
+
haEnabled: boolean;
|
|
1098
|
+
/** Why `haEnabled` is `false`, in words a person can act on. */
|
|
1099
|
+
haError?: string;
|
|
1100
|
+
}
|
|
1101
|
+
/** What an app can tell a person whose account the cloud cannot place. */
|
|
1102
|
+
declare const HA_ACCOUNT_NOT_LINKED_MESSAGE = "link this account to your cloud user in the wallet so invitees can find this namespace";
|
|
1093
1103
|
|
|
1094
1104
|
/**
|
|
1095
1105
|
* An account's group management through a relay: one delegated governance op
|
|
@@ -1132,6 +1142,22 @@ declare class NoRelayError extends Error {
|
|
|
1132
1142
|
readonly method: string;
|
|
1133
1143
|
constructor(method: string);
|
|
1134
1144
|
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Why an account's invitation was not minted: nobody its claimant could reach
|
|
1147
|
+
* would admit them. A claimant with no node finds its admitter through the
|
|
1148
|
+
* cloud's routing, intersected with the invitation's signed admitters, so an
|
|
1149
|
+
* invitation the cloud routes to none of them can only fail in their hands.
|
|
1150
|
+
*
|
|
1151
|
+
* - `not-hosted` — the cloud serves the namespace on no node: HA was never
|
|
1152
|
+
* enabled for it (not linked in the wallet, quota, or founding not attested).
|
|
1153
|
+
* - `no-named-node` — the cloud's nodes are not among the admitters this
|
|
1154
|
+
* invitation would name.
|
|
1155
|
+
*/
|
|
1156
|
+
declare class InvitationNotClaimableError extends Error {
|
|
1157
|
+
readonly namespaceId: string;
|
|
1158
|
+
readonly reason: 'not-hosted' | 'no-named-node';
|
|
1159
|
+
constructor(namespaceId: string, reason: 'not-hosted' | 'no-named-node');
|
|
1160
|
+
}
|
|
1135
1161
|
interface AccountAdminDeps {
|
|
1136
1162
|
govern?: {
|
|
1137
1163
|
group: typeof governGroup;
|
|
@@ -1150,6 +1176,17 @@ interface AccountAdminDeps {
|
|
|
1150
1176
|
join?: (namespaceId: string, invitation: SignedGroupOpenInvitation) => Promise<{
|
|
1151
1177
|
namespaceId: string;
|
|
1152
1178
|
}>;
|
|
1179
|
+
/**
|
|
1180
|
+
* The cloud's routing for a namespace (`CloudClient.getNamespaceRouting`):
|
|
1181
|
+
* the nodes a node-less invitee can be admitted through. Given, an
|
|
1182
|
+
* invitation is minted only if one of them is an admitter it names; a lookup
|
|
1183
|
+
* that fails does not block minting. The provider supplies it.
|
|
1184
|
+
*/
|
|
1185
|
+
routing?: (namespaceId: string) => Promise<{
|
|
1186
|
+
nodes: ReadonlyArray<{
|
|
1187
|
+
account: string | null;
|
|
1188
|
+
}>;
|
|
1189
|
+
}>;
|
|
1153
1190
|
}
|
|
1154
1191
|
declare function createAccountAdmin(input: {
|
|
1155
1192
|
session: DelegatedSession;
|
|
@@ -1552,10 +1589,7 @@ declare function useNamespacesForApplication(applicationId?: string | null): {
|
|
|
1552
1589
|
refetch: () => Promise<void>;
|
|
1553
1590
|
};
|
|
1554
1591
|
declare function useCreateNamespace(): {
|
|
1555
|
-
createNamespace: (request: CreateNamespaceRequest) => Promise<
|
|
1556
|
-
namespaceId: string;
|
|
1557
|
-
teeEnabled: boolean;
|
|
1558
|
-
} | _calimero_network_mero_js.CreateNamespaceResponseData | null>;
|
|
1592
|
+
createNamespace: (request: CreateNamespaceRequest) => Promise<FoundedDelegatedNamespace | _calimero_network_mero_js.CreateNamespaceResponseData | null>;
|
|
1559
1593
|
loading: boolean;
|
|
1560
1594
|
error: Error | null;
|
|
1561
1595
|
};
|
|
@@ -2054,4 +2088,4 @@ declare function clearContextIdentity(): void;
|
|
|
2054
2088
|
*/
|
|
2055
2089
|
declare function clearAllStorage(): void;
|
|
2056
2090
|
|
|
2057
|
-
export { type AccountAdminDeps, type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, type BootstrapFailure, type BootstrapFromInvitationInput, type BootstrapResult, type BootstrapStep, type BootstrapSuccess, CalimeroLogo, type CalimeroLogoProps, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type DelegatedCredential, type DelegatedSession, type ExecutionResult, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, type JoinWithNodeFailure, type JoinWithNodeInput, type JoinWithNodeResult, type JoinWithNodeStep, type JoinWithNodeSuccess, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, NoRelayError, NotForAccountError, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createAccountAdmin, createDelegatedContext, createNodeAdmin, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
2091
|
+
export { type AccountAdminDeps, type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, type BootstrapFailure, type BootstrapFromInvitationInput, type BootstrapResult, type BootstrapStep, type BootstrapSuccess, CalimeroLogo, type CalimeroLogoProps, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type DelegatedCredential, type DelegatedSession, type ExecutionResult, type FoundedDelegatedNamespace, HA_ACCOUNT_NOT_LINKED_MESSAGE, InvitationNotClaimableError, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, type JoinWithNodeFailure, type JoinWithNodeInput, type JoinWithNodeResult, type JoinWithNodeStep, type JoinWithNodeSuccess, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, NoRelayError, NotForAccountError, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createAccountAdmin, createDelegatedContext, createNodeAdmin, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useMemo, useState, useRef, useCallback, useEffect, useContext } from 'react';
|
|
2
|
-
import { signGroupInvitation, signMemberJoinOp, CloudClient, LocalStorageTokenStore, parseAuthCallback, MeroJs, buildAuthLoginUrl, DEFAULT_LOCAL_NODE_PORTS, discoverLocalNodes, nodeEndpoint, readEnrolmentCallback, completeDeviceEnrolment, deviceEnrolmentUrl, memberJoinedOpenOp, signerFromSecret, groupDeletedOp, memberAddedOp, memberRemovedOp, subgroupCreation, memberRoleSetOp, defaultCapabilitiesSetOp, subgroupVisibilitySetOp, groupMetadataSetOp, memberMetadataSetOp, contextMetadataSetOp, groupReparentedOp, contextDetachedOp, compareSemver, AuthRevokedError, HTTPError, memberLeftOp, memberCapabilitySetOp, attestRelayNodeKey, createMeroClient, RelayClient, createLocalStorageNonceSource, classifyError, login, defaultAudience, createSignedReleaseVerifier, fetchNodeRelease, cloudNodeReleaseUrl, DEFAULT_RELEASE_MIRROR, fetchNodeReleaseVersion } from '@calimero-network/mero-js';
|
|
2
|
+
import { signGroupInvitation, signMemberJoinOp, CloudClient, LocalStorageTokenStore, parseAuthCallback, MeroJs, buildAuthLoginUrl, DEFAULT_LOCAL_NODE_PORTS, discoverLocalNodes, nodeEndpoint, readEnrolmentCallback, completeDeviceEnrolment, deviceEnrolmentUrl, memberJoinedOpenOp, signerFromSecret, groupDeletedOp, memberAddedOp, memberRemovedOp, subgroupCreation, memberRoleSetOp, defaultCapabilitiesSetOp, subgroupVisibilitySetOp, groupMetadataSetOp, memberMetadataSetOp, contextMetadataSetOp, groupReparentedOp, contextDetachedOp, compareSemver, AuthRevokedError, HTTPError, memberLeftOp, memberCapabilitySetOp, attestRelayNodeKey, createMeroClient, RelayClient, createLocalStorageNonceSource, classifyError, login, defaultAudience, AccountNotLinkedError, createSignedReleaseVerifier, fetchNodeRelease, cloudNodeReleaseUrl, DEFAULT_RELEASE_MIRROR, fetchNodeReleaseVersion } from '@calimero-network/mero-js';
|
|
3
3
|
export * from '@calimero-network/mero-js';
|
|
4
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';
|
|
@@ -162,10 +162,18 @@ function isLoopback(relayUrl) {
|
|
|
162
162
|
var TRUSTED_RELAY_PROFILE = "locked-read-only";
|
|
163
163
|
var MIN_RELAY_RELEASE = "2.3.99";
|
|
164
164
|
var loadedDcap;
|
|
165
|
+
function dcapVerifyFrom(mod) {
|
|
166
|
+
const ns = mod;
|
|
167
|
+
const verify = typeof ns.verify === "function" ? ns.verify : ns.default?.verify;
|
|
168
|
+
if (typeof verify !== "function") {
|
|
169
|
+
throw new TypeError("@phala/dcap-qvl loaded without a verify function");
|
|
170
|
+
}
|
|
171
|
+
return verify;
|
|
172
|
+
}
|
|
165
173
|
function relayQuoteVerifier(relayUrl) {
|
|
166
174
|
const verify = async (attestation) => {
|
|
167
175
|
loadedDcap ?? (loadedDcap = import('@phala/dcap-qvl').then(
|
|
168
|
-
(
|
|
176
|
+
(mod) => dcapVerifyFrom(mod),
|
|
169
177
|
(error) => {
|
|
170
178
|
loadedDcap = void 0;
|
|
171
179
|
throw error;
|
|
@@ -446,7 +454,30 @@ async function foundDelegatedNamespace(s, req = {}, deps = {}) {
|
|
|
446
454
|
`founded ${founded.namespaceId} but could not give it its application: ${founded.applicationError ?? "unknown reason"}`
|
|
447
455
|
);
|
|
448
456
|
}
|
|
449
|
-
|
|
457
|
+
const ha = founded.teeEnabled ? await enableHaBestEffort(s, founded.namespaceId, founded.salt, relay, deps) : {
|
|
458
|
+
haEnabled: false,
|
|
459
|
+
haError: `the relay did not attest the founding, so no fleet node could be admitted for HA${founded.teeError ? `: ${founded.teeError}` : ""}`
|
|
460
|
+
};
|
|
461
|
+
return { namespaceId: founded.namespaceId, teeEnabled: founded.teeEnabled, ...ha };
|
|
462
|
+
}
|
|
463
|
+
var HA_ACCOUNT_NOT_LINKED_MESSAGE = "link this account to your cloud user in the wallet so invitees can find this namespace";
|
|
464
|
+
async function enableHaBestEffort(s, namespaceId, salt, relayUrl, deps) {
|
|
465
|
+
try {
|
|
466
|
+
await new CloudClient({ cloudBaseUrl: deps.cloudBaseUrl, fetch: deps.fetch }).enableHaAsAccount({
|
|
467
|
+
namespaceId,
|
|
468
|
+
salt,
|
|
469
|
+
accountId: s.account,
|
|
470
|
+
credential: s.credential,
|
|
471
|
+
deviceSecret: s.deviceSecret,
|
|
472
|
+
// The relay that founded it: the cloud hands it to the fleet node as its
|
|
473
|
+
// admitter, so the node does not have to find it by discovery.
|
|
474
|
+
relayUrl
|
|
475
|
+
});
|
|
476
|
+
return { haEnabled: true };
|
|
477
|
+
} catch (e) {
|
|
478
|
+
if (e instanceof AccountNotLinkedError) return { haEnabled: false, haError: HA_ACCOUNT_NOT_LINKED_MESSAGE };
|
|
479
|
+
return { haEnabled: false, haError: e instanceof Error ? e.message : String(e) };
|
|
480
|
+
}
|
|
450
481
|
}
|
|
451
482
|
async function latestPublishedVersion(registryUrl, pkg, fetchFn = globalThis.fetch) {
|
|
452
483
|
const url = `${registryUrl.replace(/\/+$/, "")}/api/v2/bundles?package=${encodeURIComponent(pkg)}`;
|
|
@@ -551,6 +582,16 @@ var NoRelayError = class extends Error {
|
|
|
551
582
|
this.name = "NoRelayError";
|
|
552
583
|
}
|
|
553
584
|
};
|
|
585
|
+
var InvitationNotClaimableError = class extends Error {
|
|
586
|
+
constructor(namespaceId, reason) {
|
|
587
|
+
super(
|
|
588
|
+
reason === "not-hosted" ? `nobody could claim an invitation to ${namespaceId} yet: the namespace is not hosted in the cloud, so an invitee with no node has no relay to be admitted through. Link this account to your cloud user in the wallet and enable HA for the namespace, then invite.` : `nobody could claim an invitation to ${namespaceId}: the cloud routes to none of the relays or admins it would name as admitters`
|
|
589
|
+
);
|
|
590
|
+
this.namespaceId = namespaceId;
|
|
591
|
+
this.reason = reason;
|
|
592
|
+
this.name = "InvitationNotClaimableError";
|
|
593
|
+
}
|
|
594
|
+
};
|
|
554
595
|
var EMPTY_READS = {
|
|
555
596
|
listNamespaces: async () => [],
|
|
556
597
|
listNamespacesForApplication: async () => [],
|
|
@@ -604,6 +645,7 @@ function createAccountAdmin(input, deps = {}) {
|
|
|
604
645
|
const latestVersion = deps.latestVersion ?? latestPublishedVersion;
|
|
605
646
|
const signInvitation = deps.signInvitation ?? signGroupInvitation;
|
|
606
647
|
const join = deps.join;
|
|
648
|
+
const routing = deps.routing;
|
|
607
649
|
async function joinNamespace(namespaceId, req) {
|
|
608
650
|
if (!join) throw new NotForAccountError("joinNamespace without a join handler");
|
|
609
651
|
return join(namespaceId, req.invitation);
|
|
@@ -651,12 +693,12 @@ function createAccountAdmin(input, deps = {}) {
|
|
|
651
693
|
async createNamespace(req) {
|
|
652
694
|
if (!app.packageName) throw new NotForAccountError("createNamespace without a packageName");
|
|
653
695
|
const version = app.packageVersion ?? await latestVersion(app.registryUrl ?? "https://apps.calimero.network", app.packageName);
|
|
654
|
-
const { namespaceId } = await found(s, {
|
|
696
|
+
const { namespaceId, haEnabled, haError } = await found(s, {
|
|
655
697
|
defaultCapabilities: 231,
|
|
656
698
|
application: { applicationId: req.applicationId, package: app.packageName, version }
|
|
657
699
|
});
|
|
658
700
|
if (req.name) await group(s, namespaceId, groupMetadataSetOp({ name: req.name }));
|
|
659
|
-
return { namespaceId };
|
|
701
|
+
return { namespaceId, haEnabled, ...haError !== void 0 ? { haError } : {} };
|
|
660
702
|
},
|
|
661
703
|
async createGroupInNamespace(namespaceId, req = {}) {
|
|
662
704
|
const { op } = await subgroupCreation({ parentId: namespaceId, restricted: req.visibility !== "open", admin: s.account });
|
|
@@ -729,6 +771,22 @@ function createAccountAdmin(input, deps = {}) {
|
|
|
729
771
|
async createNamespaceInvitation(namespaceId) {
|
|
730
772
|
const [{ members }, info] = await Promise.all([relay().listGroupMembers(namespaceId), relay().getGroupInfo(namespaceId)]);
|
|
731
773
|
const relays = members.filter((m) => m.role === "RelayTee").map((m) => m.identity.toLowerCase());
|
|
774
|
+
if (routing) {
|
|
775
|
+
const named = new Set(
|
|
776
|
+
relays.length > 0 ? relays : members.filter((m) => m.role === "Admin").map((m) => m.identity.toLowerCase())
|
|
777
|
+
);
|
|
778
|
+
let nodes = null;
|
|
779
|
+
try {
|
|
780
|
+
nodes = (await routing(namespaceId)).nodes;
|
|
781
|
+
} catch {
|
|
782
|
+
}
|
|
783
|
+
if (nodes !== null) {
|
|
784
|
+
if (nodes.length === 0) throw new InvitationNotClaimableError(namespaceId, "not-hosted");
|
|
785
|
+
if (!nodes.some((n) => n.account !== null && named.has(n.account.toLowerCase()))) {
|
|
786
|
+
throw new InvitationNotClaimableError(namespaceId, "no-named-node");
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
732
790
|
const invitation = await signInvitation({
|
|
733
791
|
groupId: namespaceId,
|
|
734
792
|
inviterAccount: s.account,
|
|
@@ -1550,7 +1608,14 @@ function MeroProvider({
|
|
|
1550
1608
|
const app = { packageName, packageVersion, registryUrl };
|
|
1551
1609
|
if (delegated !== null) {
|
|
1552
1610
|
const deps = {
|
|
1553
|
-
join: (namespaceId, invitation) => joinAsAccount(delegated, namespaceId, invitation, { cloudBaseUrl, onJoined: connectWithAccount })
|
|
1611
|
+
join: (namespaceId, invitation) => joinAsAccount(delegated, namespaceId, invitation, { cloudBaseUrl, onJoined: connectWithAccount }),
|
|
1612
|
+
// Founding enables HA on the same cloud the joins resolve relays from.
|
|
1613
|
+
found: (session, req) => foundDelegatedNamespace(session, req, { cloudBaseUrl }),
|
|
1614
|
+
// Invitations are checked against the routing their claimants will use.
|
|
1615
|
+
routing: (namespaceId) => new CloudClient({
|
|
1616
|
+
cloudBaseUrl,
|
|
1617
|
+
routingCredential: { credential: delegated.credential, deviceSecret: delegated.deviceSecret }
|
|
1618
|
+
}).getNamespaceRouting(namespaceId)
|
|
1554
1619
|
};
|
|
1555
1620
|
if (delegated.relayUrl === null) return createAccountAdmin({ session: delegated, read: null, app }, deps);
|
|
1556
1621
|
if (!mero) return null;
|
|
@@ -3726,7 +3791,7 @@ function useNamespacesForApplication(applicationId) {
|
|
|
3726
3791
|
}
|
|
3727
3792
|
var DEFAULT_REGISTRY_URL = "https://apps.calimero.network";
|
|
3728
3793
|
function useCreateNamespace() {
|
|
3729
|
-
const { mero, isDelegated, app } = useMero();
|
|
3794
|
+
const { mero, isDelegated, app, cloudBaseUrl } = useMero();
|
|
3730
3795
|
const { loading, error, run } = useAsyncMutation();
|
|
3731
3796
|
const createNamespace = useCallback(
|
|
3732
3797
|
async (request) => {
|
|
@@ -3739,16 +3804,20 @@ function useCreateNamespace() {
|
|
|
3739
3804
|
throw new Error("this app names no registry package, so a founded namespace could not be given its application");
|
|
3740
3805
|
}
|
|
3741
3806
|
const version = app.packageVersion ?? await latestPublishedVersion(app.registryUrl ?? DEFAULT_REGISTRY_URL, pkg);
|
|
3742
|
-
return foundDelegatedNamespace(
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3807
|
+
return foundDelegatedNamespace(
|
|
3808
|
+
session,
|
|
3809
|
+
{
|
|
3810
|
+
defaultCapabilities: 231,
|
|
3811
|
+
application: { applicationId: request.applicationId, package: pkg, version }
|
|
3812
|
+
},
|
|
3813
|
+
{ cloudBaseUrl }
|
|
3814
|
+
);
|
|
3746
3815
|
});
|
|
3747
3816
|
}
|
|
3748
3817
|
if (!mero) return null;
|
|
3749
3818
|
return run(() => mero.admin.createNamespace(request));
|
|
3750
3819
|
},
|
|
3751
|
-
[mero, run, isDelegated, app]
|
|
3820
|
+
[mero, run, isDelegated, app, cloudBaseUrl]
|
|
3752
3821
|
);
|
|
3753
3822
|
return { createNamespace, loading, error };
|
|
3754
3823
|
}
|
|
@@ -4861,6 +4930,6 @@ function useJoinInvitation() {
|
|
|
4861
4930
|
return { joinInvitation, joining, memberships, invitationRedeemer };
|
|
4862
4931
|
}
|
|
4863
4932
|
|
|
4864
|
-
export { AccountSignInPanel, AppMode, CalimeroLogo, ConnectButton, ConnectButtonAccount, ConnectionType, DEFAULT_MIGRATION_POLL_INTERVAL_MS, LoginModal, MERO_CSS_VARS, MeroContext, MeroProvider, MigrationAdminPanel, MigrationPendingBanner, NoRelayError, NotForAccountError, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createAccountAdmin, createDelegatedContext, createNodeAdmin, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
4933
|
+
export { AccountSignInPanel, AppMode, CalimeroLogo, ConnectButton, ConnectButtonAccount, ConnectionType, DEFAULT_MIGRATION_POLL_INTERVAL_MS, HA_ACCOUNT_NOT_LINKED_MESSAGE, InvitationNotClaimableError, LoginModal, MERO_CSS_VARS, MeroContext, MeroProvider, MigrationAdminPanel, MigrationPendingBanner, NoRelayError, NotForAccountError, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createAccountAdmin, createDelegatedContext, createNodeAdmin, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
4865
4934
|
//# sourceMappingURL=index.js.map
|
|
4866
4935
|
//# sourceMappingURL=index.js.map
|