@deboxsoft/module-core
Advanced tools
Comparing version 2.6.7 to 2.6.8
@@ -594,2 +594,41 @@ import { z, ZodType } from 'zod'; | ||
declare type RegExpOrString<T> = T extends string ? RegExp | T : T; | ||
declare type AlternativeType<T> = T extends ReadonlyArray<infer U> ? T | RegExpOrString<U> : RegExpOrString<T>; | ||
interface FilterOperators<TValue> { | ||
$eq?: TValue; | ||
$gt?: TValue; | ||
$gte?: TValue; | ||
$in?: ReadonlyArray<TValue>; | ||
$lt?: TValue; | ||
$lte?: TValue; | ||
$ne?: TValue; | ||
$nin?: ReadonlyArray<TValue>; | ||
$not?: TValue extends string ? FilterOperators<TValue> | RegExp : FilterOperators<TValue>; | ||
$regex?: TValue extends string ? RegExp | string : never; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
declare type PropertyType<Type, Property extends string> = string extends Property ? unknown : Property extends keyof Type ? Type[Property] : Property extends `${number}` ? Type extends ReadonlyArray<infer ArrayType> ? ArrayType : unknown : Property extends `${infer Key}.${infer Rest}` ? Key extends `${number}` ? Type extends ReadonlyArray<infer ArrayType> ? PropertyType<ArrayType, Rest> : unknown : Key extends keyof Type ? Type[Key] extends Map<string, infer MapType> ? MapType : PropertyType<Type[Key], Rest> : unknown : unknown; | ||
/** | ||
* @public | ||
* returns tuple of strings (keys to be joined on '.') that represent every path into a schema | ||
*/ | ||
declare type NestedPaths<Type> = Type extends string | number | boolean | Date | RegExp | ((...args: any[]) => any) ? [] : Type extends ReadonlyArray<infer ArrayType> ? [] | [number, ...NestedPaths<ArrayType>] : Type extends Map<string, any> ? [string] : Type extends object ? { | ||
[Key in Extract<keyof Type, string>]: Type[Key] extends Type ? [Key] : Type extends Type[Key] ? [Key] : Type[Key] extends ReadonlyArray<infer ArrayType> ? Type extends ArrayType ? [Key] : ArrayType extends Type ? [Key] : [Key, ...NestedPaths<Type[Key]>] : [Key, ...NestedPaths<Type[Key]>] | [Key]; | ||
}[Extract<keyof Type, string>] : []; | ||
declare type FilterCondition<T> = AlternativeType<T> | FilterOperators<AlternativeType<T>>; | ||
/** | ||
* Helper types for dot-notation filter attributes | ||
*/ | ||
declare type Join<T extends unknown[], D extends string> = T extends [] ? "" : T extends [string | number] ? `${T[0]}` : T extends [string | number, ...infer R] ? `${T[0]}${D}${Join<R, D>}` : string; | ||
declare type RootFilterOperators<T> = { | ||
$and?: Filter<T>[]; | ||
$nor?: Filter<T>[]; | ||
$or?: Filter<T>[]; | ||
}; | ||
declare type Filter<T> = Partial<T> | ({ | ||
[Property in Join<NestedPaths<T>, ".">]?: FilterCondition<PropertyType<T, Property>>; | ||
} & RootFilterOperators<T>); | ||
declare type ModuleConfig = { | ||
@@ -604,2 +643,2 @@ errors: { | ||
export { AppConfig, BooleanResponse, CONFIG_KEY, Config, Container, DateSchema, DbxError, DbxErrorOptions, IdParams, IdSchema, LOGGER_KEY, Logger, MakeSchema, ModuleConfig, NotificationType, NumberResponse, PageCursorInfo, PageCursorParams, PageCursorParamsOutput, PageDefaultInfo, PageDefaultParams, PageDefaultParamsOutput, PageInfo, PageParams, Pagination, PaginationOptions, PaginationOptionsOutput, PaginationType, RangeDate, RangeDateSchema, StringResponse, TimeStampSchema, clamp, cloneDeep, createLoggerConsole, dayTimeZone, debounce, getAppConfig, getConfig, getLogger, getRangeDate, isEmpty, isObject, isPlainObject, isString, isStringAndNotBlank, isStringBlank, kindOf, makeSchemaResponse, omit, pickBy, pull, throttle, transformDefaultPageInfo }; | ||
export { AlternativeType, AppConfig, BooleanResponse, CONFIG_KEY, Config, Container, DateSchema, DbxError, DbxErrorOptions, Filter, FilterCondition, FilterOperators, IdParams, IdSchema, Join, LOGGER_KEY, Logger, MakeSchema, ModuleConfig, NestedPaths, NotificationType, NumberResponse, PageCursorInfo, PageCursorParams, PageCursorParamsOutput, PageDefaultInfo, PageDefaultParams, PageDefaultParamsOutput, PageInfo, PageParams, Pagination, PaginationOptions, PaginationOptionsOutput, PaginationType, PropertyType, RangeDate, RangeDateSchema, RegExpOrString, RootFilterOperators, StringResponse, TimeStampSchema, clamp, cloneDeep, createLoggerConsole, dayTimeZone, debounce, getAppConfig, getConfig, getLogger, getRangeDate, isEmpty, isObject, isPlainObject, isString, isStringAndNotBlank, isStringBlank, kindOf, makeSchemaResponse, omit, pickBy, pull, throttle, transformDefaultPageInfo }; |
{ | ||
"name": "@deboxsoft/module-core", | ||
"version": "2.6.7", | ||
"version": "2.6.8", | ||
"license": "SEE LICENSE IN LICENSE", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72767
2185