@calimero-network/mero-react 9.3.0 → 9.4.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.d.cts CHANGED
@@ -2,7 +2,7 @@ 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 { MeroClient, MeroJs, TokenStore, CloudClient, SignedGroupOpenInvitation, InviteRedeemer, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, ClassifiedError, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RedeemOutcome, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
5
+ import { MeroClient, MeroJs, TokenStore, CloudClient, SignedGroupOpenInvitation, GovernanceOp, signGroupInvitation, AdminApiClient, InviteRedeemer, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, ClassifiedError, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RedeemOutcome, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
6
6
  export * from '@calimero-network/mero-js';
7
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
 
@@ -114,10 +114,6 @@ declare function listDelegatedContexts(s: DelegatedSession): Promise<Array<Liste
114
114
  relayUrl: string;
115
115
  }>>;
116
116
 
117
- /**
118
- * Types for mero-react
119
- */
120
-
121
117
  /**
122
118
  * Application mode determines the permission scope
123
119
  */
@@ -260,6 +256,12 @@ interface MeroContextValue {
260
256
  * later becomes available to accounts turns true here with no app change.
261
257
  */
262
258
  can: MeroCapabilities;
259
+ /**
260
+ * The admin API to write against, whatever the session: the node's own admin
261
+ * client on a node, the account admin (`createAccountAdmin`) on an account.
262
+ * `null` until connected.
263
+ */
264
+ admin: _calimero_network_mero_js.AdminApiClient | null;
263
265
  /**
264
266
  * The app's registry identity, as the provider was given it. An account
265
267
  * founding a namespace names this application for it, since a namespace
@@ -270,6 +272,8 @@ interface MeroContextValue {
270
272
  packageVersion?: string;
271
273
  registryUrl?: string;
272
274
  };
275
+ /** The cloud an account asks for routing; the hosted one when unset. */
276
+ cloudBaseUrl?: string;
273
277
  /** Logout and clear tokens */
274
278
  logout: () => void;
275
279
  /** Loading state */
@@ -287,6 +291,12 @@ interface MeroProviderConfig {
287
291
  packageVersion?: string;
288
292
  /** Registry URL (optional) */
289
293
  registryUrl?: string;
294
+ /**
295
+ * The cloud an account asks which relay serves a namespace or an account.
296
+ * Unset is the hosted cloud, which is right for every deployed app; this is
297
+ * for a local or staging setup whose namespaces the hosted cloud never saw.
298
+ */
299
+ cloudBaseUrl?: string;
290
300
  /** Request timeout in milliseconds */
291
301
  timeoutMs?: number;
292
302
  /**
@@ -317,13 +327,15 @@ interface MeroCapabilities {
317
327
  readonly createContext: boolean;
318
328
  /** Mint an invitation to a namespace. */
319
329
  readonly invite: boolean;
330
+ /** Upgrade a group's application. A node's only: a relay carries just the first choice. */
331
+ readonly upgrade: boolean;
320
332
  }
321
333
 
322
334
  declare const MeroContext: React__default.Context<MeroContextValue | null>;
323
335
  interface MeroProviderProps extends MeroProviderConfig {
324
336
  children: React__default.ReactNode;
325
337
  }
326
- declare function MeroProvider({ children, mode, packageName, packageVersion, registryUrl, timeoutMs, allowedNodeUrls, tokenStore: tokenStoreProp, }: MeroProviderProps): react_jsx_runtime.JSX.Element;
338
+ declare function MeroProvider({ children, mode, packageName, packageVersion, registryUrl, cloudBaseUrl, timeoutMs, allowedNodeUrls, tokenStore: tokenStoreProp, }: MeroProviderProps): react_jsx_runtime.JSX.Element;
327
339
  declare function useMero(): MeroContextValue;
328
340
 
329
341
  /**
@@ -988,10 +1000,117 @@ declare function createDelegatedContext(s: DelegatedSession, req: CreateDelegate
988
1000
  }): Promise<{
989
1001
  contextId: string;
990
1002
  }>;
1003
+ /**
1004
+ * Found a namespace as the account, through a relay it already uses. The
1005
+ * account becomes founder, owner and admin; the relay is seated in it (and a
1006
+ * TEE relay admits itself as its first TEE), so contexts can be created in it
1007
+ * through the same relay straight away.
1008
+ *
1009
+ * The relay's executor account cannot be asked about a namespace that does
1010
+ * not exist yet, so it is learned from one the account already has on that
1011
+ * relay. A brand-new account, in nothing yet, is told to join one first.
1012
+ */
1013
+ declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
1014
+ readonly defaultCapabilities?: number;
1015
+ /** The application the namespace runs; without one no context can be created in it. */
1016
+ readonly application?: {
1017
+ applicationId: string;
1018
+ package: string;
1019
+ version: string;
1020
+ };
1021
+ }, deps?: {
1022
+ fetch?: typeof fetch;
1023
+ }): Promise<{
1024
+ namespaceId: string;
1025
+ teeEnabled: boolean;
1026
+ }>;
1027
+
1028
+ /**
1029
+ * An account's group management through a relay: one delegated governance op
1030
+ * per call (`RelayClient.govern`), posted to the relay that serves the group's
1031
+ * namespace.
1032
+ *
1033
+ * A group op goes to the group it acts on; a root op (create, delete, move a
1034
+ * subgroup; join an open one) goes to the NAMESPACE. An account cannot read a
1035
+ * group's details, so the namespace of a subgroup is known only if this
1036
+ * account created it or was told it — remembered here per account.
1037
+ */
1038
+
1039
+ /** A group op (member, role, capabilities, metadata, visibility, detach) on `groupId`. */
1040
+ declare function governGroup(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
1041
+ groupId: string;
1042
+ }>;
1043
+ /** A root op, posted to the namespace `groupId` belongs to. */
1044
+ declare function governRoot(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
1045
+ groupId: string;
1046
+ }>;
1047
+
1048
+ /**
1049
+ * An account's admin API: the same method names and types as mero-js's
1050
+ * `AdminApiClient`, so an app written against a node's admin needs no second
1051
+ * code path. Reads go to the relay's caller-scoped admin client; writes go
1052
+ * through the relay as governance ops, delegated context and namespace
1053
+ * creation, or an invitation the account signs itself. A write with no
1054
+ * account form (upgrades, installs) is refused by name.
1055
+ */
1056
+
1057
+ declare class NotForAccountError extends Error {
1058
+ readonly method: string;
1059
+ constructor(method: string);
1060
+ }
1061
+ /**
1062
+ * An account that has enrolled but joined nothing has no relay: nothing serves
1063
+ * it yet. Its listings are empty, which is true; anything else names this.
1064
+ */
1065
+ declare class NoRelayError extends Error {
1066
+ readonly method: string;
1067
+ constructor(method: string);
1068
+ }
1069
+ interface AccountAdminDeps {
1070
+ govern?: {
1071
+ group: typeof governGroup;
1072
+ root: typeof governRoot;
1073
+ };
1074
+ createContext?: typeof createDelegatedContext;
1075
+ found?: typeof foundDelegatedNamespace;
1076
+ latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
1077
+ signInvitation?: typeof signGroupInvitation;
1078
+ }
1079
+ declare function createAccountAdmin(input: {
1080
+ session: DelegatedSession;
1081
+ read: AdminApiClient | null;
1082
+ app: {
1083
+ packageName?: string;
1084
+ packageVersion?: string;
1085
+ registryUrl?: string;
1086
+ };
1087
+ }, deps?: AccountAdminDeps): AdminApiClient;
1088
+
1089
+ /**
1090
+ * A node's admin API, as an app writes against it: mero-js's `AdminApiClient`
1091
+ * with `createNamespace` made whole. On a node a namespace can only be created
1092
+ * for an application the node already holds, so this installs the provider's
1093
+ * package from the registry first when it is missing — the step an account
1094
+ * never sees, because founding through a relay names the package and the relay
1095
+ * fetches it. Same call, same result, on both.
1096
+ */
1097
+
1098
+ interface NodeAdminDeps {
1099
+ latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
1100
+ }
1101
+ declare function createNodeAdmin(input: {
1102
+ admin: AdminApiClient;
1103
+ app: {
1104
+ packageName?: string;
1105
+ packageVersion?: string;
1106
+ registryUrl?: string;
1107
+ };
1108
+ }, deps?: NodeAdminDeps): AdminApiClient;
991
1109
 
