packageDocumentation module textile /**
 * Filter parameters for db subscription
 */ export interface Filter { /** The collection name */ collectionName ? : string ; /** The instance ID */ instanceID ? : string ; /** The action type: ALL (default), CREATE, SAVE, DELETE */ actionTypes ? : string [ ] ; } /**
 * Value represents a valid JSON data type.
 */ export type Value = string | boolean | number ; /**
 * JSONValue is used by the gRPC server to handle JSON data types.
 */ export interface ValueJSON { string ? : string ; bool ? : boolean ; float ? : number ; } /**
 * JSONOperation defines the set of possible operations to be used in a Query.
 */ export enum ComparisonJSON { Eq = 0 , Ne , Gt , Lt , Ge , Le } /**
 * CriterionJSON represents a single Query criteria.
 */ export interface CriterionJSON { fieldPath ? : string ; operation ? : ComparisonJSON ; value ? : ValueJSON ; query ? : QueryJSON ; } /**
 * SortJSON describes how and what field on which to sort a query.
 */ export interface SortJSON { fieldPath : string ; desc : boolean ; } /**
 * QueryJSON represents a single store Query.
 */ export interface QueryJSON { ands ? : CriterionJSON [ ] ; ors ? : QueryJSON [ ] ; sort ? : SortJSON ; seek ? : string ; limit ? : number ; skip ? : number ; index ? : string ; } hidden const valueToJSONValue = ( value ) : ValueJSON => { switch ( typeof value ) { case 'string' : return { string : value } ; case 'boolean' : return { bool : value } ; case 'number' : return { float : value } ; default : throw new Error ( 'unsupported JSON value type' ) ; } } ; /**
 * Criterion is a partial condition that can specify comparison operator for a field.
 */ export class Criterion implements CriterionJSON { constructor ( public fieldPath , public operation ? , public value ? , public query ? ) { } param value eq ( value ) { return this . create ( ComparisonJSON . Eq , value ) ; } param value ne ( value ) { return this . create ( ComparisonJSON . Ne , value ) ; } param value gt ( value ) { return this . create ( ComparisonJSON . Ne , value ) ; } param value lt ( value ) { return this . create ( ComparisonJSON . Lt , value ) ; } param value ge ( value ) { return this . create ( ComparisonJSON . Ge , value ) ; } param value le ( value ) { return this . create ( ComparisonJSON . Le , value ) ; } param op param value private create ( op , value ) { this . operation = op ; this . value = valueToJSONValue ( value ) ; if ( this . query === undefined ) { this . query = new Query ( ) ; } this . query . ands . push ( this ) ; return this . query ; } /**
     * toJSON converts the Criterion to JSONCriterion, dropping circular references to internal Queries.
     */ toJSON ( ) { const { query , ... rest } = this ; return rest ; } } /**
 * Alias Criterion to Where for a slightly nicer API (see example below)
 */ const Where = Criterion ; export { Where } ; /**
 * Query allows to build queries to be used to fetch data from a model.
 */ export class Query implements QueryJSON { public limit ? : number ; public skip ? : number ; public index ? : string ; public seek ? : string ; param ands param ors param sort constructor ( public ands = [ ] , public ors = [ ] , public sort ? ) { } param fieldPath static where ( fieldPath ) { return new Criterion ( fieldPath ) ; } param fieldPath and ( fieldPath ) { return new Criterion ( fieldPath , undefined , undefined , this ) ; } param fieldPath note useIndex ( fieldPath ) { this . index = fieldPath ; return this ; } param query or ( query ) { this . ors . push ( query ) ; return this ; } param fieldPath orderBy ( fieldPath ) { this . sort = { fieldPath , desc : false } ; return this ; } /**
     * orderByID specifies ascending ID order for the query results.
     * On multiple calls, only the last one is considered.
     */ orderByID ( ) { this . sort = { fieldPath : '_id' , desc : false } ; return this ; } param fieldPath orderByDesc ( fieldPath ) { this . sort = { fieldPath , desc : true } ; return this ; } /**
     * orderByIDDesc specifies descending ID order for the query results.
     * On multiple calls, only the last one is considered.
     */ orderByIDDesc ( ) { this . sort = { fieldPath : '_id' , desc : true } ; return this ; } param id seekID ( id ) { this . seek = id ; return this ; } param limit limitTo ( limit ) { this . limit = limit ; return this ; } param num skipNum ( num ) { this . skip = num ; return this ; } }