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

fib-app

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fib-app - npm Package Compare versions

Comparing version 1.13.25 to 1.13.26

10

CHANGELOG.md
v1.13.25 / 2019-03-16
v1.13.26 / 2019-03-19
==================
* feat: throw error when trying to find invalid association name for `findby`.
* fix: wrong arg when _find in base-extend rest find.
* test case code normalization.
v1.13.25 / 2019-03-16
=====================
* Release v1.13.25
* support use `join_where` option in query for has-many assoc.

@@ -6,0 +14,0 @@ * apply model's field `associations`.

2

lib/http/base.js

@@ -125,3 +125,3 @@ /// <reference types="@fxjs/orm" />

return {
success: query_1.found_result_selector(_find(req, cls.find.bind(cls), { bmodel: cls }), !query_1.is_count_required(req.query) ? 'results' : '')
success: query_1.found_result_selector(_find(req, cls.find.bind(cls), cls), !query_1.is_count_required(req.query) ? 'results' : '')
};

@@ -128,0 +128,0 @@ };

@@ -230,7 +230,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

return {
success: query_1.found_result_selector(_find(req, obj.inst[_association.getAccessor].bind(obj.inst), {
bmodel: obj.inst.model(),
binstance: obj.inst,
extend
}), !query_1.is_count_required(req.query) ? 'results' : '')
success: query_1.found_result_selector(_find(req, obj.inst[_association.getAccessor].bind(obj.inst), cls, extend), !query_1.is_count_required(req.query) ? 'results' : '')
};

@@ -237,0 +233,0 @@ };

@@ -5,4 +5,3 @@ const util = require("util");

const query_1 = require("./query");
module.exports = function (req, finder, opts) {
const { extend = undefined, bmodel = null, binstance = null, } = opts || {};
module.exports = function (req, finder, base_model, extend_in_rest) {
const query = req.query;

@@ -13,4 +12,6 @@ let exists_args = [];

(() => {
if (!base_model)
return;
var findby = query_1.parse_json_queryarg(req, 'findby');
var { exists: findby_exists, findby_infos } = query_1.query_filter_findby(findby, bmodel, { req });
var { exists: findby_exists, findby_infos } = query_1.query_filter_findby(findby, base_model, { req, extend_in_rest });
if (findby_infos && findby_infos.length) {

@@ -27,2 +28,4 @@ findby_infos.forEach(findby_info => {

})();
var where = query_1.query_filter_where(req);
init_conditions = util.extend(init_conditions, where);
const join_where = query_1.query_filter_join_where(req);

@@ -35,4 +38,2 @@ let exec = finder(init_conditions, { join_where });

exec = exec.only(keys);
var where = query_1.query_filter_where(req);
exec = exec.where(where, { join_where });
var skip = query_1.query_filter_skip(query);

@@ -51,4 +52,4 @@ exec = exec.offset(skip);

let a;
if (extend !== undefined)
a = checkout_acl_1.checkout_robj_acl(req.session, 'read', binstance, obj, extend);
if (extend_in_rest !== undefined)
a = checkout_acl_1.checkout_robj_acl(req.session, 'read', new base_model(), obj, extend_in_rest);
else

@@ -55,0 +56,0 @@ a = checkout_acl_1.checkout_obj_acl(req.session, 'read', obj);

@@ -20,4 +20,10 @@ /// <reference lib="es2017" />

exports.query_filter_join_where = query_filter_join_where;
function query_filter_findby(findby, exec_model, opts) {
const { req } = opts;
function assert_valid_findby(found_assoc, findby, exec_model) {
if (!found_assoc) {
throw `invalid association symbol '${findby.extend}' for model '${exec_model.model_name || exec_model.table}'`;
}
return true;
}
function query_filter_findby(findby, base_model, opts) {
const { req, extend_in_rest = '' } = opts;
const __wrapper = { exists: null, findby_infos: [] };

@@ -29,9 +35,11 @@ if (!findby)

let found_assoc;
const exec_model = extend_in_rest && base_model.associations[extend_in_rest] ? base_model.associations[extend_in_rest].association.model : base_model;
const exec_instance = new exec_model();
(() => {
if (findby.on
&& (found_assoc = Helpers.getManyAssociationItemFromInstanceByExtname(exec_instance, findby.extend))) {
if (!findby.on)
return;
if (found_assoc = Helpers.getManyAssociationItemFromInstanceByExtname(exec_instance, findby.extend)) {
const hasmany_assoc = found_assoc;
// TODO: make sure order of mg_ks is corresponding to mks
const mg_ks = Object.values(hasmany_assoc.mergeId).map(x => x.mapsTo);
const mg_ks = Object.keys(hasmany_assoc.mergeId).map(k => hasmany_assoc.mergeId[k].mapsTo || k);
const mks = exec_model.id;

@@ -55,9 +63,11 @@ if (!checkout_acl_1.checkout_acl(req.session, 'find', exec_model.ACL, findby.extend))

}
assert_valid_findby(found_assoc, findby, exec_model);
})();
;
(() => {
if (findby.where
&& ((found_assoc = Helpers.getAssociationItemFromInstanceByExtname('hasOne', exec_instance, findby.extend))
|| (found_assoc = Helpers.getAssociationItemFromInstanceByExtname('hasMany', exec_instance, findby.extend))
|| (found_assoc = Helpers.getAssociationItemFromInstanceByExtname('extendsTo', exec_instance, findby.extend)))) {
if (!findby.where)
return;
if ((found_assoc = Helpers.getAssociationItemFromInstanceByExtname('hasOne', exec_instance, findby.extend))
|| (found_assoc = Helpers.getAssociationItemFromInstanceByExtname('hasMany', exec_instance, findby.extend))
|| (found_assoc = Helpers.getAssociationItemFromInstanceByExtname('extendsTo', exec_instance, findby.extend))) {
const findby_conditions = findby.where;

@@ -86,2 +96,3 @@ if (!filter_conditions(findby_conditions))

}
assert_valid_findby(found_assoc, findby, exec_model);
})();

@@ -88,0 +99,0 @@ return __wrapper;

{
"name": "fib-app",
"version": "1.13.25",
"version": "1.13.26",
"description": "",

@@ -5,0 +5,0 @@ "main": "./lib",

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