Comparing version 0.6.5 to 0.6.6
@@ -378,3 +378,3 @@ 'use strict'; | ||
function parseQueryFields(data, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
const defaultDomainFields = groupArrayByKeyPath( | ||
@@ -405,3 +405,3 @@ flattenParseAllowedOption(options.default) | ||
} | ||
options.mapping ??= {}; | ||
options.mapping = options.mapping || {}; | ||
const reverseMapping = buildReverseRecord(options.mapping); | ||
@@ -722,3 +722,3 @@ if (keys.length === 0) { | ||
function parseQueryFilters(data, options) { | ||
options = options ?? {}; | ||
options = options || {}; | ||
options.mapping = options.mapping || {}; | ||
@@ -815,3 +815,3 @@ options.relations = options.relations || []; | ||
function parseQueryPagination(data, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
const pagination = {}; | ||
@@ -869,3 +869,3 @@ const prototype = Object.prototype.toString.call(data); | ||
function parseQueryRelations(data, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
if (Array.isArray(options.allowed) && options.allowed.length === 0) { | ||
@@ -876,3 +876,5 @@ return []; | ||
options.pathMapping = options.pathMapping || {}; | ||
options.includeParents ??= true; | ||
if (typeof options.includeParents === "undefined") { | ||
options.includeParents = true; | ||
} | ||
let items = []; | ||
@@ -1002,3 +1004,3 @@ const prototype = Object.prototype.toString.call(data); | ||
function parseQuerySort(data, options) { | ||
options = options ?? {}; | ||
options = options || {}; | ||
if (typeof options.allowed !== "undefined") { | ||
@@ -1199,3 +1201,3 @@ const allowed = flattenParseAllowedOption(options.allowed); | ||
function parseQuery(input, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
const mergeWithGlobalOptions = (data) => { | ||
@@ -1225,3 +1227,3 @@ if (typeof data !== "undefined") { | ||
case Parameter.RELATIONS: { | ||
const value = input[Parameter.RELATIONS] ?? input[URLParameter.RELATIONS]; | ||
const value = input[Parameter.RELATIONS] || input[URLParameter.RELATIONS]; | ||
if (value && isQueryParameterEnabled(options[Parameter.RELATIONS])) { | ||
@@ -1238,3 +1240,3 @@ relations = parseQueryParameter( | ||
case Parameter.FIELDS: { | ||
const value = input[Parameter.FIELDS] ?? input[URLParameter.FIELDS]; | ||
const value = input[Parameter.FIELDS] || input[URLParameter.FIELDS]; | ||
if (value && isQueryParameterEnabled(options[Parameter.FIELDS])) { | ||
@@ -1251,3 +1253,3 @@ output[Parameter.FIELDS] = parseQueryParameter( | ||
case Parameter.FILTERS: { | ||
const value = input[Parameter.FILTERS] ?? input[URLParameter.FILTERS]; | ||
const value = input[Parameter.FILTERS] || input[URLParameter.FILTERS]; | ||
if (value && isQueryParameterEnabled(options[Parameter.FILTERS])) { | ||
@@ -1264,3 +1266,3 @@ output[Parameter.FILTERS] = parseQueryParameter( | ||
case Parameter.PAGINATION: { | ||
const value = input[Parameter.PAGINATION] ?? input[URLParameter.PAGINATION]; | ||
const value = input[Parameter.PAGINATION] || input[URLParameter.PAGINATION]; | ||
if (value && isQueryParameterEnabled(options[Parameter.PAGINATION])) { | ||
@@ -1277,3 +1279,3 @@ output[Parameter.PAGINATION] = parseQueryParameter( | ||
case Parameter.SORT: { | ||
const value = input[Parameter.SORT] ?? input[URLParameter.SORT]; | ||
const value = input[Parameter.SORT] || input[URLParameter.SORT]; | ||
if (value && isQueryParameterEnabled(options[Parameter.SORT])) { | ||
@@ -1280,0 +1282,0 @@ output[Parameter.SORT] = parseQueryParameter( |
@@ -374,3 +374,3 @@ import { createMerger, merge, mergeArrays } from 'smob'; | ||
function parseQueryFields(data, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
const defaultDomainFields = groupArrayByKeyPath( | ||
@@ -401,3 +401,3 @@ flattenParseAllowedOption(options.default) | ||
} | ||
options.mapping ??= {}; | ||
options.mapping = options.mapping || {}; | ||
const reverseMapping = buildReverseRecord(options.mapping); | ||
@@ -718,3 +718,3 @@ if (keys.length === 0) { | ||
function parseQueryFilters(data, options) { | ||
options = options ?? {}; | ||
options = options || {}; | ||
options.mapping = options.mapping || {}; | ||
@@ -811,3 +811,3 @@ options.relations = options.relations || []; | ||
function parseQueryPagination(data, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
const pagination = {}; | ||
@@ -865,3 +865,3 @@ const prototype = Object.prototype.toString.call(data); | ||
function parseQueryRelations(data, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
if (Array.isArray(options.allowed) && options.allowed.length === 0) { | ||
@@ -872,3 +872,5 @@ return []; | ||
options.pathMapping = options.pathMapping || {}; | ||
options.includeParents ??= true; | ||
if (typeof options.includeParents === "undefined") { | ||
options.includeParents = true; | ||
} | ||
let items = []; | ||
@@ -998,3 +1000,3 @@ const prototype = Object.prototype.toString.call(data); | ||
function parseQuerySort(data, options) { | ||
options = options ?? {}; | ||
options = options || {}; | ||
if (typeof options.allowed !== "undefined") { | ||
@@ -1195,3 +1197,3 @@ const allowed = flattenParseAllowedOption(options.allowed); | ||
function parseQuery(input, options) { | ||
options ??= {}; | ||
options = options || {}; | ||
const mergeWithGlobalOptions = (data) => { | ||
@@ -1221,3 +1223,3 @@ if (typeof data !== "undefined") { | ||
case Parameter.RELATIONS: { | ||
const value = input[Parameter.RELATIONS] ?? input[URLParameter.RELATIONS]; | ||
const value = input[Parameter.RELATIONS] || input[URLParameter.RELATIONS]; | ||
if (value && isQueryParameterEnabled(options[Parameter.RELATIONS])) { | ||
@@ -1234,3 +1236,3 @@ relations = parseQueryParameter( | ||
case Parameter.FIELDS: { | ||
const value = input[Parameter.FIELDS] ?? input[URLParameter.FIELDS]; | ||
const value = input[Parameter.FIELDS] || input[URLParameter.FIELDS]; | ||
if (value && isQueryParameterEnabled(options[Parameter.FIELDS])) { | ||
@@ -1247,3 +1249,3 @@ output[Parameter.FIELDS] = parseQueryParameter( | ||
case Parameter.FILTERS: { | ||
const value = input[Parameter.FILTERS] ?? input[URLParameter.FILTERS]; | ||
const value = input[Parameter.FILTERS] || input[URLParameter.FILTERS]; | ||
if (value && isQueryParameterEnabled(options[Parameter.FILTERS])) { | ||
@@ -1260,3 +1262,3 @@ output[Parameter.FILTERS] = parseQueryParameter( | ||
case Parameter.PAGINATION: { | ||
const value = input[Parameter.PAGINATION] ?? input[URLParameter.PAGINATION]; | ||
const value = input[Parameter.PAGINATION] || input[URLParameter.PAGINATION]; | ||
if (value && isQueryParameterEnabled(options[Parameter.PAGINATION])) { | ||
@@ -1273,3 +1275,3 @@ output[Parameter.PAGINATION] = parseQueryParameter( | ||
case Parameter.SORT: { | ||
const value = input[Parameter.SORT] ?? input[URLParameter.SORT]; | ||
const value = input[Parameter.SORT] || input[URLParameter.SORT]; | ||
if (value && isQueryParameterEnabled(options[Parameter.SORT])) { | ||
@@ -1276,0 +1278,0 @@ output[Parameter.SORT] = parseQueryParameter( |
{ | ||
"name": "rapiq", | ||
"version": "0.6.5", | ||
"version": "0.6.6", | ||
"description": "A tiny library which provides utility types/functions for request and response query handling.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
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
113867
2931