@trapi/query
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.2
import { FieldsBuildInput, FiltersBuildInput, PaginationBuildInput, RelationsBuildInput, SortBuildInput } from "../../parameter"; | ||
import { Parameter, URLParameter } from "../../type"; | ||
export declare type BuildParameterInput<T extends Parameter | URLParameter, R extends Record<string, any>> = T extends Parameter.FIELDS | URLParameter.FIELDS ? FieldsBuildInput<R> : T extends Parameter.FILTERS | URLParameter.FILTERS ? FiltersBuildInput<R> : T extends Parameter.RELATIONS | URLParameter.RELATIONS ? RelationsBuildInput<R> : T extends Parameter.PAGINATION | URLParameter.PAGINATION ? PaginationBuildInput<R> : T extends Parameter.SORT | URLParameter.SORT ? SortBuildInput<R> : never; | ||
import { ParameterFieldsType, ParameterFiltersType, ParameterPaginationType, ParameterRelationsType, ParameterSortType, ParameterType, URLParameterFieldsType, URLParameterFiltersType, URLParameterPaginationType, URLParameterRelationsType, URLParameterSortType, URLParameterType } from "../../type"; | ||
export declare type BuildParameterInput<T extends ParameterType | URLParameterType, R extends Record<string, any>> = T extends ParameterFieldsType | URLParameterFieldsType ? FieldsBuildInput<R> : T extends ParameterFiltersType | URLParameterFiltersType ? FiltersBuildInput<R> : T extends ParameterRelationsType | URLParameterRelationsType ? RelationsBuildInput<R> : T extends ParameterPaginationType | URLParameterPaginationType ? PaginationBuildInput<R> : T extends ParameterSortType | URLParameterSortType ? SortBuildInput<R> : T; | ||
//# sourceMappingURL=type.d.ts.map |
@@ -1,7 +0,7 @@ | ||
import { Parameter, URLParameter } from "../type"; | ||
import { ParameterType, URLParameterType } from "../type"; | ||
import { BuildParameterInput } from "./parameter"; | ||
export declare type BuildOptions = {}; | ||
export declare type BuildInput<V extends Record<string, any>> = { | ||
[T in Parameter | URLParameter]?: BuildParameterInput<T, V>; | ||
[T in ParameterType | URLParameterType]?: BuildParameterInput<T, V>; | ||
}; | ||
//# sourceMappingURL=type.d.ts.map |
@@ -6,5 +6,5 @@ import { FieldsParseOptions, FieldsParseOutput } from "../../parameter"; | ||
import { SortParseOptions, SortParseOutput } from "../../parameter"; | ||
import { Parameter, ParameterType, URLParameter, URLParameterType } from "../../type"; | ||
export declare type ParseParameterOptions<T extends ParameterType | URLParameterType> = T extends Parameter.FIELDS | URLParameter.FIELDS ? FieldsParseOptions : T extends Parameter.FILTERS | URLParameter.FILTERS ? FiltersParseOptions : T extends Parameter.RELATIONS | URLParameter.RELATIONS ? RelationsParseOptions : T extends Parameter.PAGINATION | URLParameter.PAGINATION ? PaginationParseOptions : T extends Parameter.SORT | URLParameter.SORT ? SortParseOptions : {}; | ||
export declare type ParseParameterOutput<T extends ParameterType | URLParameterType> = T extends Parameter.FIELDS | URLParameter.FIELDS ? FieldsParseOutput : T extends Parameter.FILTERS | URLParameter.FILTERS ? FiltersParseOutput : T extends Parameter.RELATIONS | URLParameter.RELATIONS ? RelationsParseOutput : T extends Parameter.PAGINATION | URLParameter.PAGINATION ? PaginationParseOutput : T extends Parameter.SORT | URLParameter.SORT ? SortParseOutput : never; | ||
import { ParameterFieldsType, ParameterFiltersType, ParameterPaginationType, ParameterRelationsType, ParameterSortType, ParameterType, URLParameterFieldsType, URLParameterFiltersType, URLParameterPaginationType, URLParameterRelationsType, URLParameterSortType, URLParameterType } from "../../type"; | ||
export declare type ParseParameterOptions<T extends ParameterType | URLParameterType> = T extends ParameterFieldsType | URLParameterFieldsType ? FieldsParseOptions : T extends ParameterFiltersType | URLParameterFiltersType ? FiltersParseOptions : T extends ParameterRelationsType | URLParameterRelationsType ? RelationsParseOptions : T extends ParameterPaginationType | URLParameterPaginationType ? PaginationParseOptions : T extends ParameterSortType | URLParameterSortType ? SortParseOptions : {}; | ||
export declare type ParseParameterOutput<T extends ParameterType | URLParameterType> = T extends ParameterFieldsType | URLParameterFieldsType ? FieldsParseOutput : T extends ParameterFiltersType | URLParameterFiltersType ? FiltersParseOutput : T extends ParameterRelationsType | URLParameterRelationsType ? RelationsParseOutput : T extends ParameterPaginationType | URLParameterPaginationType ? PaginationParseOutput : T extends ParameterSortType | URLParameterSortType ? SortParseOutput : never; | ||
//# sourceMappingURL=type.d.ts.map |
import { RelationsParseOutput } from "../parameter"; | ||
import { Parameter, ParameterType, URLParameter } from "../type"; | ||
import { ParameterFieldsType, ParameterPaginationType, ParameterRelationsType, ParameterType, URLParameterType } from "../type"; | ||
import { ParseParameterOptions, ParseParameterOutput } from "./parameter"; | ||
export declare type ParseOptionsBase<K extends ParameterType, A = string[]> = (K extends Parameter.PAGINATION ? {} : { | ||
export declare type ParseOptionsBase<K extends ParameterType, A = string[]> = (K extends ParameterPaginationType ? {} : { | ||
aliasMapping?: Record<string, string>; | ||
allowed?: A; | ||
defaultAlias?: string; | ||
}) & (K extends Parameter.RELATIONS | Parameter.PAGINATION ? {} : { | ||
}) & (K extends ParameterRelationsType | ParameterPaginationType ? {} : { | ||
relations?: RelationsParseOutput; | ||
}); | ||
export declare type ParseInput = { | ||
[K in Parameter | URLParameter]?: any; | ||
[K in ParameterType | URLParameterType]?: any; | ||
}; | ||
export declare type ParseOptions = { | ||
[K in Parameter]?: ParseParameterOptions<K> | boolean; | ||
[K in ParameterType]?: ParseParameterOptions<K> | boolean; | ||
}; | ||
export declare type ParseOutput = { | ||
[K in Parameter]?: ParseParameterOutput<K>; | ||
[K in ParameterType]?: ParseParameterOutput<K>; | ||
}; | ||
export declare type ParseOutputElementBase<K extends Parameter, V extends unknown | undefined = undefined> = (K extends Parameter.PAGINATION ? {} : { | ||
export declare type ParseOutputElementBase<K extends ParameterType, V extends unknown | undefined = undefined> = (K extends ParameterPaginationType ? {} : { | ||
key: string; | ||
}) & (K extends Parameter.RELATIONS ? {} : { | ||
}) & (K extends ParameterRelationsType ? {} : { | ||
alias?: string; | ||
}) & (K extends Parameter.FIELDS ? { | ||
}) & (K extends ParameterFieldsType ? { | ||
value?: V; | ||
@@ -26,0 +26,0 @@ } : { |
@@ -9,2 +9,7 @@ export declare enum Parameter { | ||
export declare type ParameterType = `${Parameter}`; | ||
export declare type ParameterFiltersType = 'filters'; | ||
export declare type ParameterFieldsType = 'fields'; | ||
export declare type ParameterPaginationType = 'pagination'; | ||
export declare type ParameterRelationsType = 'relations'; | ||
export declare type ParameterSortType = 'sort'; | ||
export declare enum URLParameter { | ||
@@ -17,3 +22,8 @@ FILTERS = "filter", | ||
} | ||
export declare type URLParameterType = `${Parameter}`; | ||
export declare type URLParameterType = `${URLParameter}`; | ||
export declare type URLParameterFiltersType = 'filter'; | ||
export declare type URLParameterFieldsType = 'fields'; | ||
export declare type URLParameterPaginationType = 'page'; | ||
export declare type URLParameterRelationsType = 'include'; | ||
export declare type URLParameterSortType = 'sort'; | ||
//# sourceMappingURL=type.d.ts.map |
{ | ||
"name": "@trapi/query", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.2", | ||
"description": "An tiny library which provides utility types/functions for request and response query handling.", | ||
@@ -54,3 +54,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "303ee7a8f681e252c4a746860013b68e2b432b3a" | ||
"gitHead": "04d3af193f81064c22578697b978a50563934cc4" | ||
} |
@@ -43,3 +43,3 @@ # @trapi/query 🌈 | ||
- [parseQuery](#parsequery) | ||
- [parseQueryParameter]() | ||
- [parseQueryParameter](#parsequeryparameter) | ||
- [Types](#types) | ||
@@ -46,0 +46,0 @@ - [Build](#build) |
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
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
148012
1617
0