flex-query
Version:
The support of javascript to make query collection object
124 lines (85 loc) • 2.17 kB
TypeScript
/**
*
*@package Flex Query
*@description Integrate Support to make Query Object
*@author Oliver Valiente
*@license MIT
*@see Readme.md
*@export namespace with features
*
*/
declare namespace fq {
/**
*
*@class FlexQuery
*@description this a main item to use for import this library
*/
export class FlexQuery {
constructor(store:Object);
/**
*@method
*@description create a query listener to register evaluate and action
*/
public create(name:string) : Listener;
/**
*@method getter to Rule Propery for name
*/
public getRule(name:string) : Listener;
/**
*@method
*@description register a function to helper and use later
*/
public helper(name:string,fn:Function) : void;
/**
*@method
*@description initialize iterate collection
*/
public start(store:Array<Object>) : void;
/**
*@method
*@description get Store Object
*/
public getStore() : Object;
}
/**
*
*@interface Action
*/
export interface Action {
( target : Object, store : Object, api : ApiQuery ) : any;
}
/**
*
*@interface ApiQuery
*/
export interface ApiQuery {
setBind (source:Array<Object>) : void;
setHelpers (helpers : Object) : void;
next() : void;
getIndex() : void,
equal(path : string, value:any) : boolean;
like(path : string, value : RegExp) : boolean;
contains(path:string,value : string | Array<any>) : any;
diff(path:string, value:any) : boolean;
exist(path:string) : boolean;
resolve (path) : any,
getNext(path:string, move:boolean) : any;
register (name : string) : void;
take(name:string) : any;
make(name:string ,...args:any[]) : any;
map( fn : ( targetReference:Object, i:number, context:ApiQuery) => any ) : void;
action(path:string, fn:Function) : any;
createInstance (target:Object,index:number) : void;
index:number
}
/**
*
*@interface Listener
*@description This Interface make contract for Object Listener
*/
export interface Listener {
when(fn : Action) : Listener;
action(fn : Action) : Listener;
}
}
export = fq;