/** * @module cosmos-helpers * * Helper functions for CosmosIbGib: genesis, ib parsing/validation, * and member galaxy soft-link management. */ import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs'; import { MetaspaceService } from '../../witness/space/metaspace/metaspace-types.mjs'; import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs'; import { CosmosIbGib_V1, CosmosIb_V1, CosmosGalaxyEntry, PermissionPolicy } from './cosmos-types.mjs'; import { SpaceQualifiedIbGibAddr } from '../../common/other/ibgib-types.mjs'; import { GalaxyIbGib_V1 } from '../galaxy/galaxy-types.mjs'; /** * Validates whether a given string is a valid cosmos name. * Enforces URL-safe naming without whitespace. */ export declare function validateCosmosName(name: string): boolean; /** * Builds canonical cosmos ib string: `cosmos `. */ export declare function getCosmosIb({ cosmosName }: { cosmosName: string; }): string; /** * Parses a cosmos ib string into its constituent parts. */ export declare function parseCosmosIb({ ib }: { ib: string; }): Promise; /** * Validates whether an ib string corresponds to a valid cosmos ib. */ export declare function validateCosmosIb({ ib }: { ib: string; }): Promise; /** * Type guard for CosmosIbGib_V1. */ export declare function isCosmos(ibGib?: IbGib_V1 | null): ibGib is CosmosIbGib_V1; export interface CreateCosmosIbGibOpts { cosmosName: string; description?: string; ownerKeystoneTjp?: string; space: IbGibSpaceAny; metaspace?: MetaspaceService; } /** * Creates a new genesis CosmosIbGib in the given space, optionally relating it * to the metaspace special anchor. */ export declare function createCosmosIbGib({ cosmosName, description, ownerKeystoneTjp, space, metaspace, }: CreateCosmosIbGibOpts): Promise; /** * Returns the soft-linked member galaxy addresses from a CosmosIbGib. */ export declare function getGalaxyAddrsFromCosmos(cosmosIbGib: CosmosIbGib_V1): SpaceQualifiedIbGibAddr[]; export interface AddGalaxyToCosmosOpts { cosmosIbGib: CosmosIbGib_V1; sqGalaxyAddr: SpaceQualifiedIbGibAddr; galaxyEntry?: CosmosGalaxyEntry; galaxyIbGib?: GalaxyIbGib_V1; space: IbGibSpaceAny; metaspace?: MetaspaceService; } /** * Adds a member galaxy to a cosmos timeline, registering both its soft-link address * and its metadata entry in the galaxies dictionary for O(1) manifest retrieval. */ export declare function addGalaxyToCosmos({ cosmosIbGib, sqGalaxyAddr, galaxyEntry, galaxyIbGib, space, metaspace, }: AddGalaxyToCosmosOpts): Promise; /** * Retrieves the registered galaxy manifest entry for a galaxy name from CosmosData_V1. */ export declare function getGalaxyInfoFromCosmos(cosmosIbGib: CosmosIbGib_V1, galaxyName: string): CosmosGalaxyEntry | undefined; /** * Returns all registered member galaxy entries from the Cosmos manifest. */ export declare function getGalaxiesFromCosmos(cosmosIbGib: CosmosIbGib_V1): CosmosGalaxyEntry[]; /** * Retrieves the owner keystone primary TJP address from a CosmosIbGib, if present. */ export declare function getOwnerKeystoneTjp(cosmosIbGib: CosmosIbGib_V1): string | undefined; /** * Retrieves the permission policy governing a specific galaxy or branch in the cosmos. * Looks for exact match on galaxyName and/or branchName, returning undefined if no policy is set. */ export declare function getPermissionPolicy({ cosmosIbGib, galaxyName, branchName, }: { cosmosIbGib: CosmosIbGib_V1; galaxyName?: string; branchName?: string; }): PermissionPolicy | undefined; /** * Evaluates whether a candidate keystone is authorized to post or commit to a galaxy/branch. */ export declare function isAuthorizedToPost({ cosmosIbGib, galaxyName, branchName, candidateKeystoneTjp, }: { cosmosIbGib: CosmosIbGib_V1; galaxyName?: string; branchName?: string; candidateKeystoneTjp?: string; }): { isAuthorized: boolean; reason?: string; requiresModeration?: boolean; }; /** * Sets or updates a PermissionPolicy in the CosmosIbGib's permissions array. */ export declare function setPermissionPolicy({ cosmosIbGib, policy, space, metaspace, }: { cosmosIbGib: CosmosIbGib_V1; policy: PermissionPolicy; space: IbGibSpaceAny; metaspace?: MetaspaceService; }): Promise; /** * Retrieves all CosmosIbGib instances registered under the special cosmos anchor in space. */ export declare function getAllCosmoses({ metaspace, space, }: { metaspace: MetaspaceService; space: IbGibSpaceAny; }): Promise; /** * Retrieves a registered CosmosIbGib by its cosmosName from space. */ export declare function getCosmosByName({ metaspace, space, cosmosName, }: { metaspace: MetaspaceService; space: IbGibSpaceAny; cosmosName: string; }): Promise; //# sourceMappingURL=cosmos-helpers.d.mts.map