export type Address = string; export type ADDRESS_TYPE = "Hash" | "Uuid" | "Attribute" | "Url"; export type VALUE_TYPE = "Address" | "String" | "Number" | "Invalid"; export function isAddress(address: string): address is Address { return address.startsWith("@"); } /** * A single atomic entry in UpEnd. */ export interface IEntry { /** The entity this entry annotates. */ entity: Address; /** The attribute of the relation. */ attribute: string; /** The value of the attribute. */ value: IValue; /** The origin or provenance of the data entry (e.g. SYSTEM or USER API...) */ provenance: string; /** The user who created the data entry. */ user: string; /** The timestamp when the data entry was created in RFC 3339 format. */ timestamp: string; } export type IValue = | { t: "Address"; c: string; } | { t: "String"; c: string; } | { t: "Number"; c: number; } | { t: "Null"; c: null; }; export interface InvariantEntry { attribute: string; value: IValue; } export type InAddress = | Address | { t: "Attribute" | "Url" | "Uuid"; c?: string }; export type InEntry = { entity: Address; attribute: string; value: IValue; provenance?: string; }; export type PutInput = | InEntry | InEntry[] | InvariantEntry | { entity: InAddress }; export interface ListingResult { [key: string]: IEntry; } // entry address, entity address address export type PutResult = [string | undefined, string]; // export type OrderedListing = [Address, IEntry][]; export type AttributeListingResult = Array<{ name: string; labels: string[]; }>; export interface IFile { hash: string; path: string; valid: boolean; added: string; size: number; mtime: string; } export interface IJob { title: string; job_type: string; progress: number; state: "InProgress" | "Done" | "Failed"; } export interface VaultInfo { name: string | null; location: string; version: string; desktop: boolean; public: boolean; } export interface StoreInfo { totals: { count: number; size: number }; blobs: { hash: string; size: number; paths: { added: number; valid: boolean; path: string }[]; }[]; } export type EntityInfo = | { t: "Hash" | "Uuid"; } | { t: "Attribute" | "Url"; c: string; }; export interface EntityListing { entity: EntityInfo; entries: ListingResult; }