@hapiboo/dynamo-flux 1.1.1 → 1.1.3

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.
Files changed (2) hide show
  1. package/dist/provider.js +29 -16
  2. package/package.json +2 -2
package/dist/provider.js CHANGED
@@ -502,28 +502,38 @@ var dynamoHelper;
502
502
  return result;
503
503
  }
504
504
  function property(value) {
505
- if (value.S) {
506
- return value.S;
505
+ if ('S' in value) {
506
+ return value.S ?? '';
507
507
  }
508
- else if (value.N) {
509
- return +value.N;
508
+ else if ('N' in value) {
509
+ return Number(value.N);
510
510
  }
511
- else if (value.B) {
511
+ else if ('B' in value) {
512
512
  return Buffer.from(value.B);
513
513
  }
514
- else if (value.M) {
515
- return object(value.M);
514
+ else if ('M' in value) {
515
+ if (value.M === undefined) {
516
+ return null;
517
+ }
518
+ else {
519
+ return object(value.M);
520
+ }
516
521
  }
517
- else if (value.L) {
518
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
519
- const list = [];
520
- value.L.forEach((elem) => {
521
- list.push(property(elem));
522
- });
523
- return list;
522
+ else if ('L' in value) {
523
+ if (value.L === undefined) {
524
+ return [];
525
+ }
526
+ else {
527
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
528
+ const list = [];
529
+ value.L.forEach((elem) => {
530
+ list.push(property(elem));
531
+ });
532
+ return list;
533
+ }
524
534
  }
525
- else if (value.BOOL) {
526
- return value.BOOL;
535
+ else if ('BOOL' in value) {
536
+ return value.BOOL ? true : false;
527
537
  }
528
538
  else {
529
539
  return null;
@@ -642,6 +652,9 @@ class AWSDynamoDBProviderFlux {
642
652
  update(model, item) {
643
653
  return core_1.promise.createPromise((resolve, reject) => {
644
654
  const params = dynamoHelper.prepare.updateElement(model, item);
655
+ if (process.env.SHOW_UPDATE_EXPRESSION === 'true') {
656
+ console.info(`Dynamo Update Command: ${params}`);
657
+ }
645
658
  dynamoHelper.config.getClient().send(new client_dynamodb_1.UpdateItemCommand(params))
646
659
  .then(() => {
647
660
  resolve(item);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hapiboo/dynamo-flux",
3
3
  "description": "MK13 Studio Hapiboo - AWS DynamoDB plugin (Flux version)",
4
- "version": "1.1.1",
4
+ "version": "1.1.3",
5
5
  "author": "MK13 Studio",
6
6
  "license": "ISC",
7
7
  "main": "dist/index.js",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "@hapiboo/core": "^3.0.1",
17
- "@hapiboo/flux": "^1.1.2",
17
+ "@hapiboo/flux": "^1.1.3",
18
18
  "@aws-sdk/client-dynamodb": "^3.848.0"
19
19
  },
20
20
  "devDependencies": {