Comparing version 1.0.71 to 1.0.72
@@ -54,3 +54,3 @@ "use strict"; | ||
// from https://stackoverflow.com/a/16608074 | ||
const is_simple_object = val => !!val && val.constructor === Object; | ||
const is_simple_object = val => { var _a; return !!val && (val.constructor === Object || ((_a = val.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'RowDataPacket'); }; | ||
exports.is_simple_object = is_simple_object; | ||
@@ -57,0 +57,0 @@ const deep_get = (path_array, obj, default_value = undefined) => { |
@@ -6,3 +6,3 @@ "use strict"; | ||
const nester_1 = require("../nester"); | ||
(0, mocha_1.describe)('nester', () => { | ||
mocha_1.describe.only('nester', () => { | ||
(0, mocha_1.test)('basic deep nesting', async () => { | ||
@@ -293,2 +293,26 @@ const data = [ | ||
}); | ||
(0, mocha_1.test)('dev test', () => { | ||
const data = [ | ||
[ | ||
['products', 0], | ||
[ | ||
{ | ||
id: 2497, | ||
}, | ||
], | ||
], | ||
[ | ||
['products', 0, 'variants', 0], | ||
[ | ||
{ | ||
id: 909, | ||
product_id: 2497, | ||
}, | ||
], | ||
], | ||
]; | ||
const edges = [null, ['id', 'product_id']]; | ||
const output = (0, nester_1.nester)(data, edges); | ||
const a = 1; | ||
}); | ||
}); |
@@ -48,4 +48,10 @@ "use strict"; | ||
const command_parser = sql_command_parsers[command]; | ||
// commands must start with $, so we can safely ignore any other commands, for instance nested subqueries | ||
if (!command_parser) { | ||
throw new Error(`Cannot find command parser for ${command}.`); | ||
if (command[0] === '$') { | ||
throw new Error(`Cannot find command parser for ${command}.`); | ||
} | ||
else { | ||
return ''; | ||
} | ||
} | ||
@@ -52,0 +58,0 @@ const args = expression[command]; |
@@ -27,2 +27,9 @@ "use strict"; | ||
const ancestor_result = previous_results.filter(previous_result => previous_result[0].toString() === ancestor_path.toString())[0]; | ||
if (ancestor_result === undefined) { | ||
// there can be no previous results if this is a nested entity and there is no higher entity. In this case | ||
// we want nothing of the lower entity to be queried, so we use an impossible where clause that returns nothing | ||
return { | ||
$eq: ['1', '2'] | ||
}; | ||
} | ||
const ancestor_rows = ancestor_result[1]; | ||
@@ -29,0 +36,0 @@ const ancestor_to_entity_path = subquery_path.slice(nesting_ancestor_index + 1, Infinity); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const introspector_1 = require("../../introspector/introspector"); | ||
{ | ||
const test = () => { | ||
const test_schema = (0, introspector_1.as_orma_schema)({ | ||
@@ -26,3 +26,3 @@ products: { | ||
name: { | ||
data_type: 'varchar' | ||
data_type: 'varchar', | ||
}, | ||
@@ -80,3 +80,3 @@ $indexes: [], | ||
products: { | ||
id: true | ||
id: true, | ||
}, | ||
@@ -91,3 +91,3 @@ }); | ||
products: { | ||
my_id: 'id' | ||
my_id: 'id', | ||
}, | ||
@@ -105,5 +105,5 @@ }); | ||
products: { | ||
name: true | ||
} | ||
} | ||
name: true, | ||
}, | ||
}, | ||
}, | ||
@@ -114,2 +114,2 @@ }); | ||
} | ||
} | ||
}; |
{ | ||
"name": "orma", | ||
"version": "1.0.71", | ||
"version": "1.0.72", | ||
"description": "A declarative relational syncronous orm", | ||
@@ -5,0 +5,0 @@ "main": "build/index.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
400966
10201