992
1110
  interface JoinInvitationInput {
993
1111
  readonly namespaceId: string;
994
- readonly contextId: string;
1112
+ /** The context the invitation was for, when it names one; a workspace invitation names none. */
1113
+ readonly contextId?: string;
995
1114
  readonly invitation: SignedGroupOpenInvitation;
996
1115
  }
997
1116
  type JoinInvitationStep = BootstrapFailure['step'] | 'node-join';
@@ -1813,4 +1932,4 @@ declare function clearContextIdentity(): void;
1813
1932
  */
1814
1933
  declare function clearAllStorage(): void;
1815
1934
 
1816
- export { 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, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createDelegatedContext, 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, 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 };
1935
+ export { type AccountAdminDeps, 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, 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 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, 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
@@ -2,7 +2,7 @@ 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 { MeroClient, MeroJs, TokenStore, CloudClient, SignedGroupOpenInvitation, InviteRedeemer, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, ClassifiedError, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RedeemOutcome, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
5
+ import { MeroClient, MeroJs, TokenStore, CloudClient, SignedGroupOpenInvitation, GovernanceOp, signGroupInvitation, AdminApiClient, InviteRedeemer, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, ClassifiedError, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RedeemOutcome, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
6
6
  export * from '@calimero-network/mero-js';
7
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
 
@@ -114,10 +114,6 @@ declare function listDelegatedContexts(s: DelegatedSession): Promise<Array<Liste
114
114
  relayUrl: string;
115
115
  }>>;
116
116
 
117
- /**
118
- * Types for mero-react
119
- */
120
-
121
117
  /**
122
118
  * Application mode determines the permission scope
123
119
  */
@@ -260,6 +256,12 @@ interface MeroContextValue {
260
256
  * later becomes available to accounts turns true here with no app change.
261
257
  */
262
258
  can: MeroCapabilities;
259
+ /**
260
+ * The admin API to write against, whatever the session: the node's own admin
261
+ * client on a node, the account admin (`createAccountAdmin`) on an account.
262
+ * `null` until connected.
263
+ */
264
+ admin: _calimero_network_mero_js.AdminApiClient | null;
263
265
  /**
264
266
  * The app's registry identity, as the provider was given it. An account
265
267
  * founding a namespace names this application for it, since a namespace
@@ -270,6 +272,8 @@ interface MeroContextValue {
270
272
  packageVersion?: string;
271
273
  registryUrl?: string;
272
274
  };
275
+ /** The cloud an account asks for routing; the hosted one when unset. */
276
+ cloudBaseUrl?: string;
273
277
  /** Logout and clear tokens */
274
278
  logout: () => void;
275
279
  /** Loading state */
@@ -287,6 +291,12 @@ interface MeroProviderConfig {
287
291
  packageVersion?: string;
288
292
  /** Registry URL (optional) */
289
293
  registryUrl?: string;
294
+ /**
295
+ * The cloud an account asks which relay serves a namespace or an account.
296
+ * Unset is the hosted cloud, which is right for every deployed app; this is
297
+ * for a local or staging setup whose namespaces the hosted cloud never saw.
298
+ */
299
+ cloudBaseUrl?: string;
290
300
  /** Request timeout in milliseconds */
291
301
  timeoutMs?: number;
292
302
  /**
@@ -317,13 +327,15 @@ interface MeroCapabilities {
317
327
  readonly createContext: boolean;
318
328
  /** Mint an invitation to a namespace. */
319
329
  readonly invite: boolean;
330
+ /** Upgrade a group's application. A node's only: a relay carries just the first choice. */
331
+ readonly upgrade: boolean;
320
332
  }
321
333
 
322
334
  declare const MeroContext: React__default.Context<MeroContextValue | null>;
323
335
  interface MeroProviderProps extends MeroProviderConfig {
324
336
  children: React__default.ReactNode;
325
337
  }
326
- declare function MeroProvider({ children, mode, packageName, packageVersion, registryUrl, timeoutMs, allowedNodeUrls, tokenStore: tokenStoreProp, }: MeroProviderProps): react_jsx_runtime.JSX.Element;
338
+ declare function MeroProvider({ children, mode, packageName, packageVersion, registryUrl, cloudBaseUrl, timeoutMs, allowedNodeUrls, tokenStore: tokenStoreProp, }: MeroProviderProps): react_jsx_runtime.JSX.Element;
327
339
  declare function useMero(): MeroContextValue;
328
340
 
329
341
  /**
@@ -988,10 +1000,117 @@ declare function createDelegatedContext(s: DelegatedSession, req: CreateDelegate
988
1000
  }): Promise<{
989
1001
  contextId: string;
990
1002
  }>;
1003
+ /**
1004
+ * Found a namespace as the account, through a relay it already uses. The
1005
+ * account becomes founder, owner and admin; the relay is seated in it (and a
1006
+ * TEE relay admits itself as its first TEE), so contexts can be created in it
1007
+ * through the same relay straight away.
1008
+ *
1009
+ * The relay's executor account cannot be asked about a namespace that does
1010
+ * not exist yet, so it is learned from one the account already has on that
1011
+ * relay. A brand-new account, in nothing yet, is told to join one first.
1012
+ */
1013
+ declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
1014
+ readonly defaultCapabilities?: number;
1015
+ /** The application the namespace runs; without one no context can be created in it. */
1016
+ readonly application?: {
1017
+ applicationId: string;
1018
+ package: string;
1019
+ version: string;
1020
+ };
1021
+ }, deps?: {
1022
+ fetch?: typeof fetch;
1023
+ }): Promise<{
1024
+ namespaceId: string;
1025
+ teeEnabled: boolean;
1026
+ }>;
1027
+
1028
+ /**
1029
+ * An account's group management through a relay: one delegated governance op
1030
+ * per call (`RelayClient.govern`), posted to the relay that serves the group's
1031
+ * namespace.
1032
+ *
1033
+ * A group op goes to the group it acts on; a root op (create, delete, move a
1034
+ * subgroup; join an open one) goes to the NAMESPACE. An account cannot read a
1035
+ * group's details, so the namespace of a subgroup is known only if this
1036
+ * account created it or was told it — remembered here per account.
1037
+ */
1038
+
1039
+ /** A group op (member, role, capabilities, metadata, visibility, detach) on `groupId`. */
1040
+ declare function governGroup(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
1041
+ groupId: string;
1042
+ }>;
1043
+ /** A root op, posted to the namespace `groupId` belongs to. */
1044
+ declare function governRoot(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
1045
+ groupId: string;
1046
+ }>;
1047
+
1048
+ /**
1049
+ * An account's admin API: the same method names and types as mero-js's
1050
+ * `AdminApiClient`, so an app written against a node's admin needs no second
1051
+ * code path. Reads go to the relay's caller-scoped admin client; writes go
1052
+ * through the relay as governance ops, delegated context and namespace
1053
+ * creation, or an invitation the account signs itself. A write with no
1054
+ * account form (upgrades, installs) is refused by name.
1055
+ */
1056
+
1057
+ declare class NotForAccountError extends Error {
1058
+ readonly method: string;
1059
+ constructor(method: string);
1060
+ }
1061
+ /**
1062
+ * An account that has enrolled but joined nothing has no relay: nothing serves
1063
+ * it yet. Its listings are empty, which is true; anything else names this.
1064
+ */
1065
+ declare class NoRelayError extends Error {
1066
+ readonly method: string;
1067
+ constructor(method: string);
1068
+ }
1069
+ interface AccountAdminDeps {
1070
+ govern?: {
1071
+ group: typeof governGroup;
1072
+ root: typeof governRoot;
1073
+ };
1074
+ createContext?: typeof createDelegatedContext;
1075
+ found?: typeof foundDelegatedNamespace;
1076
+ latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
1077
+ signInvitation?: typeof signGroupInvitation;
1078
+ }
1079
+ declare function createAccountAdmin(input: {
1080
+ session: DelegatedSession;
1081
+ read: AdminApiClient | null;
1082
+ app: {
1083
+ packageName?: string;
1084
+ packageVersion?: string;
1085
+ registryUrl?: string;
1086
+ };
1087
+ }, deps?: AccountAdminDeps): AdminApiClient;
1088
+
1089
+ /**
1090
+ * A node's admin API, as an app writes against it: mero-js's `AdminApiClient`
1091
+ * with `createNamespace` made whole. On a node a namespace can only be created
1092
+ * for an application the node already holds, so this installs the provider's
1093
+ * package from the registry first when it is missing — the step an account
1094
+ * never sees, because founding through a relay names the package and the relay
1095
+ * fetches it. Same call, same result, on both.
1096
+ */
1097
+
1098
+ interface NodeAdminDeps {
1099
+ latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
1100
+ }
1101
+ declare function createNodeAdmin(input: {
1102
+ admin: AdminApiClient;
1103
+ app: {
1104
+ packageName?: string;
1105
+ packageVersion?: string;
1106
+ registryUrl?: string;
1107
+ };
1108
+ }, deps?: NodeAdminDeps): AdminApiClient;
991
1109
 
992
1110
  interface JoinInvitationInput {
993
1111
  readonly namespaceId: string;
994
- readonly contextId: string;
1112
+ /** The context the invitation was for, when it names one; a workspace invitation names none. */
1113
+ readonly contextId?: string;
995
1114
  readonly invitation: SignedGroupOpenInvitation;
996
1115
  }
997
1116
  type JoinInvitationStep = BootstrapFailure['step'] | 'node-join';
@@ -1813,4 +1932,4 @@ declare function clearContextIdentity(): void;
1813
1932
  */
1814
1933
  declare function clearAllStorage(): void;
1815
1934
 
1816
- export { 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, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createDelegatedContext, 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, 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 };
1935
+ export { type AccountAdminDeps, 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, 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 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, 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 };