electrodb
Advanced tools
Comparing version 0.9.39 to 0.9.40
{ | ||
"name": "electrodb", | ||
"version": "0.9.39", | ||
"version": "0.9.40", | ||
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb", | ||
@@ -11,3 +11,4 @@ "main": "index.js", | ||
"coverage": "nyc npm run test-all && nyc report --reporter=text-lcov | coveralls", | ||
"coverage-local": "LOCAL_DYNAMO_ENDPOINT=http://localhost:8000 nyc npm run test-all && nyc report --reporter=html" | ||
"coverage-coveralls-local": "nyc npm run test-all-local && nyc report --reporter=text-lcov | coveralls", | ||
"coverage-html-local": "nyc npm run test-all-local && nyc report --reporter=html" | ||
}, | ||
@@ -14,0 +15,0 @@ "repository": { |
@@ -773,3 +773,3 @@ "use strict"; | ||
); | ||
let { pk, sk } = this._makeIndexKeys( | ||
let { pk, sk } = this._makeIndexKeysWithoutTail( | ||
state.query.index, | ||
@@ -1167,2 +1167,25 @@ state.query.keys.pk, | ||
/* istanbul ignore next */ | ||
_makeIndexKeysWithoutTail(index = "", pkFacets = {}, ...skFacets) { | ||
this._validateIndex(index); | ||
if (!skFacets.length) { | ||
skFacets.push({}); | ||
} | ||
let facets = this.model.facets.byIndex[index]; | ||
let prefixes = this.model.prefixes[index]; | ||
if (!prefixes) { | ||
throw new Error(`Invalid index: ${index}`); | ||
} | ||
let pk = this._makeKey(prefixes.pk, facets.pk, pkFacets, this.model.facets.labels[index], true); | ||
let sk = []; | ||
if (this.model.lookup.indexHasSortKeys[index]) { | ||
for (let skFacet of skFacets) { | ||
sk.push( | ||
this._makeKey(prefixes.sk, facets.sk, skFacet, this.model.facets.labels[index], true), | ||
); | ||
} | ||
} | ||
return { pk, sk }; | ||
} | ||
/* istanbul ignore next */ | ||
_makeIndexKeys(index = "", pkFacets = {}, ...skFacets) { | ||
@@ -1178,8 +1201,3 @@ this._validateIndex(index); | ||
} | ||
let pk = this._makeKey( | ||
prefixes.pk, | ||
facets.pk, | ||
pkFacets, | ||
this.model.facets.labels[index] | ||
); | ||
let pk = this._makeKey(prefixes.pk, facets.pk, pkFacets, this.model.facets.labels[index]); | ||
let sk = []; | ||
@@ -1197,3 +1215,3 @@ if (this.model.lookup.indexHasSortKeys[index]) { | ||
/* istanbul ignore next */ | ||
_makeKey({prefix, isCustom} = {}, facets = [], supplied = {}, labels = {}) { | ||
_makeKey({prefix, isCustom} = {}, facets = [], supplied = {}, labels = {}, excludeLabelTail) { | ||
let key = prefix; | ||
@@ -1203,2 +1221,5 @@ for (let i = 0; i < facets.length; i++) { | ||
let { name } = this.model.schema.attributes[facet]; | ||
if (supplied[name] === undefined && excludeLabelTail) { | ||
break; | ||
} | ||
if (isCustom) { | ||
@@ -1205,0 +1226,0 @@ key = `${key}${labels[facet] === undefined ? "" : labels[facet]}`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
3495
2864
208179