upend/tools/upend_js/types.ts

92 lines
1.5 KiB
TypeScript

export type Address = string;
export type VALUE_TYPE = "Address" | "String" | "Number" | "Invalid";
export interface IEntry {
entity: Address;
attribute: string;
value: IValue;
}
export type IValue =
| {
t: "Address";
c: string;
}
| {
t: "String";
c: string;
}
| {
t: "Number";
c: number;
}
| {
t: "Null";
c: null;
}
| {
t: "Invalid";
c: null;
};
export interface InvariantEntry {
attribute: string;
value: IValue;
}
export type InAddress =
| Address
| { t: "Attribute" | "Url" | "Uuid"; c?: string };
export type InEntry =
| IEntry
| IEntry[]
| 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;
}
export interface StoreInfo {
totals: { count: number; size: number };
blobs: {
hash: string;
size: number;
paths: { added: number; valid: boolean; path: string }[];
}[];
}