export type Frame = import('../typedef').Frame; /** * @typedef {import('../typedef').Frame} Frame */ /** * @file Frame Rule * @license Apache Version 2 */ export function FrameRule(): void; export class FrameRule { pattern: FramePattern; /** * Returns an array of rules that match the paased frame * @param {[FrameRule]} rules - array of rules to be tested * @param {Frame | object} frame - document frame, object frame, or property frame to be tested * @param {function} [onmatch] - optional function to be called with args (frame, rule) * on each match */ testRules(rules: [FrameRule], frame: Frame | object, onmatch?: Function): FrameRule[]; /** * Determines whether a given pattern matches a given frame */ patternMatchesFrame(pattern: any, frame: any): any; /** * Specifies that only one from among the list of properties will match */ property(...prop: any[]): any; /** * Specifies that only one from among the list of frame_types will match * frame_types are: data, oneOf, document, object? */ frame_type(...frame_type: any[]): any; /** * Specifies that only one from among the list of labels will match */ label(...prop: any[]): any; /** * Specifies that only one from among the list of subject ids will match */ subject(...prop: any[]): any; /** * Specifies that only one from among the list of subject classes will match */ subjectClass(...prop: any[]): any; /** * Specifies that only one from among the list of range types will match */ range(...prop: any[]): any; /** * Specifies that only one from among the list of range types will match */ value(...prop: any[]): any; /** * Specifies that only frames of the specified depth will match the rule */ depth(depth: any): any; /** * Specifies that only frames of the specified index will match the rule (index is the order of a * value in the property frame) */ index(...index: any[]): any; /** * Specifies that only frames with the given statuses will match the rule */ status(...status: any[]): any; /** * Specifies that the frame will only match if its parent matches the pattern passed as par */ parent(par: any): any; children(...children: any[]): any[] | FrameRule; } /** * @file Frame Pattern * A frame pattern can have the following variables * scope : object, property, data, * - matches a specific part of the frame * label : matches the label of a property * frame_type: object, data, document, id, oneOf * subject: id of the subject * subjectClass: class of the subject * range: type of a property (applies to property and data) * property: property id or list of property ids (parent property if it is an object or data) * value: value of the property * parent: a pattern relating to the parent of this frame * children: patterns for matching on the children of a frame * depth: how deep are we in the document? starts from 0 * index: the index of a value in an array * status: updated, error, new, ok, */ export function FramePattern(): void; export class FramePattern { setPattern(pattern: any): void; scope: any; literal: any; type: any; label: any; frame_type: any; subject: any; subjectClass: any; range: any; property: any; value: any; parent: any; children: any[]; depth: any; index: any; status: any; json(): { literal: any; type: any; scope: any; value: any; label: any; frame_type: any; subject: any; subjectClass: any; range: any; property: any; parent: any; children: any[]; depth: any; index: any; status: any; }; checkFrame(frame: any): boolean; prettyPrint(): string; illegalRuleType(rtype: any): boolean; checkSubject(subject: any, frame: any): boolean; checkChildren(rtype: any, frame: any): boolean; checkStatus(rtype: any, frame: any): boolean; checkDepth(rtype: any, frame: any): any; checkParent(rtype: any, frame: any): any; checkIndex(rtype: any, frame: any): boolean; checkProperty(rtype: any, frame: any): boolean; /** * Checks to make sure the frame is among the specified types */ checkType(rtype: any, frame: any): boolean; checkLiteral(rtype: any, frame: any): any; checkValue(rtype: any, frame: any): boolean; checkRange(rtype: any, frame: any): boolean; checkSubjectClass(rtype: any, frame: any): boolean; checkFrameType(rtype: any, frame: any): boolean; checkLabel(rtype: any, frame: any): boolean; getRendererType(frame: any): any; }