electrodb
Advanced tools
Comparing version 0.9.38 to 0.9.39
{ | ||
"name": "electrodb", | ||
"version": "0.9.38", | ||
"version": "0.9.39", | ||
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -459,5 +459,9 @@ "use strict"; | ||
_makeCreateConditions(index) { | ||
let filter = [`attribute_not_exists(pk)`]; | ||
if (this.model.lookup.indexHasSortKeys[index]) { | ||
filter.push(`attribute_not_exists(sk)`); | ||
let hasSortKey = this.model.lookup.indexHasSortKeys[index]; | ||
let accessPattern = this.model.translations.indexes.fromIndexToAccessPattern[index]; | ||
let pkField = this.model.indexes[accessPattern].pk.field; | ||
let filter = [`attribute_not_exists(${pkField})`]; | ||
if (hasSortKey) { | ||
let skField = this.model.indexes[accessPattern].sk.field; | ||
filter.push(`attribute_not_exists(${skField})`); | ||
} | ||
@@ -468,5 +472,10 @@ return filter.join(" AND "); | ||
_makePatchConditions(index) { | ||
let filter = [`attribute_exists(pk)`]; | ||
if (this.model.lookup.indexHasSortKeys[index]) { | ||
filter.push(`attribute_exists(sk)`); | ||
let hasSortKey = this.model.lookup.indexHasSortKeys[index]; | ||
let accessPattern = this.model.translations.indexes.fromIndexToAccessPattern[index]; | ||
let pkField = this.model.indexes[accessPattern].pk.field; | ||
let filter = [`attribute_exists(${pkField})`]; | ||
if (hasSortKey) { | ||
let skField = this.model.indexes[accessPattern].sk.field; | ||
filter.push(`attribute_exists(${skField})`); | ||
} | ||
@@ -586,2 +595,4 @@ return filter.join(" AND "); | ||
let hasSortKey = this.model.lookup.indexHasSortKeys[indexBase]; | ||
let accessPattern = this.model.translations.indexes.fromIndexToAccessPattern[indexBase]; | ||
let pkField = this.model.indexes[accessPattern].pk.field; | ||
// let facets = this.model.facets.byIndex[indexBase]; | ||
@@ -601,3 +612,3 @@ let {pk, sk} = this._makeIndexKeys(indexBase); | ||
), | ||
FilterExpression: `(begins_with(#pk, :pk)`, | ||
FilterExpression: `begins_with(#${pkField}, :${pkField})`, | ||
}; | ||
@@ -610,3 +621,4 @@ params.ExpressionAttributeNames["#" + this.identifiers.entity] = this.identifiers.entity; | ||
if (hasSortKey) { | ||
params.FilterExpression = `${params.FilterExpression} AND begins_with(#sk, :sk))`; | ||
let skField = this.model.indexes[accessPattern].sk.field; | ||
params.FilterExpression = `${params.FilterExpression} AND begins_with(#${skField}, :${skField})`; | ||
} | ||
@@ -613,0 +625,0 @@ if (filter.FilterExpression) { |
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
247720
3475