@izara_project/izara-core-library-dynamodb 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-library-dynamodb",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Connecting with AWS DynamoDB Resource",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -51,7 +51,7 @@ const dynamodb = DynamoDBDocument.from(new DynamoDB(), {
51
51
  * @returns {string} full tablename
52
52
  */
53
53
 
54
- async function tableName(_izContext, tableName, serviceTag = null) {
54
+ function tableName(_izContext, tableName, serviceTag = null) {
55
55
  if (!serviceTag) {
56
56
  return process.env.iz_serviceTag + process.env.iz_stage + tableName;
57
57
  } else {
@@ -330,7 +330,7 @@ function processLogicalElements(_izContext, logicalElements, level) {
330
330
  // _izContext.logger.debug("I'm going in recursion");
331
331
 
332
332
  conditionalExpression += '(';
333
- conditionalExpression += this.processLogicalElements(_izContext, logicalElement.elements, level + 1); // ***recursion***
333
+ conditionalExpression += processLogicalElements(_izContext, logicalElement.elements, level + 1); // ***recursion***
334
334
  conditionalExpression += ')'; // close sub-group
335
335
 
336
336
  } else { // end group types
@@ -690,7 +690,7 @@ async function query(_izContext, tableName, partitionKeyValue, queryElements = {
690
690
  */
691
691
  async function queryResults(_izContext, tableName, partitionKeyValue, queryElements = {}, settings = {}) {
692
692
 
693
- const queryResults = await this.query(
693
+ const queryResults = await query(
694
694
  _izContext,
695
695
  tableName,
696
696
  partitionKeyValue,
@@ -773,7 +773,7 @@ async function putItem(
773
773
  if (!Array.isArray(attributes[idx].value) || attributes[idx].value.length === 0) { // validate attributes value
774
774
  throw new NoRetryError('attributes value should be array and not empty.');
775
775
  }
776
- attributes[idx].value = this.arrayToStringSet(attributes[idx].value);
776
+ attributes[idx].value = arrayToStringSet(attributes[idx].value);
777
777
  }
778
778
  payload.Item[`${attributes[idx].attributeName}`] = attributes[idx].value;
779
779
 
@@ -1084,7 +1084,7 @@ async function updateItem(
1084
1084
 
1085
1085
  // attach value placeholders
1086
1086
  if (Object.prototype.hasOwnProperty.call(item, 'isStringSet') && item.isStringSet === true) {
1087
- item.value = this.arrayToStringSet(item.value);
1087
+ item.value = arrayToStringSet(item.value);
1088
1088
  }
1089
1089
  if (Object.prototype.hasOwnProperty.call(item, 'value')) {
1090
1090
  payload.ExpressionAttributeValues[':' + valueReference] = item.value;
@@ -1599,7 +1599,7 @@ async function batchDeleteItems(
1599
1599
  */
1600
1600
  async function batchPutItems(
1601
1601
  _izContext,
1602
- tableName,
1602
+ tableNameData,
1603
1603
  writeItems,
1604
1604
  settings // for batchWriteItems command,e.g., ReturnConsumedCapacity, ConsumedCapacity
1605
1605
  ) {
@@ -1643,7 +1643,7 @@ async function batchPutItems(
1643
1643
  // NOTE: not help, cannot use complex in this batchWrite command just validata attributes and add context.
1644
1644
  let putItemPayload = await module.exports.putItem(
1645
1645
  _izContext,
1646
- await this.tableName(_izContext, tableName),
1646
+ await tableName(_izContext, tableNameData),
1647
1647
  chunkSet[i].attributes,
1648
1648
  chunkSet[i].queryElements,
1649
1649
  chunkSet[i].settings
@@ -1659,7 +1659,7 @@ async function batchPutItems(
1659
1659
 
1660
1660
  let payload = {
1661
1661
  RequestItems: {
1662
- [tableName]: requestItems
1662
+ [tableNameData]: requestItems
1663
1663
  },
1664
1664
  ReturnConsumedCapacity: "TOTAL"
1665
1665
  };