sdj-esm
Version:
Self Described JSON - ESM
79 lines (78 loc) • 3.34 kB
TypeScript
import type { DataJI, DescriptionJI, EntityJI, EntitySearch, ExtAllowedValue, FuncStrNumVoid, GenKeyStore, Info, ItemJI, ItemSearch, IValidator, NumKeyStore, SdJsonJI, SdKeyProps } from "../core/interfaces.js";
import type { ISdjHost, SdjJITypes } from "../global/global-interfaces.js";
import type { ESDJ_CLASS, ESDJ_LIMIT } from "../core/statics.js";
export declare interface IItemSdj {
readonly sdId: number;
readonly sdKey: string;
readonly type: string;
readonly limiter: ESDJ_LIMIT;
readonly validator: IValidator;
readonly description: IDescriptionSdj | undefined;
genJI: () => ItemJI;
}
export declare interface IEntitySdj {
readonly sdId: number;
readonly sdKey: string;
readonly parentIds: number[];
readonly sdItems: number[];
readonly extendIds: number[] | undefined;
readonly childIds: number[] | undefined;
readonly sdProps: SdKeyProps | undefined;
readonly dataInfo: boolean | undefined;
readonly limiter: ESDJ_LIMIT;
readonly childRefs: NumKeyStore<IEntitySdj>;
readonly itemRefs: GenKeyStore<IItemSdj>;
validStruct: (dataSdj: DataJI, parentRef: DataJI | undefined, strict?: boolean) => boolean;
validData: (dataSdj: DataJI, strict?: boolean) => boolean;
description: IDescriptionSdj;
genJI: () => EntityJI;
}
export declare interface IDataSdj {
readonly sdKey: string;
readonly sdId: number;
readonly data: DataJI;
readonly parentRef: IDataSdj | undefined;
readonly sdChildren: IDataSdj[] | undefined;
readonly hasChildren: boolean;
readonly depth: number;
readonly path: string;
readonly entity: IEntitySdj | undefined;
update: (replaceData: DataJI) => boolean;
getChild: (childRef: string | number) => IDataSdj | undefined;
isValid: () => boolean;
getDataKey: (dataKey: string) => ExtAllowedValue;
setDataKey: (dataKey: string, value: ExtAllowedValue) => void;
genJI: (withChildren?: boolean) => DataJI;
}
export declare interface IDescriptionSdj {
name: string;
graph: IEntitySdj[];
items: IItemSdj[];
sdInfo: Info;
lang: string;
readonly host: ISdjHost;
searchEntities: (searchEnt: EntitySearch) => IEntitySdj[];
searchItems: (searchItem: ItemSearch) => IItemSdj[];
getEntity: (entKeyNum: number | string) => IEntitySdj | undefined;
getEntityRefs: (entArray: number[] | string[]) => IEntitySdj[];
getItemsByEntity: (entKeyNum: string | number) => IItemSdj[];
getItem: (itemKeyNum: number | string) => IItemSdj | undefined;
getItemRefs: (itemArray: number[] | string[]) => IItemSdj[];
genJI: () => DescriptionJI;
calcSdKeyProps: (entity: IEntitySdj) => SdKeyProps;
verifyJIbyType: (ji: SdjJITypes, jiType: ESDJ_CLASS, strict?: boolean) => boolean;
log: FuncStrNumVoid;
}
export declare interface IJsonSdj {
readonly lang: string;
readonly data: IDataSdj[];
readonly description: IDescriptionSdj;
readonly sdInfo: Info;
readonly isLocked: boolean;
readonly isValid: boolean;
dataByPath: (dataPath: string) => IDataSdj | undefined;
dataByEntity: (searchEnt: EntitySearch, dataPath?: string) => IDataSdj[];
dataByItem: (searchItem: ItemSearch, dataPath?: string) => IDataSdj[];
lock: (setLock: boolean) => IDescriptionSdj | undefined;
genJI: () => SdJsonJI;
}