@codeshine/nestjs-query-core
Advanced tools
Comparing version 0.31.1 to 0.32.0-alpha.1
@@ -13,4 +13,4 @@ import { Filter, FilterFieldComparison, FilterComparisons } from '../interfaces'; | ||
export declare const isBooleanComparisonOperators: (op: unknown) => op is BooleanComparisonOperators; | ||
export declare const isComparison: <DTO, K extends keyof DTO>(maybeComparison?: (DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>) | Filter<DTO[K]> | undefined) => maybeComparison is DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>; | ||
export declare const getFilterFieldComparison: <DTO, K extends keyof DTO>(obj: FilterComparisons<DTO>, field: K) => (DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>) & { | ||
export declare const isComparison: <DTO, K extends keyof DTO>(maybeComparison?: (DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : DTO[K] extends Record<string, unknown> ? import("../interfaces").JsonFieldComparisons : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>) | Filter<DTO[K]> | undefined) => maybeComparison is DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : DTO[K] extends Record<string, unknown> ? import("../interfaces").JsonFieldComparisons : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>; | ||
export declare const getFilterFieldComparison: <DTO, K extends keyof DTO>(obj: FilterComparisons<DTO>, field: K) => (DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : DTO[K] extends Record<string, unknown> ? import("../interfaces").JsonFieldComparisons : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>) & { | ||
and?: Filter<DTO[K]>[] | undefined; | ||
@@ -24,5 +24,5 @@ or?: Filter<DTO[K]>[] | undefined; | ||
export declare const getFilterFields: <DTO>(filter: Filter<DTO>) => string[]; | ||
export declare const getFilterComparisons: <DTO, K extends keyof DTO>(filter: Filter<DTO>, key: K) => (DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>)[]; | ||
export declare const getFilterComparisons: <DTO, K extends keyof DTO>(filter: Filter<DTO>, key: K) => (DTO[K] extends string | String ? import("../interfaces").StringFieldComparisons : DTO[K] extends boolean | Boolean ? import("../interfaces").BooleanFieldComparisons : DTO[K] extends number | bigint | symbol | RegExp | Date | (string | number | bigint | boolean | symbol | RegExp | Date | null | undefined)[] ? import("../interfaces").CommonFieldComparisonType<DTO[K]> : DTO[K] extends (infer U)[] ? import("../interfaces").CommonFieldComparisonType<U> | Filter<U> : DTO[K] extends Record<string, unknown> ? import("../interfaces").JsonFieldComparisons : Filter<DTO[K]> | import("../interfaces").CommonFieldComparisonType<DTO[K]>)[]; | ||
export declare const getFilterOmitting: <DTO>(filter: Filter<DTO>, key: keyof DTO) => Filter<DTO>; | ||
export declare function applyFilter<DTO>(dto: DTO[], filter: Filter<DTO>): DTO[]; | ||
export declare function applyFilter<DTO>(dto: DTO, filter: Filter<DTO>): boolean; |
@@ -179,2 +179,9 @@ /** | ||
} | ||
export declare type JsonFieldComparisons = { | ||
[Property in keyof Pick<StringFieldComparisons, 'like'> as `path${Capitalize<Property>}`]: { | ||
path: string; | ||
} & (StringFieldComparisons[Property] extends object ? StringFieldComparisons[Property] : { | ||
value: StringFieldComparisons[Property]; | ||
}); | ||
}; | ||
declare type BuiltInTypes = boolean | boolean | string | string | number | Date | RegExp | bigint | symbol | null | undefined | never; | ||
@@ -188,3 +195,3 @@ /** | ||
*/ | ||
declare type FilterFieldComparisonType<FieldType, IsKeys extends true | false> = FieldType extends string | String ? StringFieldComparisons : FieldType extends boolean | Boolean ? BooleanFieldComparisons : FieldType extends number | Date | RegExp | bigint | BuiltInTypes[] | symbol ? CommonFieldComparisonType<FieldType> : FieldType extends Array<infer U> ? CommonFieldComparisonType<U> | Filter<U> : IsKeys extends true ? CommonFieldComparisonType<FieldType> & StringFieldComparisons & Filter<FieldType> : CommonFieldComparisonType<FieldType> | Filter<FieldType>; | ||
declare type FilterFieldComparisonType<FieldType, IsKeys extends true | false> = FieldType extends string | String ? StringFieldComparisons : FieldType extends boolean | Boolean ? BooleanFieldComparisons : FieldType extends number | Date | RegExp | bigint | BuiltInTypes[] | symbol ? CommonFieldComparisonType<FieldType> : FieldType extends Array<infer U> ? CommonFieldComparisonType<U> | Filter<U> : FieldType extends Record<string, unknown> ? JsonFieldComparisons : IsKeys extends true ? CommonFieldComparisonType<FieldType> & StringFieldComparisons & Filter<FieldType> : CommonFieldComparisonType<FieldType> | Filter<FieldType>; | ||
/** | ||
@@ -191,0 +198,0 @@ * Type for field comparisons. |
{ | ||
"name": "@codeshine/nestjs-query-core", | ||
"version": "0.31.1", | ||
"version": "0.32.0-alpha.1", | ||
"description": "Base query package", | ||
@@ -5,0 +5,0 @@ "author": "doug-martin <doug@dougamartin.com>", |
205739
2760