@poap-xyz/utils
Advanced tools
Comparing version 0.2.1-beta-v3 to 0.2.1-beta-v4
@@ -1,37 +0,9 @@ | ||
export declare function createLikeFilter(key: string, value?: string): { | ||
[key: string]: { | ||
_ilike: string; | ||
}; | ||
}; | ||
export declare function createEqFilter(key: string, value?: string | number): { | ||
[key: string]: { | ||
_eq: string | number; | ||
}; | ||
}; | ||
export declare function createNeqFilter(key: string, value?: string | number): { | ||
[key: string]: { | ||
_neq: string | number; | ||
}; | ||
}; | ||
export declare function createBoolFilter(key: string, value?: boolean): { | ||
[key: string]: { | ||
_eq: 'true' | 'false'; | ||
}; | ||
}; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): { | ||
[key: string]: { | ||
_neq?: string; | ||
_eq?: string; | ||
}; | ||
}; | ||
export declare function createInFilter(key: string, values?: Array<string | number>): { | ||
[key: string]: { | ||
_in: Array<string | number>; | ||
}; | ||
}; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): { | ||
[key: string]: { | ||
_gte?: string; | ||
_lte?: string; | ||
}; | ||
}; | ||
import { EqFilter, FieldFilter, GteFilter, InFilter, LikeFilter, LteFilter, NeqFilter, NinFilter } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: string): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: string | number): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: string | number): FieldFilter<NeqFilter>; | ||
export declare function createBoolFilter(key: string, value?: boolean): FieldFilter<EqFilter<'true' | 'false'>>; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter> & Partial<NeqFilter>>; | ||
export declare function createInFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<NinFilter>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; |
@@ -1,12 +0,34 @@ | ||
interface FieldFilter { | ||
[key: string]: { | ||
_eq?: string | number | boolean; | ||
_neq?: string | number | boolean; | ||
_ilike?: string; | ||
_in?: Array<string | number | boolean>; | ||
_gte?: string; | ||
_lte?: string; | ||
}; | ||
type Value = string | number | boolean; | ||
export interface EqFilter<V = Value> { | ||
_eq: V; | ||
} | ||
interface ConditionFilter { | ||
export interface NeqFilter<V = Value> { | ||
_neq: V; | ||
} | ||
export interface LikeFilter<V = Value> { | ||
_ilike: V; | ||
} | ||
export interface InFilter<V = Value> { | ||
_in: Array<V>; | ||
} | ||
export interface NinFilter<V = Value> { | ||
_nin: Array<V>; | ||
} | ||
export interface GtFilter<V = Value> { | ||
_gt: V; | ||
} | ||
export interface GteFilter<V = Value> { | ||
_gte: V; | ||
} | ||
export interface LtFilter<V = Value> { | ||
_lt: V; | ||
} | ||
export interface LteFilter<V = Value> { | ||
_lte: V; | ||
} | ||
export type AnyFilter = Partial<EqFilter> & Partial<NeqFilter> & Partial<LikeFilter> & Partial<InFilter> & Partial<NinFilter> & Partial<GtFilter> & Partial<GteFilter> & Partial<LtFilter> & Partial<LteFilter>; | ||
export type FieldFilter<F = AnyFilter> = { | ||
[key: string]: F; | ||
}; | ||
export interface ConditionFilter { | ||
_or?: Filter[]; | ||
@@ -16,3 +38,3 @@ _and?: Filter[]; | ||
} | ||
type Filter = FieldFilter | ConditionFilter | { | ||
export type Filter = FieldFilter | ConditionFilter | { | ||
[key: string]: Filter; | ||
@@ -19,0 +41,0 @@ }; |
@@ -1,37 +0,9 @@ | ||
export declare function createLikeFilter(key: string, value?: string): { | ||
[key: string]: { | ||
_ilike: string; | ||
}; | ||
}; | ||
export declare function createEqFilter(key: string, value?: string | number): { | ||
[key: string]: { | ||
_eq: string | number; | ||
}; | ||
}; | ||
export declare function createNeqFilter(key: string, value?: string | number): { | ||
[key: string]: { | ||
_neq: string | number; | ||
}; | ||
}; | ||
export declare function createBoolFilter(key: string, value?: boolean): { | ||
[key: string]: { | ||
_eq: 'true' | 'false'; | ||
}; | ||
}; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): { | ||
[key: string]: { | ||
_neq?: string; | ||
_eq?: string; | ||
}; | ||
}; | ||
export declare function createInFilter(key: string, values?: Array<string | number>): { | ||
[key: string]: { | ||
_in: Array<string | number>; | ||
}; | ||
}; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): { | ||
[key: string]: { | ||
_gte?: string; | ||
_lte?: string; | ||
}; | ||
}; | ||
import { EqFilter, FieldFilter, GteFilter, InFilter, LikeFilter, LteFilter, NeqFilter, NinFilter } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: string): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: string | number): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: string | number): FieldFilter<NeqFilter>; | ||
export declare function createBoolFilter(key: string, value?: boolean): FieldFilter<EqFilter<'true' | 'false'>>; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter> & Partial<NeqFilter>>; | ||
export declare function createInFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<NinFilter>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; |
@@ -1,12 +0,34 @@ | ||
interface FieldFilter { | ||
[key: string]: { | ||
_eq?: string | number | boolean; | ||
_neq?: string | number | boolean; | ||
_ilike?: string; | ||
_in?: Array<string | number | boolean>; | ||
_gte?: string; | ||
_lte?: string; | ||
}; | ||
type Value = string | number | boolean; | ||
export interface EqFilter<V = Value> { | ||
_eq: V; | ||
} | ||
interface ConditionFilter { | ||
export interface NeqFilter<V = Value> { | ||
_neq: V; | ||
} | ||
export interface LikeFilter<V = Value> { | ||
_ilike: V; | ||
} | ||
export interface InFilter<V = Value> { | ||
_in: Array<V>; | ||
} | ||
export interface NinFilter<V = Value> { | ||
_nin: Array<V>; | ||
} | ||
export interface GtFilter<V = Value> { | ||
_gt: V; | ||
} | ||
export interface GteFilter<V = Value> { | ||
_gte: V; | ||
} | ||
export interface LtFilter<V = Value> { | ||
_lt: V; | ||
} | ||
export interface LteFilter<V = Value> { | ||
_lte: V; | ||
} | ||
export type AnyFilter = Partial<EqFilter> & Partial<NeqFilter> & Partial<LikeFilter> & Partial<InFilter> & Partial<NinFilter> & Partial<GtFilter> & Partial<GteFilter> & Partial<LtFilter> & Partial<LteFilter>; | ||
export type FieldFilter<F = AnyFilter> = { | ||
[key: string]: F; | ||
}; | ||
export interface ConditionFilter { | ||
_or?: Filter[]; | ||
@@ -16,3 +38,3 @@ _and?: Filter[]; | ||
} | ||
type Filter = FieldFilter | ConditionFilter | { | ||
export type Filter = FieldFilter | ConditionFilter | { | ||
[key: string]: Filter; | ||
@@ -19,0 +41,0 @@ }; |
@@ -68,2 +68,5 @@ (function (global, factory) { | ||
} | ||
function createNinFilter(key, values) { | ||
return values && values.length ? { [key]: { _nin: values } } : {}; | ||
} | ||
function createBetweenFilter(key, from, to) { | ||
@@ -106,2 +109,3 @@ const betweenFilter = {}; | ||
exports.createNeqFilter = createNeqFilter; | ||
exports.createNinFilter = createNinFilter; | ||
exports.createOrderBy = createOrderBy; | ||
@@ -108,0 +112,0 @@ exports.isNumeric = isNumeric; |
@@ -1,37 +0,9 @@ | ||
export declare function createLikeFilter(key: string, value?: string): { | ||
[key: string]: { | ||
_ilike: string; | ||
}; | ||
}; | ||
export declare function createEqFilter(key: string, value?: string | number): { | ||
[key: string]: { | ||
_eq: string | number; | ||
}; | ||
}; | ||
export declare function createNeqFilter(key: string, value?: string | number): { | ||
[key: string]: { | ||
_neq: string | number; | ||
}; | ||
}; | ||
export declare function createBoolFilter(key: string, value?: boolean): { | ||
[key: string]: { | ||
_eq: 'true' | 'false'; | ||
}; | ||
}; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): { | ||
[key: string]: { | ||
_neq?: string; | ||
_eq?: string; | ||
}; | ||
}; | ||
export declare function createInFilter(key: string, values?: Array<string | number>): { | ||
[key: string]: { | ||
_in: Array<string | number>; | ||
}; | ||
}; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): { | ||
[key: string]: { | ||
_gte?: string; | ||
_lte?: string; | ||
}; | ||
}; | ||
import { EqFilter, FieldFilter, GteFilter, InFilter, LikeFilter, LteFilter, NeqFilter, NinFilter } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: string): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: string | number): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: string | number): FieldFilter<NeqFilter>; | ||
export declare function createBoolFilter(key: string, value?: boolean): FieldFilter<EqFilter<'true' | 'false'>>; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter> & Partial<NeqFilter>>; | ||
export declare function createInFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<NinFilter>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; |
@@ -1,12 +0,34 @@ | ||
interface FieldFilter { | ||
[key: string]: { | ||
_eq?: string | number | boolean; | ||
_neq?: string | number | boolean; | ||
_ilike?: string; | ||
_in?: Array<string | number | boolean>; | ||
_gte?: string; | ||
_lte?: string; | ||
}; | ||
type Value = string | number | boolean; | ||
export interface EqFilter<V = Value> { | ||
_eq: V; | ||
} | ||
interface ConditionFilter { | ||
export interface NeqFilter<V = Value> { | ||
_neq: V; | ||
} | ||
export interface LikeFilter<V = Value> { | ||
_ilike: V; | ||
} | ||
export interface InFilter<V = Value> { | ||
_in: Array<V>; | ||
} | ||
export interface NinFilter<V = Value> { | ||
_nin: Array<V>; | ||
} | ||
export interface GtFilter<V = Value> { | ||
_gt: V; | ||
} | ||
export interface GteFilter<V = Value> { | ||
_gte: V; | ||
} | ||
export interface LtFilter<V = Value> { | ||
_lt: V; | ||
} | ||
export interface LteFilter<V = Value> { | ||
_lte: V; | ||
} | ||
export type AnyFilter = Partial<EqFilter> & Partial<NeqFilter> & Partial<LikeFilter> & Partial<InFilter> & Partial<NinFilter> & Partial<GtFilter> & Partial<GteFilter> & Partial<LtFilter> & Partial<LteFilter>; | ||
export type FieldFilter<F = AnyFilter> = { | ||
[key: string]: F; | ||
}; | ||
export interface ConditionFilter { | ||
_or?: Filter[]; | ||
@@ -16,3 +38,3 @@ _and?: Filter[]; | ||
} | ||
type Filter = FieldFilter | ConditionFilter | { | ||
export type Filter = FieldFilter | ConditionFilter | { | ||
[key: string]: Filter; | ||
@@ -19,0 +41,0 @@ }; |
{ | ||
"name": "@poap-xyz/utils", | ||
"version": "0.2.1-beta-v3", | ||
"version": "0.2.1-beta-v4", | ||
"description": "Utils module for the poap.js library", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48365
613