New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rapiq

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rapiq - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

dist/parameter/fields/utils/name.d.ts

55

dist/parameter/fields/parse.js

@@ -30,8 +30,8 @@ "use strict";

const domainFields = (0, smob_1.merge)({}, defaultDomainFields, allowedDomainFields);
let domainKeys = Object.keys(domainFields);
let keys = Object.keys(domainFields);
// If it is an empty array nothing is allowed
if (domainKeys.length === 0) {
if ((typeof options.default !== 'undefined' ||
typeof options.allowed !== 'undefined') && keys.length === 0) {
return [];
}
domainKeys = Object.keys(domainFields);
const prototype = Object.prototype.toString.call(data);

@@ -51,16 +51,19 @@ if (prototype !== '[object Object]' &&

const reverseMapping = buildReverseRecord(options.mapping);
if (keys.length === 0) {
keys = Object.keys(data);
}
const output = [];
for (let i = 0; i < domainKeys.length; i++) {
const domainKey = domainKeys[i];
if (!(0, utils_1.isFieldPathAllowedByRelations)({ path: domainKey }, options.relations) &&
domainKey !== constants_1.DEFAULT_ID) {
for (let i = 0; i < keys.length; i++) {
const path = keys[i];
if (!(0, utils_1.isFieldPathAllowedByRelations)({ path }, options.relations) &&
path !== constants_1.DEFAULT_ID) {
continue;
}
let fields = [];
if ((0, utils_1.hasOwnProperty)(data, domainKey)) {
fields = (0, utils_3.parseFieldsInput)(data[domainKey]);
if ((0, utils_1.hasOwnProperty)(data, path)) {
fields = (0, utils_3.parseFieldsInput)(data[path]);
}
else if ((0, utils_1.hasOwnProperty)(reverseMapping, domainKey)) {
if ((0, utils_1.hasOwnProperty)(data, reverseMapping[domainKey])) {
fields = (0, utils_3.parseFieldsInput)(data[reverseMapping[domainKey]]);
else if ((0, utils_1.hasOwnProperty)(reverseMapping, path)) {
if ((0, utils_1.hasOwnProperty)(data, reverseMapping[path])) {
fields = (0, utils_3.parseFieldsInput)(data[reverseMapping[path]]);
}

@@ -75,16 +78,20 @@ }

for (let j = 0; j < fields.length; j++) {
fields[j] = (0, utils_1.applyMapping)((0, utils_1.buildFieldWithPath)({ name: fields[j], path: domainKey }), options.mapping, true);
fields[j] = (0, utils_1.applyMapping)((0, utils_1.buildFieldWithPath)({ name: fields[j], path }), options.mapping, true);
}
fields = fields
.filter((field) => domainFields[domainKey].indexOf((0, utils_3.removeFieldInputOperator)(field)) !== -1);
if ((0, utils_1.hasOwnProperty)(domainFields, path)) {
fields = fields.filter((field) => domainFields[path].indexOf((0, utils_3.removeFieldInputOperator)(field)) !== -1);
}
else {
fields = fields.filter((field) => (0, utils_3.isValidFieldName)((0, utils_3.removeFieldInputOperator)(field)));
}
transformed = (0, utils_3.transformFieldsInput)(fields);
}
if (transformed.default.length === 0 &&
(0, utils_1.hasOwnProperty)(defaultDomainFields, domainKey)) {
transformed.default = defaultDomainFields[domainKey];
(0, utils_1.hasOwnProperty)(defaultDomainFields, path)) {
transformed.default = defaultDomainFields[path];
}
if (transformed.included.length === 0 &&
transformed.default.length === 0 &&
(0, utils_1.hasOwnProperty)(allowedDomainFields, domainKey)) {
transformed.default = allowedDomainFields[domainKey];
(0, utils_1.hasOwnProperty)(allowedDomainFields, path)) {
transformed.default = allowedDomainFields[path];
}

@@ -103,10 +110,10 @@ transformed.default = Array.from(new Set([

for (let j = 0; j < transformed.default.length; j++) {
let path;
if (domainKey !== constants_1.DEFAULT_ID) {
path = domainKey;
let destPath;
if (path !== constants_1.DEFAULT_ID) {
destPath = path;
}
else if (options.defaultPath) {
path = options.defaultPath;
destPath = options.defaultPath;
}
output.push(Object.assign({ key: transformed.default[j] }, (path ? { path } : {})));
output.push(Object.assign({ key: transformed.default[j] }, (destPath ? { path: destPath } : {})));
}

@@ -113,0 +120,0 @@ }

export * from './domain';
export * from './input';
export * from './name';

@@ -25,2 +25,3 @@ "use strict";

__exportStar(require("./input"), exports);
__exportStar(require("./name"), exports);
//# sourceMappingURL=index.js.map

@@ -11,2 +11,3 @@ "use strict";

const utils_1 = require("../../utils");
const fields_1 = require("../fields");
const utils_2 = require("../utils");

@@ -33,8 +34,2 @@ const constants_1 = require("./constants");

}
function transformFiltersParseOutput(output) {
for (let i = 0; i < output.length; i++) {
output[i] = transformFiltersParseOutputElement(output[i]);
}
return output;
}
function buildDefaultFiltersParseOutput(options, input) {

@@ -79,14 +74,21 @@ const inputKeys = Object.keys(input || {});

// If it is an empty array nothing is allowed
if (typeof options.allowed === 'undefined' ||
options.allowed.length === 0) {
return [];
if (typeof options.allowed !== 'undefined') {
options.allowed = (0, utils_2.flattenParseAllowedOption)(options.allowed);
if (options.allowed.length === 0) {
return buildDefaultFiltersParseOutput(options);
}
}
/* istanbul ignore next */
if (typeof data !== 'object' || data === null) {
return transformFiltersParseOutput(buildDefaultFiltersParseOutput(options));
return buildDefaultFiltersParseOutput(options);
}
const { length } = Object.keys(data);
if (length === 0) {
return transformFiltersParseOutput(buildDefaultFiltersParseOutput(options));
return buildDefaultFiltersParseOutput(options);
}
if ((typeof options.allowed === 'undefined' || options.allowed.length === 0) &&
options.default) {
const flatten = (0, utils_1.flattenNestedObject)(options.default);
options.allowed = Object.keys(flatten);
}
const items = {};

@@ -112,2 +114,6 @@ // transform to appreciate data format & validate input

const fieldDetails = (0, utils_1.getFieldDetails)(keys[i]);
if (typeof options.allowed === 'undefined' &&
!(0, fields_1.isValidFieldName)(fieldDetails.name)) {
continue;
}
if (!(0, utils_1.isFieldPathAllowedByRelations)(fieldDetails, options.relations) &&

@@ -114,0 +120,0 @@ !(0, utils_1.isFieldNonRelational)(fieldDetails)) {

@@ -22,3 +22,3 @@ "use strict";

// If it is an empty array nothing is allowed
if (typeof options.allowed === 'undefined' ||
if (Array.isArray(options.allowed) &&
options.allowed.length === 0) {

@@ -54,2 +54,5 @@ return [];

}
else {
items = items.filter((item) => (0, utils_3.isValidRelationPath)(item));
}
if (options.includeParents) {

@@ -56,0 +59,0 @@ if (Array.isArray(options.includeParents)) {

export * from './parents';
export * from './path';

@@ -24,2 +24,3 @@ "use strict";

__exportStar(require("./parents"), exports);
__exportStar(require("./path"), exports);
//# sourceMappingURL=index.js.map

@@ -11,2 +11,3 @@ "use strict";

const utils_1 = require("../../utils");
const fields_1 = require("../fields");
const utils_2 = require("../utils");

@@ -49,5 +50,7 @@ const utils_3 = require("./utils");

// If it is an empty array nothing is allowed
if (Array.isArray(options.allowed) &&
options.allowed.length === 0) {
return [];
if (typeof options.allowed !== 'undefined') {
const allowed = (0, utils_2.flattenParseAllowedOption)(options.allowed);
if (allowed.length === 0) {
return buildDefaultSortParseOutput(options);
}
}

@@ -62,2 +65,7 @@ options.mapping = options.mapping || {};

}
if (typeof options.allowed === 'undefined' &&
options.default) {
const flatten = (0, utils_1.flattenNestedObject)(options.default);
options.allowed = Object.keys(flatten);
}
let parts = [];

@@ -91,2 +99,6 @@ if (typeof data === 'string') {

const fieldDetails = (0, utils_1.getFieldDetails)(key);
if (typeof options.allowed === 'undefined' &&
!(0, fields_1.isValidFieldName)(fieldDetails.name)) {
continue;
}
if (!(0, utils_1.isFieldPathAllowedByRelations)(fieldDetails, options.relations) &&

@@ -93,0 +105,0 @@ !(0, utils_1.isFieldNonRelational)(fieldDetails)) {

{
"name": "rapiq",
"version": "0.3.2",
"version": "0.4.0",
"description": "A tiny library which provides utility types/functions for request and response query handling.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc