electrodb
Advanced tools
Comparing version 0.9.6 to 0.9.7
{ | ||
"name": "electrodb", | ||
"version": "0.9.6", | ||
"version": "0.9.7", | ||
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -215,5 +215,3 @@ "use strict"; | ||
async go(method, params = {}, options = {}) { | ||
_applyParameterOptions(params = {}, options = {}) { | ||
let config = { | ||
@@ -228,9 +226,24 @@ includeKeys: options.includeKeys, | ||
let parameters = Object.assign({}, params); | ||
for (let [name, value] of Object.entries(config.params)) { | ||
if (value !== undefined) { | ||
parameters[name] = value; | ||
for (let customParameter of Object.keys(config.params)) { | ||
if (config.params[customParameter] !== undefined) { | ||
parameters[customParameter] = config.params[customParameter]; | ||
} | ||
} | ||
if (Object.keys(config.page || {}).length) { | ||
parameters.ExclusiveStartKey = config.page; | ||
} | ||
return parameters; | ||
} | ||
async go(method, params = {}, options = {}) { | ||
let config = { | ||
includeKeys: options.includeKeys, | ||
originalErr: options.originalErr, | ||
raw: options.raw, | ||
params: options.params || {}, | ||
page: options.page, | ||
pager: !!options.pager | ||
}; | ||
let parameters = Object.assign({}, params); | ||
let stackTrace = new Error(); | ||
@@ -255,13 +268,15 @@ try { | ||
_params({ keys = {}, method = "", put = {}, update = {}, filter = {} } = {}) { | ||
_params({ keys = {}, method = "", put = {}, update = {}, filter = {} } = {}, options = {}) { | ||
let conlidatedQueryFacets = this._consolidateQueryFacets(keys.sk); | ||
let params = {} | ||
switch (method) { | ||
case MethodTypes.get: | ||
case MethodTypes.delete: | ||
return this._makeSimpleIndexParams(keys.pk, ...conlidatedQueryFacets); | ||
params = this._makeSimpleIndexParams(keys.pk, ...conlidatedQueryFacets); | ||
break; | ||
case MethodTypes.put: | ||
return this._makePutParams(put, keys.pk, ...keys.sk); | ||
params = this._makePutParams(put, keys.pk, ...keys.sk); | ||
break; | ||
case MethodTypes.update: | ||
return this._makeUpdateParams( | ||
params = this._makeUpdateParams( | ||
update, | ||
@@ -271,7 +286,10 @@ keys.pk, | ||
); | ||
break; | ||
case MethodTypes.scan: | ||
return this._makeScanParam(filter); | ||
params = this._makeScanParam(filter); | ||
break; | ||
default: | ||
throw new Error(`Invalid method: ${method}`); | ||
} | ||
return this._applyParameterOptions(params, options); | ||
} | ||
@@ -526,7 +544,3 @@ | ||
} | ||
// if (typeof options.page === "string" && options.page.length) { | ||
if (Object.keys(options.page || {}).length) { | ||
parameters.ExclusiveStartKey = options.page; | ||
} | ||
return parameters; | ||
return this._applyParameterOptions(parameters, options); | ||
} | ||
@@ -533,0 +547,0 @@ |
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
293761
6165