@trapi/query
Advanced tools
Comparing version 2.0.5 to 2.1.0
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const parameter_1 = require("../parameter"); | ||
const type_1 = require("../type"); | ||
const constants_1 = require("../constants"); | ||
const utils_1 = require("../utils"); | ||
@@ -21,25 +21,25 @@ function buildQuery(input, options) { | ||
const query = {}; | ||
if (typeof input[type_1.Parameter.FIELDS] !== 'undefined' || | ||
typeof input[type_1.URLParameter.FIELDS] !== 'undefined') { | ||
const fields = (_a = input[type_1.Parameter.FIELDS]) !== null && _a !== void 0 ? _a : input[type_1.URLParameter.FIELDS]; | ||
query[type_1.URLParameter.FIELDS] = (0, parameter_1.buildQueryFields)(fields); | ||
if (typeof input[constants_1.Parameter.FIELDS] !== 'undefined' || | ||
typeof input[constants_1.URLParameter.FIELDS] !== 'undefined') { | ||
const fields = (_a = input[constants_1.Parameter.FIELDS]) !== null && _a !== void 0 ? _a : input[constants_1.URLParameter.FIELDS]; | ||
query[constants_1.URLParameter.FIELDS] = (0, parameter_1.buildQueryFields)(fields); | ||
} | ||
if (typeof input[type_1.Parameter.FILTERS] !== 'undefined' || | ||
typeof input[type_1.URLParameter.FILTERS] !== 'undefined') { | ||
const value = (_b = input[type_1.Parameter.FILTERS]) !== null && _b !== void 0 ? _b : input[type_1.URLParameter.FILTERS]; | ||
query[type_1.URLParameter.FILTERS] = (0, parameter_1.buildQueryFilters)(value); | ||
if (typeof input[constants_1.Parameter.FILTERS] !== 'undefined' || | ||
typeof input[constants_1.URLParameter.FILTERS] !== 'undefined') { | ||
const value = (_b = input[constants_1.Parameter.FILTERS]) !== null && _b !== void 0 ? _b : input[constants_1.URLParameter.FILTERS]; | ||
query[constants_1.URLParameter.FILTERS] = (0, parameter_1.buildQueryFilters)(value); | ||
} | ||
if (typeof input[type_1.Parameter.PAGINATION] !== 'undefined' || | ||
typeof input[type_1.URLParameter.PAGINATION] !== 'undefined') { | ||
query[type_1.URLParameter.PAGINATION] = (_c = input[type_1.Parameter.PAGINATION]) !== null && _c !== void 0 ? _c : input[type_1.URLParameter.PAGINATION]; | ||
if (typeof input[constants_1.Parameter.PAGINATION] !== 'undefined' || | ||
typeof input[constants_1.URLParameter.PAGINATION] !== 'undefined') { | ||
query[constants_1.URLParameter.PAGINATION] = (_c = input[constants_1.Parameter.PAGINATION]) !== null && _c !== void 0 ? _c : input[constants_1.URLParameter.PAGINATION]; | ||
} | ||
if (typeof input[type_1.Parameter.RELATIONS] !== 'undefined' || | ||
typeof input[type_1.URLParameter.RELATIONS] !== 'undefined') { | ||
const value = (_d = input[type_1.Parameter.RELATIONS]) !== null && _d !== void 0 ? _d : input[type_1.URLParameter.RELATIONS]; | ||
query[type_1.URLParameter.RELATIONS] = (0, parameter_1.buildQueryRelations)(value); | ||
if (typeof input[constants_1.Parameter.RELATIONS] !== 'undefined' || | ||
typeof input[constants_1.URLParameter.RELATIONS] !== 'undefined') { | ||
const value = (_d = input[constants_1.Parameter.RELATIONS]) !== null && _d !== void 0 ? _d : input[constants_1.URLParameter.RELATIONS]; | ||
query[constants_1.URLParameter.RELATIONS] = (0, parameter_1.buildQueryRelations)(value); | ||
} | ||
if (typeof input[type_1.Parameter.SORT] !== 'undefined' || | ||
typeof input[type_1.URLParameter.SORT] !== 'undefined') { | ||
const value = (_e = input[type_1.Parameter.SORT]) !== null && _e !== void 0 ? _e : input[type_1.URLParameter.SORT]; | ||
query[type_1.URLParameter.SORT] = (0, parameter_1.buildQuerySort)(value); | ||
if (typeof input[constants_1.Parameter.SORT] !== 'undefined' || | ||
typeof input[constants_1.URLParameter.SORT] !== 'undefined') { | ||
const value = (_e = input[constants_1.Parameter.SORT]) !== null && _e !== void 0 ? _e : input[constants_1.URLParameter.SORT]; | ||
query[constants_1.URLParameter.SORT] = (0, parameter_1.buildQuerySort)(value); | ||
} | ||
@@ -46,0 +46,0 @@ return (0, utils_1.buildURLQueryString)(query); |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
import { FieldsBuildInput, FiltersBuildInput, PaginationBuildInput, RelationsBuildInput, SortBuildInput } from '../../parameter'; | ||
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; | ||
import { Parameter, URLParameter } from '../../constants'; | ||
export declare type BuildParameterInput<T extends `${Parameter}` | `${URLParameter}`, R extends Record<string, any> = 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; | ||
//# sourceMappingURL=type.d.ts.map |
@@ -1,7 +0,7 @@ | ||
import { ParameterType, URLParameterType } from '../type'; | ||
import { Parameter, URLParameter } from '../constants'; | ||
import { BuildParameterInput } from './parameter'; | ||
export declare type BuildOptions = {}; | ||
export declare type BuildInput<V extends Record<string, any>> = { | ||
[T in ParameterType | URLParameterType]?: BuildParameterInput<T, V>; | ||
[K in `${Parameter}` | `${URLParameter}`]?: BuildParameterInput<K, V>; | ||
}; | ||
//# sourceMappingURL=type.d.ts.map |
export * from './build'; | ||
export * from './parameter'; | ||
export * from './parse'; | ||
export * from './type'; | ||
export * from './constants'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -23,3 +27,3 @@ if (k2 === undefined) k2 = k; | ||
__exportStar(require("./parse"), exports); | ||
__exportStar(require("./type"), exports); | ||
__exportStar(require("./constants"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
exports.buildQueryFields = void 0; | ||
const utils_1 = require("../../utils"); | ||
const utils_1 = require("../utils"); | ||
function buildQueryFields(data) { | ||
@@ -13,0 +13,0 @@ switch (true) { |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
@@ -1,4 +0,3 @@ | ||
import { ParseOptionsBase, ParseOutputElementBase } from '../../parse'; | ||
import { Parameter } from '../../type'; | ||
import { Flatten, KeyWithOptionalPrefix, OnlyObject, ToOneAndMany } from '../type'; | ||
import { Parameter } from '../../constants'; | ||
import { Flatten, KeyWithOptionalPrefix, OnlyObject, ParseOptionsBase, ParseOutputElementBase, ToOneAndMany } from '../type'; | ||
export declare const DEFAULT_ALIAS_ID = "__DEFAULT__"; | ||
@@ -5,0 +4,0 @@ export declare enum FieldOperator { |
@@ -10,4 +10,5 @@ "use strict"; | ||
exports.buildQueryFilters = void 0; | ||
const utils_1 = require("../../utils"); | ||
const type_1 = require("./type"); | ||
const utils_1 = require("../utils"); | ||
const constants_1 = require("./constants"); | ||
const utils_2 = require("./utils"); | ||
function buildQueryFilters(data) { | ||
@@ -18,10 +19,16 @@ return (0, utils_1.flattenNestedProperties)(transformOperatorConfigToValue(data)); | ||
const OperatorWeight = { | ||
[type_1.FilterOperator.NEGATION]: 0, | ||
[type_1.FilterOperator.LIKE]: 50, | ||
[type_1.FilterOperator.LESS_THAN_EQUAL]: 150, | ||
[type_1.FilterOperator.LESS_THAN]: 450, | ||
[type_1.FilterOperator.MORE_THAN_EQUAL]: 1350, | ||
[type_1.FilterOperator.MORE_THAN]: 4050, | ||
[type_1.FilterOperator.IN]: 13105, | ||
[constants_1.FilterOperator.NEGATION]: 0, | ||
[constants_1.FilterOperator.LIKE]: 50, | ||
[constants_1.FilterOperator.LESS_THAN_EQUAL]: 150, | ||
[constants_1.FilterOperator.LESS_THAN]: 450, | ||
[constants_1.FilterOperator.MORE_THAN_EQUAL]: 1350, | ||
[constants_1.FilterOperator.MORE_THAN]: 4050, | ||
[constants_1.FilterOperator.IN]: 13105, | ||
}; | ||
function transformValue(value) { | ||
if (typeof value === 'undefined') { | ||
return null; | ||
} | ||
return value; | ||
} | ||
function transformOperatorConfigToValue(data) { | ||
@@ -31,18 +38,19 @@ if (Object.prototype.toString.call(data) !== '[object Object]') { | ||
} | ||
for (const key in data) { | ||
if (data.hasOwnProperty('operator') && | ||
data.hasOwnProperty('value')) { | ||
const config = data; | ||
if (Array.isArray(config.operator)) { | ||
data.operator = config.operator | ||
.sort((a, b) => (OperatorWeight[a] <= OperatorWeight[b] ? -1 : 1)) | ||
.join(''); | ||
} | ||
if ((0, utils_2.isFilterOperatorConfig)(data)) { | ||
data.value = transformValue(data.value); | ||
if (Array.isArray(data.operator)) { | ||
// merge operators | ||
data.operator = data.operator | ||
.sort((a, b) => OperatorWeight[a] - OperatorWeight[b]) | ||
.join(''); | ||
} | ||
else { | ||
data[key] = transformOperatorConfigToValue(data[key]); | ||
} | ||
return data; | ||
} | ||
const keys = Object.keys(data); | ||
for (let i = 0; i < keys.length; i++) { | ||
data[keys[i]] = transformValue(data[keys[i]]); | ||
data[keys[i]] = transformOperatorConfigToValue(data[keys[i]]); | ||
} | ||
return data; | ||
} | ||
//# sourceMappingURL=build.js.map |
@@ -0,1 +1,2 @@ | ||
export * from './constants'; | ||
export * from './build'; | ||
@@ -2,0 +3,0 @@ export * from './parse'; |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -20,2 +24,3 @@ if (k2 === undefined) k2 = k; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./constants"), exports); | ||
__exportStar(require("./build"), exports); | ||
@@ -22,0 +27,0 @@ __exportStar(require("./parse"), exports); |
@@ -33,5 +33,5 @@ "use strict"; | ||
} | ||
const prototype = Object.prototype.toString.call(data); | ||
// Object.prototype.toString.call(data) | ||
/* istanbul ignore next */ | ||
if (prototype !== '[object Object]') { | ||
if (typeof data !== 'object') { | ||
return []; | ||
@@ -46,11 +46,13 @@ } | ||
// transform to appreciate data format & validate input | ||
for (let key in data) { | ||
let keys = Object.keys(data); | ||
for (let i = 0; i < keys.length; i++) { | ||
/* istanbul ignore next */ | ||
if (!data.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(data, keys[i])) { | ||
continue; | ||
} | ||
let value = data[key]; | ||
let value = data[keys[i]]; | ||
if (typeof value !== 'string' && | ||
typeof value !== 'number' && | ||
typeof value !== 'boolean') { | ||
typeof value !== 'boolean' && | ||
value !== null) { | ||
continue; | ||
@@ -64,7 +66,10 @@ } | ||
} | ||
if (value.toLowerCase() === 'null') { | ||
value = null; | ||
} | ||
} | ||
if (options.aliasMapping.hasOwnProperty(key)) { | ||
key = options.aliasMapping[key]; | ||
if (Object.prototype.hasOwnProperty.call(options.aliasMapping, keys[i])) { | ||
keys[i] = options.aliasMapping[keys[i]]; | ||
} | ||
const fieldDetails = (0, utils_1.getFieldDetails)(key); | ||
const fieldDetails = (0, utils_1.getFieldDetails)(keys[i]); | ||
if (!(0, utils_1.isFieldAllowedByRelations)(fieldDetails, options.relations, { defaultAlias: options.defaultAlias })) { | ||
@@ -75,12 +80,16 @@ continue; | ||
if (typeof options.allowed !== 'undefined' && | ||
options.allowed.indexOf(key) === -1 && | ||
options.allowed.indexOf(keys[i]) === -1 && | ||
options.allowed.indexOf(keyWithAlias) === -1) { | ||
continue; | ||
} | ||
const alias = typeof fieldDetails.path === 'undefined' && | ||
typeof fieldDetails.alias === 'undefined' ? | ||
(options.defaultAlias ? | ||
let alias; | ||
if (typeof fieldDetails.path === 'undefined' && | ||
typeof fieldDetails.alias === 'undefined') { | ||
alias = options.defaultAlias ? | ||
options.defaultAlias : | ||
undefined) : | ||
fieldDetails.alias; | ||
undefined; | ||
} | ||
else { | ||
alias = fieldDetails.alias; | ||
} | ||
temp[keyWithAlias] = Object.assign(Object.assign({ key: fieldDetails.name }, (alias ? { alias } : {})), { value: value }); | ||
@@ -90,8 +99,9 @@ } | ||
/* istanbul ignore next */ | ||
for (const key in temp) { | ||
keys = Object.keys(temp); | ||
for (let i = 0; i < keys.length; i++) { | ||
/* istanbul ignore next */ | ||
if (!temp.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(temp, keys[i])) { | ||
continue; | ||
} | ||
const filter = Object.assign(Object.assign({}, (temp[key].alias ? { alias: temp[key].alias } : {})), { key: temp[key].key, value: temp[key].value }); | ||
const filter = Object.assign(Object.assign({}, (temp[keys[i]].alias ? { alias: temp[keys[i]].alias } : {})), { key: temp[keys[i]].key, value: temp[keys[i]].value }); | ||
if (typeof filter.value === 'string') { | ||
@@ -98,0 +108,0 @@ const { value, operators } = (0, utils_2.determineFilterOperatorLabelsByValue)(filter.value); |
@@ -1,27 +0,9 @@ | ||
import { ParseOptionsBase, ParseOutputElementBase } from '../../parse'; | ||
import { Parameter } from '../../type'; | ||
import { Flatten, OnlyObject, OnlyScalar } from '../type'; | ||
export declare type FilterOperatorConfig<V, O> = { | ||
operator: O | O[]; | ||
import { Parameter } from '../../constants'; | ||
import { Flatten, OnlyObject, OnlyScalar, ParseOptionsBase, ParseOutputElementBase } from '../type'; | ||
import { FilterOperator, FilterOperatorLabel } from './constants'; | ||
export declare type FilterOperatorConfig<V extends string | number | boolean | null | undefined> = { | ||
operator: `${FilterOperator}` | (`${FilterOperator}`)[]; | ||
value: V | V[]; | ||
}; | ||
export declare enum FilterOperatorLabel { | ||
NEGATION = "negation", | ||
LIKE = "like", | ||
LESS_THAN_EQUAL = "lessThanEqual", | ||
LESS_THAN = "lessThan", | ||
MORE_THAN_EQUAL = "moreThanEqual", | ||
MORE_THAN = "moreThan", | ||
IN = "in" | ||
} | ||
export declare type FilterOperatorLabelType = `${FilterOperatorLabel}`; | ||
export declare enum FilterOperator { | ||
NEGATION = "!", | ||
LIKE = "~", | ||
LESS_THAN_EQUAL = "<=", | ||
LESS_THAN = "<", | ||
MORE_THAN_EQUAL = ">=", | ||
MORE_THAN = ">", | ||
IN = "," | ||
} | ||
declare type FilterValue<V> = V extends string | number | boolean ? (V | V[]) : never; | ||
@@ -31,3 +13,3 @@ declare type FilterValueWithOperator<V> = V extends string | number | boolean ? (FilterValue<V> | FilterValueOperator<V> | Array<FilterValueOperator<V>>) : never; | ||
export declare type FiltersBuildInput<T> = { | ||
[K in keyof T]?: T[K] extends OnlyScalar<T[K]> ? T[K] | FilterValueWithOperator<T[K]> | FilterOperatorConfig<T[K], `${FilterOperator}`> : T[K] extends OnlyObject<T[K]> ? FiltersBuildInput<Flatten<T[K]>> : never; | ||
[K in keyof T]?: T[K] extends OnlyScalar<T[K]> ? T[K] | FilterValueWithOperator<T[K]> | FilterOperatorConfig<T[K]> : T[K] extends OnlyObject<T[K]> ? FiltersBuildInput<Flatten<T[K]>> : never; | ||
}; | ||
@@ -34,0 +16,0 @@ export declare type FiltersParseOptions = ParseOptionsBase<Parameter.FILTERS>; |
@@ -9,23 +9,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FilterOperator = exports.FilterOperatorLabel = void 0; | ||
var FilterOperatorLabel; | ||
(function (FilterOperatorLabel) { | ||
FilterOperatorLabel["NEGATION"] = "negation"; | ||
FilterOperatorLabel["LIKE"] = "like"; | ||
FilterOperatorLabel["LESS_THAN_EQUAL"] = "lessThanEqual"; | ||
FilterOperatorLabel["LESS_THAN"] = "lessThan"; | ||
FilterOperatorLabel["MORE_THAN_EQUAL"] = "moreThanEqual"; | ||
FilterOperatorLabel["MORE_THAN"] = "moreThan"; | ||
FilterOperatorLabel["IN"] = "in"; | ||
})(FilterOperatorLabel = exports.FilterOperatorLabel || (exports.FilterOperatorLabel = {})); | ||
var FilterOperator; | ||
(function (FilterOperator) { | ||
FilterOperator["NEGATION"] = "!"; | ||
FilterOperator["LIKE"] = "~"; | ||
FilterOperator["LESS_THAN_EQUAL"] = "<="; | ||
FilterOperator["LESS_THAN"] = "<"; | ||
FilterOperator["MORE_THAN_EQUAL"] = ">="; | ||
FilterOperator["MORE_THAN"] = ">"; | ||
FilterOperator["IN"] = ","; | ||
})(FilterOperator = exports.FilterOperator || (exports.FilterOperator = {})); | ||
//# sourceMappingURL=type.js.map |
@@ -1,2 +0,2 @@ | ||
import { FilterOperatorLabelType } from './type'; | ||
import { FilterOperatorConfig, FilterOperatorLabelType } from './type'; | ||
export declare function determineFilterOperatorLabelsByValue(input: string): { | ||
@@ -6,2 +6,3 @@ operators: FilterOperatorLabelType[]; | ||
}; | ||
export declare function isFilterOperatorConfig(data: unknown): data is FilterOperatorConfig<any>; | ||
//# sourceMappingURL=utils.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.determineFilterOperatorLabelsByValue = void 0; | ||
const type_1 = require("./type"); | ||
exports.isFilterOperatorConfig = exports.determineFilterOperatorLabelsByValue = void 0; | ||
const utils_1 = require("../../utils"); | ||
const constants_1 = require("./constants"); | ||
const config = []; | ||
const operatorKeys = Object.keys(type_1.FilterOperator); | ||
const operatorKeys = Object.keys(constants_1.FilterOperator); | ||
for (let i = 0; i < operatorKeys.length; i++) { | ||
config.push({ | ||
sign: type_1.FilterOperator[operatorKeys[i]], | ||
label: type_1.FilterOperatorLabel[operatorKeys[i]], | ||
sign: constants_1.FilterOperator[operatorKeys[i]], | ||
label: constants_1.FilterOperatorLabel[operatorKeys[i]], | ||
}); | ||
@@ -21,3 +22,3 @@ } | ||
switch (config[i].sign) { | ||
case type_1.FilterOperator.IN: | ||
case constants_1.FilterOperator.IN: | ||
if (value.includes(config[i].sign)) { | ||
@@ -32,2 +33,5 @@ operators.push(config[i].label); | ||
value = value.slice(config[i].sign.length); | ||
if (value.toLowerCase() === 'null') { | ||
value = null; | ||
} | ||
} | ||
@@ -43,2 +47,53 @@ break; | ||
exports.determineFilterOperatorLabelsByValue = determineFilterOperatorLabelsByValue; | ||
function isFilterOperatorConfig(data) { | ||
if (typeof data !== 'object') { | ||
return false; | ||
} | ||
if ((0, utils_1.hasOwnProperty)(data, 'operator')) { | ||
const operators = Object.values(constants_1.FilterOperator); | ||
if (typeof data.operator === 'string') { | ||
if (operators.indexOf(data.operator) === -1) { | ||
return false; | ||
} | ||
} | ||
else if (Array.isArray(data.operator)) { | ||
for (let i = 0; i < data.operator.length; i++) { | ||
if (typeof data.operator[i] !== 'string') { | ||
return false; | ||
} | ||
if (operators.indexOf(data.operator[i]) === -1) { | ||
return false; | ||
} | ||
} | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
else { | ||
return false; | ||
} | ||
if ((0, utils_1.hasOwnProperty)(data, 'value')) { | ||
if (!(0, utils_1.isSimpleValue)(data.value, { | ||
withNull: true, | ||
withUndefined: true, | ||
})) { | ||
if (Array.isArray(data.value)) { | ||
for (let i = 0; i < data.value.length; i++) { | ||
if (!(0, utils_1.isSimpleValue)(data.value[i])) { | ||
return false; | ||
} | ||
} | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
} | ||
else { | ||
return false; | ||
} | ||
return true; | ||
} | ||
exports.isFilterOperatorConfig = isFilterOperatorConfig; | ||
//# sourceMappingURL=utils.js.map |
@@ -7,2 +7,3 @@ export * from './fields'; | ||
export * from './type'; | ||
export * from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -26,2 +30,3 @@ if (k2 === undefined) k2 = k; | ||
__exportStar(require("./type"), exports); | ||
__exportStar(require("./utils"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
@@ -33,4 +33,3 @@ "use strict"; | ||
if (typeof limit !== 'undefined') { | ||
// tslint:disable-next-line:radix | ||
limit = parseInt(limit); | ||
limit = parseInt(limit, 10); | ||
if (!Number.isNaN(limit) && limit > 0) { | ||
@@ -41,4 +40,3 @@ pagination.limit = limit; | ||
if (typeof offset !== 'undefined') { | ||
// tslint:disable-next-line:radix | ||
offset = parseInt(offset); | ||
offset = parseInt(offset, 10); | ||
if (!Number.isNaN(offset) && offset >= 0) { | ||
@@ -45,0 +43,0 @@ pagination.offset = offset; |
@@ -1,3 +0,3 @@ | ||
import { ParseOptionsBase } from '../../parse'; | ||
import { Parameter } from '../../type'; | ||
import { Parameter } from '../../constants'; | ||
import { ParseOptionsBase } from '../type'; | ||
export declare type PaginationBuildInput<T> = { | ||
@@ -7,9 +7,9 @@ limit?: number; | ||
}; | ||
export declare type PaginationParseOptions = ParseOptionsBase<Parameter.PAGINATION> & { | ||
export declare type PaginationParseOptions = { | ||
maxLimit?: number; | ||
}; | ||
export declare type PaginationParseOutput = ParseOptionsBase<Parameter.PAGINATION> & { | ||
} & ParseOptionsBase<Parameter.PAGINATION>; | ||
export declare type PaginationParseOutput = { | ||
limit?: number; | ||
offset?: number; | ||
}; | ||
} & ParseOptionsBase<Parameter.PAGINATION>; | ||
//# sourceMappingURL=type.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.buildQueryRelations = void 0; | ||
const utils_1 = require("../../utils"); | ||
const utils_1 = require("../utils"); | ||
function buildQueryRelations(data) { | ||
@@ -6,0 +6,0 @@ const properties = (0, utils_1.flattenNestedProperties)(data); |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
@@ -1,4 +0,3 @@ | ||
import { ParseOptionsBase, ParseOutputElementBase } from '../../parse'; | ||
import { Parameter } from '../../type'; | ||
import { Flatten, OnlyObject } from '../type'; | ||
import { Parameter } from '../../constants'; | ||
import { Flatten, OnlyObject, ParseOptionsBase, ParseOutputElementBase } from '../type'; | ||
export declare type RelationsBuildInput<T extends Record<string, any>> = { | ||
@@ -5,0 +4,0 @@ [K in keyof T]?: T[K] extends OnlyObject<T[K]> ? RelationsBuildInput<Flatten<T[K]>> | boolean : never; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.buildQuerySort = void 0; | ||
const utils_1 = require("../../utils"); | ||
const utils_1 = require("../utils"); | ||
function buildQuerySort(data) { | ||
@@ -6,0 +6,0 @@ switch (true) { |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
@@ -1,4 +0,3 @@ | ||
import { ParseOptionsBase, ParseOutputElementBase } from '../../parse'; | ||
import { Parameter } from '../../type'; | ||
import { Flatten, KeyWithOptionalPrefix, OnlyObject, OnlyScalar } from '../type'; | ||
import { Flatten, KeyWithOptionalPrefix, OnlyObject, OnlyScalar, ParseOptionsBase, ParseOutputElementBase } from '../type'; | ||
import { Parameter } from '../../constants'; | ||
export declare enum SortDirection { | ||
@@ -5,0 +4,0 @@ ASC = "ASC", |
@@ -0,1 +1,2 @@ | ||
import { Parameter } from '../constants'; | ||
export declare type Flatten<Type> = Type extends Array<infer Item> ? Item : Type; | ||
@@ -9,2 +10,18 @@ export declare type OnlyScalar<T> = T extends string | number | boolean | undefined | null ? T : never; | ||
export declare type KeyWithOptionalPrefix<T, O extends string> = T extends string ? (`${O}${T}` | T) : never; | ||
export declare type ParseOutputElementBase<K extends `${Parameter}`, V extends unknown | undefined = undefined> = (K extends `${Parameter.PAGINATION}` ? Record<string, any> : { | ||
key: string; | ||
}) & (K extends `${Parameter.RELATIONS}` ? Record<string, any> : { | ||
alias?: string; | ||
}) & (K extends `${Parameter.FIELDS}` ? { | ||
value?: V; | ||
} : { | ||
value: V; | ||
}); | ||
export declare type ParseOptionsBase<K extends `${Parameter}`, A = string[]> = (K extends `${Parameter.PAGINATION}` ? Record<string, any> : { | ||
aliasMapping?: Record<string, string>; | ||
allowed?: A; | ||
defaultAlias?: string; | ||
}) & (K extends `${Parameter.PAGINATION}` | `${Parameter.RELATIONS}` ? Record<string, any> : { | ||
relations?: ParseOutputElementBase<Parameter.RELATIONS, string>[]; | ||
}); | ||
//# sourceMappingURL=type.d.ts.map |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
@@ -10,3 +10,3 @@ "use strict"; | ||
exports.parseQuery = void 0; | ||
const type_1 = require("../type"); | ||
const constants_1 = require("../constants"); | ||
const parameter_1 = require("./parameter"); | ||
@@ -19,11 +19,11 @@ function parseQuery(input, options) { | ||
let relations; | ||
if (!!options[type_1.Parameter.RELATIONS] || nonEnabled) { | ||
relations = (0, parameter_1.parseQueryParameter)(type_1.Parameter.RELATIONS, (_a = input[type_1.Parameter.RELATIONS]) !== null && _a !== void 0 ? _a : input[type_1.URLParameter.RELATIONS], options[type_1.Parameter.RELATIONS]); | ||
output[type_1.Parameter.RELATIONS] = relations; | ||
if (!!options[constants_1.Parameter.RELATIONS] || nonEnabled) { | ||
relations = (0, parameter_1.parseQueryParameter)(constants_1.Parameter.RELATIONS, (_a = input[constants_1.Parameter.RELATIONS]) !== null && _a !== void 0 ? _a : input[constants_1.URLParameter.RELATIONS], options[constants_1.Parameter.RELATIONS]); | ||
output[constants_1.Parameter.RELATIONS] = relations; | ||
} | ||
const keys = [ | ||
type_1.Parameter.FIELDS, | ||
type_1.Parameter.FILTERS, | ||
type_1.Parameter.PAGINATION, | ||
type_1.Parameter.SORT, | ||
constants_1.Parameter.FIELDS, | ||
constants_1.Parameter.FILTERS, | ||
constants_1.Parameter.PAGINATION, | ||
constants_1.Parameter.SORT, | ||
]; | ||
@@ -37,13 +37,13 @@ for (let i = 0; i < keys.length; i++) { | ||
switch (key) { | ||
case type_1.Parameter.FIELDS: | ||
output[type_1.Parameter.FIELDS] = (0, parameter_1.parseQueryParameter)(keys[i], (_b = input[type_1.Parameter.FIELDS]) !== null && _b !== void 0 ? _b : input[type_1.URLParameter.FIELDS], options[type_1.Parameter.FIELDS], relations); | ||
case constants_1.Parameter.FIELDS: | ||
output[constants_1.Parameter.FIELDS] = (0, parameter_1.parseQueryParameter)(keys[i], (_b = input[constants_1.Parameter.FIELDS]) !== null && _b !== void 0 ? _b : input[constants_1.URLParameter.FIELDS], options[constants_1.Parameter.FIELDS], relations); | ||
break; | ||
case type_1.Parameter.FILTERS: | ||
output[type_1.Parameter.FILTERS] = (0, parameter_1.parseQueryParameter)(keys[i], (_c = input[type_1.Parameter.FILTERS]) !== null && _c !== void 0 ? _c : input[type_1.URLParameter.FILTERS], options[type_1.Parameter.FILTERS], relations); | ||
case constants_1.Parameter.FILTERS: | ||
output[constants_1.Parameter.FILTERS] = (0, parameter_1.parseQueryParameter)(keys[i], (_c = input[constants_1.Parameter.FILTERS]) !== null && _c !== void 0 ? _c : input[constants_1.URLParameter.FILTERS], options[constants_1.Parameter.FILTERS], relations); | ||
break; | ||
case type_1.Parameter.PAGINATION: | ||
output[type_1.Parameter.PAGINATION] = (0, parameter_1.parseQueryParameter)(keys[i], (_d = input[type_1.Parameter.PAGINATION]) !== null && _d !== void 0 ? _d : input[type_1.URLParameter.PAGINATION], options[type_1.Parameter.PAGINATION], relations); | ||
case constants_1.Parameter.PAGINATION: | ||
output[constants_1.Parameter.PAGINATION] = (0, parameter_1.parseQueryParameter)(keys[i], (_d = input[constants_1.Parameter.PAGINATION]) !== null && _d !== void 0 ? _d : input[constants_1.URLParameter.PAGINATION], options[constants_1.Parameter.PAGINATION], relations); | ||
break; | ||
case type_1.Parameter.SORT: | ||
output[type_1.Parameter.SORT] = (0, parameter_1.parseQueryParameter)(keys[i], (_e = input[type_1.Parameter.SORT]) !== null && _e !== void 0 ? _e : input[type_1.URLParameter.SORT], options[type_1.Parameter.SORT], relations); | ||
case constants_1.Parameter.SORT: | ||
output[constants_1.Parameter.SORT] = (0, parameter_1.parseQueryParameter)(keys[i], (_e = input[constants_1.Parameter.SORT]) !== null && _e !== void 0 ? _e : input[constants_1.URLParameter.SORT], options[constants_1.Parameter.SORT], relations); | ||
break; | ||
@@ -50,0 +50,0 @@ } |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
import { RelationsParseOutput } from '../../parameter'; | ||
import { ParameterType, URLParameterType } from '../../type'; | ||
import { Parameter, URLParameter } from '../../constants'; | ||
import { ParseParameterOptions, ParseParameterOutput } from './type'; | ||
export declare function parseQueryParameter<K extends ParameterType | URLParameterType>(key: K, data: unknown, options?: ParseParameterOptions<K> | boolean, relations?: RelationsParseOutput): ParseParameterOutput<K>; | ||
export declare function parseQueryParameter<K extends `${Parameter}` | `${URLParameter}`>(key: K, data: unknown, options?: ParseParameterOptions<K> | boolean, relations?: RelationsParseOutput): ParseParameterOutput<K>; | ||
//# sourceMappingURL=module.d.ts.map |
@@ -11,19 +11,18 @@ "use strict"; | ||
const parameter_1 = require("../../parameter"); | ||
const type_1 = require("../../type"); | ||
const constants_1 = require("../../constants"); | ||
function parseQueryParameter(key, data, options, relations) { | ||
switch (key) { | ||
case type_1.Parameter.FIELDS: | ||
case type_1.URLParameter.FIELDS: | ||
case constants_1.Parameter.FIELDS: | ||
case constants_1.URLParameter.FIELDS: | ||
return (0, parameter_1.parseQueryFields)(data, Object.assign(Object.assign({}, (invalidToEmptyObject(options))), (relations ? { relations } : {}))); | ||
case type_1.Parameter.FILTERS: | ||
case type_1.URLParameter.FILTERS: | ||
case constants_1.Parameter.FILTERS: | ||
case constants_1.URLParameter.FILTERS: | ||
return (0, parameter_1.parseQueryFilters)(data, Object.assign(Object.assign({}, (invalidToEmptyObject(options))), (relations ? { relations } : {}))); | ||
case type_1.Parameter.PAGINATION: | ||
case type_1.URLParameter.PAGINATION: | ||
return (0, parameter_1.parseQueryPagination)(data, Object.assign(Object.assign({}, (invalidToEmptyObject(options))), (relations ? { relations } : {}))); | ||
case type_1.Parameter.RELATIONS: | ||
case type_1.URLParameter.RELATIONS: | ||
case constants_1.Parameter.PAGINATION: | ||
case constants_1.URLParameter.PAGINATION: | ||
return (0, parameter_1.parseQueryPagination)(data, Object.assign({}, (invalidToEmptyObject(options)))); | ||
case constants_1.Parameter.RELATIONS: | ||
case constants_1.URLParameter.RELATIONS: | ||
return (0, parameter_1.parseQueryRelations)(data, Object.assign({}, (invalidToEmptyObject(options)))); | ||
case type_1.Parameter.SORT: | ||
case type_1.URLParameter.SORT: | ||
default: | ||
return (0, parameter_1.parseQuerySort)(data, Object.assign(Object.assign({}, (invalidToEmptyObject(options))), (relations ? { relations } : {}))); | ||
@@ -30,0 +29,0 @@ } |
import { FieldsParseOptions, FieldsParseOutput, FiltersParseOptions, FiltersParseOutput, PaginationParseOptions, PaginationParseOutput, RelationsParseOptions, RelationsParseOutput, SortParseOptions, SortParseOutput } from '../../parameter'; | ||
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 : never; | ||
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; | ||
import { Parameter, URLParameter } from '../../constants'; | ||
export declare type ParseParameterOptions<T extends `${Parameter}` | `${URLParameter}`> = 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 : never; | ||
export declare type ParseParameterOutput<T extends `${Parameter}` | `${URLParameter}`> = 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; | ||
//# sourceMappingURL=type.d.ts.map |
@@ -1,29 +0,12 @@ | ||
import { RelationsParseOutput } from '../parameter'; | ||
import { ParameterFieldsType, ParameterPaginationType, ParameterRelationsType, ParameterType, URLParameterType } from '../type'; | ||
import { Parameter, URLParameter } from '../constants'; | ||
import { ParseParameterOptions, ParseParameterOutput } from './parameter'; | ||
export declare type ParseOptionsBase<K extends ParameterType, A = string[]> = (K extends ParameterPaginationType ? Record<string, any> : { | ||
aliasMapping?: Record<string, string>; | ||
allowed?: A; | ||
defaultAlias?: string; | ||
}) & (K extends ParameterRelationsType | ParameterPaginationType ? Record<string, any> : { | ||
relations?: RelationsParseOutput; | ||
}); | ||
export declare type ParseInput = { | ||
[K in ParameterType | URLParameterType]?: any; | ||
[K in `${Parameter}` | `${URLParameter}`]?: any; | ||
}; | ||
export declare type ParseOptions = { | ||
[K in ParameterType]?: ParseParameterOptions<K> | boolean; | ||
[K in `${Parameter}`]?: ParseParameterOptions<K> | boolean; | ||
}; | ||
export declare type ParseOutput = { | ||
[K in ParameterType]?: ParseParameterOutput<K>; | ||
[K in `${Parameter}`]?: ParseParameterOutput<K>; | ||
}; | ||
export declare type ParseOutputElementBase<K extends ParameterType, V extends unknown | undefined = undefined> = (K extends ParameterPaginationType ? Record<string, any> : { | ||
key: string; | ||
}) & (K extends ParameterRelationsType ? Record<string, any> : { | ||
alias?: string; | ||
}) & (K extends ParameterFieldsType ? { | ||
value?: V; | ||
} : { | ||
value: V; | ||
}); | ||
//# sourceMappingURL=type.d.ts.map |
export * from './field'; | ||
export * from './flatten'; | ||
export * from './relation'; | ||
export * from './object'; | ||
export * from './simple'; | ||
export * from './type'; | ||
export * from './url'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -21,7 +25,7 @@ if (k2 === undefined) k2 = k; | ||
__exportStar(require("./field"), exports); | ||
__exportStar(require("./flatten"), exports); | ||
__exportStar(require("./relation"), exports); | ||
__exportStar(require("./object"), exports); | ||
__exportStar(require("./simple"), exports); | ||
__exportStar(require("./type"), exports); | ||
__exportStar(require("./url"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,5 @@ | ||
import { RelationsParseOutput } from '../parameter'; | ||
import { FieldDetails } from './type'; | ||
export declare function isFieldAllowedByRelations(field: string | FieldDetails, includes?: RelationsParseOutput, options?: { | ||
export declare function isFieldAllowedByRelations<T extends { | ||
value: string; | ||
}>(field: string | FieldDetails, includes?: T[], options?: { | ||
defaultAlias?: string; | ||
@@ -5,0 +6,0 @@ }): boolean; |
{ | ||
"name": "@trapi/query", | ||
"version": "2.0.5", | ||
"version": "2.1.0", | ||
"description": "An tiny library which provides utility types/functions for request and response query handling.", | ||
@@ -45,13 +45,13 @@ "main": "./dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^27.4.0", | ||
"@types/node": "^17.0.15", | ||
"@types/jest": "^27.4.1", | ||
"@types/node": "^17.0.21", | ||
"codecov": "^3.8.3", | ||
"cross-env": "^7.0.3", | ||
"jest": "^27.5.0", | ||
"minimatch": "^3.0.4", | ||
"jest": "^27.5.1", | ||
"minimatch": "^5.0.1", | ||
"ts-jest": "^27.1.3", | ||
"ts-node": "^10.4.0", | ||
"ts-node": "^10.7.0", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.5.5" | ||
"typescript": "^4.6.2" | ||
}, | ||
@@ -61,3 +61,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "9b5fb1a7dabaaa4c4ec2e5f6e8f44cb648451045" | ||
"gitHead": "d17ff94037efee8f2eac5bfab176da50de284d56" | ||
} |
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
164086
183
1807