@izara_project/izara-core-library-dynamodb 1.0.15 → 1.0.16
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/index.js +3 -3
- package/package.json +30 -6
- package/src/DynamoDBSharedLib.js +11 -19
package/index.js
CHANGED
|
@@ -15,9 +15,9 @@ You should have received a copy of the GNU Affero General Public License
|
|
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
18
|
// Re-export everything from DynamoDBSharedLib
|
|
21
19
|
import dynamoDBSharedLib from './src/DynamoDBSharedLib.js';
|
|
22
20
|
|
|
23
|
-
export default
|
|
21
|
+
export default {
|
|
22
|
+
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-library-dynamodb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Connecting with AWS DynamoDB Resource",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,17 +14,41 @@
|
|
|
14
14
|
"license": "AGPL-3.0-or-later",
|
|
15
15
|
"homepage": "https://bitbucket.org/izara-core-libraries/izara-core-library-dynamodb/src/master/README.md",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"jest": "^30.
|
|
17
|
+
"jest": "^30.4.0"
|
|
18
18
|
},
|
|
19
19
|
"jest": {
|
|
20
20
|
"testEnvironment": "node"
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
|
-
"
|
|
24
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
25
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
26
|
-
"@aws-sdk/util-dynamodb": "^3.
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@aws-sdk/client-dynamodb": "^3.0.0",
|
|
25
|
+
"@aws-sdk/lib-dynamodb": "^3.0.0",
|
|
26
|
+
"@aws-sdk/util-dynamodb": "^3.0.0",
|
|
27
27
|
"@izara_project/izara-core-library-core": "^1.0.28",
|
|
28
28
|
"lodash.clonedeep": "^4.5.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependenciesMeta": {
|
|
31
|
+
"@aws-sdk/client-dynamodb": {
|
|
32
|
+
"optional": false
|
|
33
|
+
},
|
|
34
|
+
"@aws-sdk/lib-dynamodb": {
|
|
35
|
+
"optional": false
|
|
36
|
+
},
|
|
37
|
+
"@aws-sdk/util-dynamodb": {
|
|
38
|
+
"optional": false
|
|
39
|
+
},
|
|
40
|
+
"@izara_project/izara-core-library-core": {
|
|
41
|
+
"optional": false
|
|
42
|
+
},
|
|
43
|
+
"lodash.clonedeep": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@aws-sdk/client-dynamodb": "^3.1045.0",
|
|
49
|
+
"@aws-sdk/lib-dynamodb": "^3.1045.0",
|
|
50
|
+
"@aws-sdk/util-dynamodb": "^3.996.2",
|
|
51
|
+
"@izara_project/izara-core-library-core": "^1.0.32",
|
|
52
|
+
"lodash.clonedeep": "^4.5.0"
|
|
29
53
|
}
|
|
30
54
|
}
|
package/src/DynamoDBSharedLib.js
CHANGED
|
@@ -15,8 +15,6 @@ You should have received a copy of the GNU Affero General Public License
|
|
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
18
|
import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
|
|
21
19
|
import { DynamoDB } from '@aws-sdk/client-dynamodb';
|
|
22
20
|
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb';
|
|
@@ -202,7 +200,7 @@ function processLogicalElements(_izContext, logicalElements, level) {
|
|
|
202
200
|
if (level > MAX_RECURSION_LEVEL) {
|
|
203
201
|
throw new Error(
|
|
204
202
|
`exceeded maximum recursion level for property checks: ` +
|
|
205
|
-
|
|
203
|
+
MAX_RECURSION_LEVEL
|
|
206
204
|
);
|
|
207
205
|
}
|
|
208
206
|
|
|
@@ -616,7 +614,7 @@ async function query(
|
|
|
616
614
|
//unrecognised comparison
|
|
617
615
|
throw new NoRetryError(
|
|
618
616
|
'Unrecognised comparison in sortKeyCondition ' +
|
|
619
|
-
|
|
617
|
+
queryElements.sortKeyCondition.comparison
|
|
620
618
|
);
|
|
621
619
|
}
|
|
622
620
|
|
|
@@ -826,7 +824,6 @@ async function queryResults(
|
|
|
826
824
|
return queryResults.Items;
|
|
827
825
|
}
|
|
828
826
|
|
|
829
|
-
|
|
830
827
|
/**
|
|
831
828
|
* Executes a Scan operation on DynamoDB
|
|
832
829
|
* Scans the entire table or a secondary index with optional filters.
|
|
@@ -847,12 +844,7 @@ async function queryResults(
|
|
|
847
844
|
*
|
|
848
845
|
* @returns {Promise<object>} Object containing Items, Count, ScannedCount, and LastEvaluatedKey
|
|
849
846
|
*/
|
|
850
|
-
async function scan(
|
|
851
|
-
_izContext,
|
|
852
|
-
tableName,
|
|
853
|
-
queryElements = {},
|
|
854
|
-
settings = {}
|
|
855
|
-
) {
|
|
847
|
+
async function scan(_izContext, tableName, queryElements = {}, settings = {}) {
|
|
856
848
|
try {
|
|
857
849
|
// ------------ Build payload ---------------
|
|
858
850
|
let payload = {
|
|
@@ -1313,12 +1305,12 @@ async function updateItem(
|
|
|
1313
1305
|
k
|
|
1314
1306
|
) &&
|
|
1315
1307
|
JSON.stringify(payload.ExpressionAttributeValues[k]) !==
|
|
1316
|
-
|
|
1308
|
+
JSON.stringify(v)
|
|
1317
1309
|
) {
|
|
1318
1310
|
throw new NoRetryError(
|
|
1319
1311
|
'Placeholder ' +
|
|
1320
|
-
|
|
1321
|
-
|
|
1312
|
+
k +
|
|
1313
|
+
' duplicated with different value (from ConditionExpression merge).'
|
|
1322
1314
|
);
|
|
1323
1315
|
}
|
|
1324
1316
|
payload.ExpressionAttributeValues[k] = v;
|
|
@@ -1346,12 +1338,12 @@ async function updateItem(
|
|
|
1346
1338
|
k
|
|
1347
1339
|
) &&
|
|
1348
1340
|
JSON.stringify(payload.ExpressionAttributeValues[k]) !==
|
|
1349
|
-
|
|
1341
|
+
JSON.stringify(v)
|
|
1350
1342
|
) {
|
|
1351
1343
|
throw new NoRetryError(
|
|
1352
1344
|
'Placeholder ' +
|
|
1353
|
-
|
|
1354
|
-
|
|
1345
|
+
k +
|
|
1346
|
+
' duplicated with different value (from queryElements merge).'
|
|
1355
1347
|
);
|
|
1356
1348
|
}
|
|
1357
1349
|
payload.ExpressionAttributeValues[k] = v;
|
|
@@ -1436,7 +1428,7 @@ async function updateItem(
|
|
|
1436
1428
|
if (action !== 'SET') {
|
|
1437
1429
|
throw new NoRetryError(
|
|
1438
1430
|
JSON.stringify(item) +
|
|
1439
|
-
|
|
1431
|
+
': listAppend / add_ / subtract_ must be used with "SET" action.'
|
|
1440
1432
|
);
|
|
1441
1433
|
}
|
|
1442
1434
|
}
|
|
@@ -2224,7 +2216,7 @@ async function captureCapacityUsed(
|
|
|
2224
2216
|
}
|
|
2225
2217
|
|
|
2226
2218
|
// Consolidated exports
|
|
2227
|
-
export
|
|
2219
|
+
export {
|
|
2228
2220
|
// Table name functions
|
|
2229
2221
|
tableName,
|
|
2230
2222
|
|