/// import type { JSONValue, Opaque } from '../types.js'; import type { IdentityId, ProviderId, GestaltIdEncoded, ProviderIdentityClaimId, NodeId, GestaltLinkId } from '../ids/types.js'; import type { SignedClaim, SignedClaimJSON } from '../claims/types.js'; import type { ClaimLinkIdentity, ClaimLinkNode } from '../claims/payloads/index.js'; import type { ProviderPaginationToken } from '../identities/types.js'; declare const gestaltActions: readonly ["notify", "scan", "claim", "join"]; type GestaltKey = Opaque<'GestaltKey', Buffer>; type GestaltInfo = ['node', GestaltNodeInfo] | ['identity', GestaltIdentityInfo]; type GestaltNodeInfo = { nodeId: NodeId; [key: string]: JSONValue | undefined; }; /** * Storing `GestaltNodeInfo` into `GestaltGraph` requries JSON serialisation. * The `nodeId` is a `IdInternal`, which will be converted to JSON and back. */ interface GestaltNodeInfoJSON extends Omit { nodeId: { type: 'IdInternal'; data: Array; }; } type GestaltIdentityInfo = { providerId: ProviderId; identityId: IdentityId; name?: string; email?: string; url?: string; /** * Used to determine the last pagination token to resume * from when discovering the identity vertex */ lastProviderPaginationToken?: ProviderPaginationToken; [key: string]: JSONValue | undefined; }; /** * Links are edges between node and identity vertexes. * The data within these links would be acquired by discovery. */ type GestaltLink = ['node', GestaltLinkNode] | ['identity', GestaltLinkIdentity]; type GestaltLinkJSON = ['node', GestaltLinkNodeJSON] | ['identity', GestaltLinkIdentityJSON]; /** * Linking node to node. * The only data required is the `SignedClaim` */ type GestaltLinkNode = { id: GestaltLinkId; claim: SignedClaim; meta: { [key: string]: JSONValue | undefined; }; }; type GestaltLinkNodeJSON = Omit & { id: { type: 'IdInternal'; data: Array; }; claim: SignedClaimJSON; }; /** * Link node to identity. * The `SignedClaim` is wrapped in `IdentitySignedClaim`. * This provides additional metadata outside of the the `SignedClaim`. */ type GestaltLinkIdentity = { id: GestaltLinkId; claim: SignedClaim; meta: { providerIdentityClaimId: ProviderIdentityClaimId; url?: string; [key: string]: JSONValue | undefined; }; }; type GestaltLinkIdentityJSON = Omit & { id: { type: 'IdInternal'; data: Array; }; claim: SignedClaimJSON; }; type GestaltLinks = Record; type GestaltMatrix = Record; type GestaltNodes = Record; type GestaltIdentities = Record; type Gestalt = { matrix: GestaltMatrix; nodes: GestaltNodes; identities: GestaltIdentities; }; type GestaltAction = (typeof gestaltActions)[number]; type GestaltActions = Partial>; export { gestaltActions }; export type { GestaltKey, GestaltInfo, GestaltNodeInfo, GestaltNodeInfoJSON, GestaltIdentityInfo, GestaltLink, GestaltLinkJSON, GestaltLinkNode, GestaltLinkNodeJSON, GestaltLinkIdentity, GestaltLinkIdentityJSON, GestaltLinks, GestaltMatrix, GestaltNodes, GestaltIdentities, Gestalt, GestaltAction, GestaltActions, }; export type { GestaltId, GestaltIdEncoded, GestaltLinkId, GestaltLinkIdString, } from '../ids/types.js';