@infra-blocks/aws-dynamodb 0.81.1 → 0.82.0

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.
@@ -18,6 +18,10 @@ export interface GetItemInput<K extends KeyAttributes = KeyAttributes> {
18
18
  * is part of the table's primary key. No more than 2 fields are expected here.
19
19
  */
20
20
  key: K;
21
+ /**
22
+ * Whether to perform a consistent read. Defaults to false.
23
+ */
24
+ consistentRead?: boolean;
21
25
  /**
22
26
  * The projection applied to the return item, if any.
23
27
  */
@@ -1,27 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetItemInput = void 0;
4
+ const toolkit_1 = require("@infra-blocks/toolkit");
4
5
  const projection_js_1 = require("../expressions/projection.js");
5
- const lib_js_1 = require("./lib.js");
6
+ const lib_js_1 = require("../lib.js");
7
+ const lib_js_2 = require("./lib.js");
6
8
  exports.GetItemInput = {
7
9
  encode,
8
10
  };
9
11
  function encode(input) {
10
- const result = {
12
+ const formatter = lib_js_2.ExpressionsFormatter.create();
13
+ return (0, lib_js_1.unsetUndefined)({
11
14
  TableName: input.table,
12
15
  Key: input.key,
13
- };
14
- if (input.returnConsumedCapacity != null) {
15
- result.ReturnConsumedCapacity = input.returnConsumedCapacity;
16
- }
17
- if (input.projection == null) {
18
- return result;
19
- }
20
- const formatter = lib_js_1.ExpressionsFormatter.create();
21
- return {
22
- ...result,
23
- ProjectionExpression: formatter.format(projection_js_1.Projection.from(input.projection)),
16
+ ConsistentRead: input.consistentRead,
17
+ ProjectionExpression: (0, toolkit_1.ifDefined)(input.projection, (v) => formatter.format(projection_js_1.Projection.from(v))),
18
+ ReturnConsumedCapacity: input.returnConsumedCapacity,
24
19
  ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
25
- };
20
+ });
26
21
  }
27
22
  //# sourceMappingURL=get-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/get-item.ts"],"names":[],"mappings":";;;AAEA,gEAAgF;AAChF,qCAGkB;AA6BL,QAAA,YAAY,GAAG;IAC1B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAsB;IAEtB,MAAM,MAAM,GAAoB;QAC9B,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC;IAEF,IAAI,KAAK,CAAC,sBAAsB,IAAI,IAAI,EAAE,CAAC;QACzC,MAAM,CAAC,sBAAsB,GAAG,KAAK,CAAC,sBAAsB,CAAC;IAC/D,CAAC;IAED,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,SAAS,GAAG,6BAAoB,CAAC,MAAM,EAAE,CAAC;IAChD,OAAO;QACL,GAAG,MAAM;QACT,oBAAoB,EAAE,SAAS,CAAC,MAAM,CAAC,0BAAU,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACzE,wBAAwB,EAAE,SAAS,CAAC,2BAA2B,EAAE;KAClE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/get-item.ts"],"names":[],"mappings":";;;AACA,mDAAkD;AAElD,gEAAgF;AAChF,sCAA2C;AAC3C,qCAGkB;AAiCL,QAAA,YAAY,GAAG;IAC1B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAsB;IAEtB,MAAM,SAAS,GAAG,6BAAoB,CAAC,MAAM,EAAE,CAAC;IAChD,OAAO,IAAA,uBAAc,EAAC;QACpB,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,oBAAoB,EAAE,IAAA,mBAAS,EAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CACtD,SAAS,CAAC,MAAM,CAAC,0BAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACrC;QACD,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;QACpD,wBAAwB,EAAE,SAAS,CAAC,2BAA2B,EAAE;KAClE,CAAC,CAAC;AACL,CAAC"}
@@ -18,6 +18,10 @@ export interface GetItemInput<K extends KeyAttributes = KeyAttributes> {
18
18
  * is part of the table's primary key. No more than 2 fields are expected here.
19
19
  */
20
20
  key: K;
21
+ /**
22
+ * Whether to perform a consistent read. Defaults to false.
23
+ */
24
+ consistentRead?: boolean;
21
25
  /**
22
26
  * The projection applied to the return item, if any.
23
27
  */
@@ -1,24 +1,19 @@
1
+ import { ifDefined } from "@infra-blocks/toolkit";
1
2
  import { Projection } from "../expressions/projection.js";
3
+ import { unsetUndefined } from "../lib.js";
2
4
  import { ExpressionsFormatter, } from "./lib.js";
3
5
  export const GetItemInput = {
4
6
  encode,
5
7
  };
6
8
  function encode(input) {
7
- const result = {
9
+ const formatter = ExpressionsFormatter.create();
10
+ return unsetUndefined({
8
11
  TableName: input.table,
9
12
  Key: input.key,
10
- };
11
- if (input.returnConsumedCapacity != null) {
12
- result.ReturnConsumedCapacity = input.returnConsumedCapacity;
13
- }
14
- if (input.projection == null) {
15
- return result;
16
- }
17
- const formatter = ExpressionsFormatter.create();
18
- return {
19
- ...result,
20
- ProjectionExpression: formatter.format(Projection.from(input.projection)),
13
+ ConsistentRead: input.consistentRead,
14
+ ProjectionExpression: ifDefined(input.projection, (v) => formatter.format(Projection.from(v))),
15
+ ReturnConsumedCapacity: input.returnConsumedCapacity,
21
16
  ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
22
- };
17
+ });
23
18
  }
24
19
  //# sourceMappingURL=get-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/get-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAwB,MAAM,8B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B,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,oBAAoB,EAAE,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CACtD,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACrC;QACD,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;QACpD,wBAAwB,EAAE,SAAS,CAAC,2BAA2B,EAAE;KAClE,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infra-blocks/aws-dynamodb",
3
- "version": "0.81.1",
3
+ "version": "0.82.0",
4
4
  "description": "A convenience wrapper over @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb.",
5
5
  "keywords": [
6
6
  "aws",