electrodb
Advanced tools
Comparing version 0.8.16 to 0.8.17
{ | ||
"name": "electrodb", | ||
"version": "0.8.16", | ||
"version": "0.8.17", | ||
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "mocha ./test/offline**.spec.js", | ||
"test-all": "mocha ./test/**.spec.js" | ||
}, | ||
@@ -9,0 +10,0 @@ "repository": { |
# ElectroDB | ||
![ElectroDB](https://github.com/tywalch/electrodb/blob/master/assets/electrodb.png?raw=true) | ||
***ElectroDB*** is a dynamodb library to ease the use of having multiple entities and complex heretical relationships in a single dynamodb table. | ||
***ElectroDB*** is a dynamodb library to ease the use of having multiple entities and complex hierarchical relationships in a single dynamodb table. | ||
@@ -6,0 +6,0 @@ *This library is a work in progress, please submit issues/feedback or reach out on twitter [@tinkertamper](https://twitter.com/tinkertamper)*. |
@@ -405,4 +405,2 @@ "use strict"; | ||
data[attr] = value; | ||
} else { | ||
// an index key | ||
} | ||
@@ -829,3 +827,3 @@ } | ||
attributes, | ||
facets | ||
facets, | ||
); | ||
@@ -862,3 +860,6 @@ let incompleteAccessPatterns = incomplete.map( | ||
let keyAttributes = { ...sk, ...pk }; | ||
let completeFacets = this._expectIndexFacets({...set}, {...keyAttributes}); | ||
let completeFacets = this._expectIndexFacets( | ||
{ ...set }, | ||
{ ...keyAttributes }, | ||
); | ||
// complete facets, only includes impacted facets which likely does not include the updateIndex which then needs to be added here. | ||
@@ -917,3 +918,7 @@ if (!completeFacets.indexes.includes(updateIndex)) { | ||
...impact.missing, | ||
...pk.filter(attr => !impacted[KeyTypes.pk].includes(attr) && !includedFacets.includes(attr)), | ||
...pk.filter( | ||
attr => | ||
!impacted[KeyTypes.pk].includes(attr) && | ||
!includedFacets.includes(attr), | ||
), | ||
]; | ||
@@ -924,3 +929,7 @@ } | ||
...impact.missing, | ||
...sk.filter(attr => !impacted[KeyTypes.sk].includes(attr) && !includedFacets.includes(attr)), | ||
...sk.filter( | ||
attr => | ||
!impacted[KeyTypes.sk].includes(attr) && | ||
!includedFacets.includes(attr), | ||
), | ||
]; | ||
@@ -934,3 +943,3 @@ } | ||
}) | ||
.filter(({missing}) => missing.length) | ||
.filter(({ missing }) => missing.length) | ||
.reduce((result, { missing }) => [...result, ...missing], []); | ||
@@ -937,0 +946,0 @@ let isIncomplete = !!incomplete.length; |
@@ -15,34 +15,67 @@ let queryChildren = [ | ||
let FilterTypes = { | ||
eq: function eq(name, value) { | ||
return `${name} = ${value}`; | ||
eq: { | ||
template: function eq(name, value) { | ||
return `${name} = ${value}`; | ||
}, | ||
strict: true, | ||
}, | ||
gt: function gt(name, value) { | ||
return `${name} > ${value}`; | ||
gt: { | ||
template: function gt(name, value) { | ||
return `${name} > ${value}`; | ||
}, | ||
strict: false | ||
}, | ||
lt: function lt(name, value) { | ||
return `${name} < ${value}`; | ||
lt: { | ||
template: function lt(name, value) { | ||
return `${name} < ${value}`; | ||
}, | ||
strict: false | ||
}, | ||
gte: function gte(name, value) { | ||
return `${name} >= ${value}`; | ||
gte: { | ||
template: function gte(name, value) { | ||
return `${name} >= ${value}`; | ||
}, | ||
strict: false | ||
}, | ||
lte: function lte(name, value) { | ||
return `${name} <= ${value}`; | ||
lte: { | ||
template: function lte(name, value) { | ||
return `${name} <= ${value}`; | ||
}, | ||
strict: false | ||
}, | ||
between: function between(name, value1, value2) { | ||
return `(${name} between ${value1} and ${value2})`; | ||
between: { | ||
template: function between(name, value1, value2) { | ||
return `(${name} between ${value1} and ${value2})`; | ||
}, | ||
strict: false | ||
}, | ||
begins: function begins(name, value) { | ||
return `begins_with(${name}, ${value})`; | ||
begins: { | ||
template: function begins(name, value) { | ||
return `begins_with(${name}, ${value})`; | ||
}, | ||
strict: false | ||
}, | ||
exists: function exists(name, value) { | ||
return `exists(${name}, ${value})`; | ||
exists: { | ||
template: function exists(name, value) { | ||
return `exists(${name}, ${value})`; | ||
}, | ||
strict: false | ||
}, | ||
notExists: function notExists(name, value) { | ||
return `not exists(${name}, ${value})`; | ||
notExists: { | ||
template: function notExists(name, value) { | ||
return `not exists(${name}, ${value})`; | ||
}, | ||
strict: false | ||
}, | ||
contains: function contains(name, value) { | ||
return `contains(${name}, ${value})`; | ||
contains: { | ||
template: function contains(name, value) { | ||
return `contains(${name}, ${value})`; | ||
}, | ||
strict: false | ||
}, | ||
notContains: function notContains(name, value) { | ||
return `not contains(${name}, ${value})`; | ||
notContains: { | ||
template: function notContains(name, value) { | ||
return `not contains(${name}, ${value})`; | ||
}, | ||
strict: false | ||
}, | ||
@@ -63,3 +96,3 @@ }; | ||
let filterAttribute = {}; | ||
for (let [type, template] of Object.entries(this.filters)) { | ||
for (let [type, {strict, template}] of Object.entries(this.filters)) { | ||
Object.defineProperty(filterAttribute, type, { | ||
@@ -72,5 +105,7 @@ get: () => { | ||
for (let value of values) { | ||
let [isValid, errMessage] = attribute.isValid(value); | ||
if (!isValid) { | ||
throw new Error(errMessage); | ||
if (strict) { | ||
let [isValid, errMessage] = attribute.isValid(value); | ||
if (!isValid) { | ||
throw new Error(errMessage); | ||
} | ||
} | ||
@@ -77,0 +112,0 @@ |
@@ -12,3 +12,2 @@ tests: | ||
- test for invalid cast type | ||
- test for regex validation | ||
- test for invalid attribute type | ||
@@ -15,0 +14,0 @@ - test for bad "isValid" attribute result |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
230830
4372
1
1