UNPKG

@sybil-center/zkc-preparator

Version:
51 lines (50 loc) 1.38 kB
import { GraphLink, GraphNode } from "./graph.js"; export type ZKCredential = { isr: { id: { t: number; k: string; }; }; sch: number; isd: number; exd: number; sbj: { id: { t: number; k: string; }; } & Record<string, any>; }; export type TransCredSchema = { isr: { id: { t: string[]; k: string[]; }; }; sch: string[]; isd: string[]; exd: string[]; sbj: { id: { t: string[]; k: string[]; }; } & Record<string, any>; }; export interface IPreparator { prepare<TOut extends any[] = any[], TObj extends ZKCredential = ZKCredential, TSchema extends TransCredSchema = TransCredSchema>(obj: TObj, schema: TSchema): TOut; extendGraph(node: GraphNode[], links: GraphLink[]): void; } export declare class Preparator implements IPreparator { private readonly graph; extendGraph: (nodes: GraphNode[], links: GraphLink[]) => void; prepare<TOut extends any[] = any[], TObj extends ZKCredential = ZKCredential, TSchema extends TransCredSchema = TransCredSchema>(credential: TObj, schema: TSchema): TOut; } type PathValue = { path: string[]; value: any; }; export declare function toPathValueList(obj: Record<string, any>): PathValue[]; export {};