UNPKG

sdj-esm

Version:
115 lines (114 loc) 3.24 kB
import { ESDJ_LIMIT } from "./statics.js"; export type JIValue = JIPrimitive | JIObject | JIArray; export type ExtAllowedValue = JIValue | undefined | null; export interface JIObject { [key: string]: JIValue | undefined; } export type JIArray = JIValue[] | readonly JIValue[]; export type JIPrimitive = string | boolean | number; export declare type ArrayFlatType = number[] | string[] | boolean[]; export declare const SdjLimiterGroup: ESDJ_LIMIT[]; export interface SdKeyProps { [key: string]: JIPrimitive; } export interface NumKeyStore<Type> { [numKey: number | string]: Type; } export interface GenKeyStore<Type> { [key: string]: Type; } export declare type FuncStrNumVoid = (input: string, num?: number) => void; export declare type FuncValueInput = (inputVal: ExtAllowedValue) => JIValue | undefined; export declare type FuncJsonValueValidator = (value: JIValue) => boolean; export declare type FuncValueOutput = (value: JIValue | undefined) => ExtAllowedValue; export interface Info extends JIObject { name: string; uniqId: string; created: number; modified: number; } export interface InfoSearch { name?: string; uniqId?: string; created?: number; modified?: number; } export interface CoreSD { sdKey: string; sdId: number; } export interface CoreSDSearch extends JIObject { sdId?: number; sdKey?: string; checkData?: boolean; } export type DataKeyValue = JIValue | undefined; export type DataJIValues = Info | DataJI[] | DataKeyValue; export interface DataJI extends CoreSD, JIObject { sdInfo?: Info; sdChildren?: DataJI[]; [dataKey: string]: DataJIValues; } export interface ItemSearch extends CoreSDSearch { type?: string; limiter?: ESDJ_LIMIT; } export interface ItemJI extends CoreSD { type: string; limiter?: ESDJ_LIMIT; } export interface EntityCore { dataInfo?: boolean; sdItems?: number[]; extendIds?: number[]; parentIds?: number[]; childIds?: number[]; limiter?: ESDJ_LIMIT; sdProps?: SdKeyProps; } export interface EntityJI extends EntityCore, CoreSD { } export interface EntitySearch extends CoreSDSearch, EntityCore { } export declare type FuncLexGraphVerify = (entities: EntityJI[]) => boolean; export interface ValidatorJI { type: string; input?: FuncValueInput; valid: FuncJsonValueValidator; output?: FuncValueOutput; } export interface IValidator extends ValidatorJI { input: FuncValueInput; } export interface DescriptionJI { sdInfo: Info; items: ItemJI[]; graph: EntityJI[]; lexicons?: string[]; lang?: string; } export interface DescriptionSearch { name?: string; sdInfo?: InfoSearch; hasEntity?: EntitySearch; hasItem?: ItemSearch; usesLexicons?: string[]; lang?: string; } export interface SdJsonJI { $id: string; description: DescriptionJI; sdInfo: Info; lang?: string; data?: DataJI[]; } export declare type FuncLexDataVerify = (sdJsonJI: SdJsonJI) => boolean; export interface ILexicon { name: string; required?: string[]; entities?: EntityJI[]; items?: ItemJI[]; validators?: GenKeyStore<ValidatorJI>; graphVerify?: FuncLexGraphVerify; dataVerify?: FuncLexDataVerify; }