@infra-blocks/aws-dynamodb 0.72.0 → 0.73.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.
- package/lib/cjs/commands/inputs/delete-item.d.ts +3 -3
- package/lib/cjs/commands/inputs/put-item.d.ts +22 -4
- package/lib/cjs/commands/inputs/put-item.js +9 -20
- package/lib/cjs/commands/inputs/put-item.js.map +1 -1
- package/lib/cjs/commands/outputs/put-item.d.ts +2 -0
- package/lib/cjs/commands/outputs/put-item.js +2 -0
- package/lib/cjs/commands/outputs/put-item.js.map +1 -1
- package/lib/esm/commands/inputs/delete-item.d.ts +3 -3
- package/lib/esm/commands/inputs/put-item.d.ts +22 -4
- package/lib/esm/commands/inputs/put-item.js +8 -19
- package/lib/esm/commands/inputs/put-item.js.map +1 -1
- package/lib/esm/commands/outputs/put-item.d.ts +2 -0
- package/lib/esm/commands/outputs/put-item.js +2 -0
- package/lib/esm/commands/outputs/put-item.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export type DeleteItemInput<K extends KeyAttributes = KeyAttributes> = {
|
|
|
17
17
|
*/
|
|
18
18
|
key: K;
|
|
19
19
|
/**
|
|
20
|
-
* A condition expression for the operation.
|
|
20
|
+
* A condition expression for the operation, if any.
|
|
21
21
|
*/
|
|
22
22
|
condition?: ConditionInput;
|
|
23
23
|
/**
|
|
@@ -25,12 +25,12 @@ export type DeleteItemInput<K extends KeyAttributes = KeyAttributes> = {
|
|
|
25
25
|
*/
|
|
26
26
|
returnConsumedCapacity?: DeleteItemConsumedCapacityReturnValue;
|
|
27
27
|
/**
|
|
28
|
-
* The requested return
|
|
28
|
+
* The requested return values, if any. Defaults to "NONE".
|
|
29
29
|
*/
|
|
30
30
|
returnValues?: DeleteItemReturnValue;
|
|
31
31
|
/**
|
|
32
32
|
* Whether to store the item in a {@link ConditionalCheckFailureException} when one
|
|
33
|
-
* is thrown.
|
|
33
|
+
* is thrown. Defaults to "NONE".
|
|
34
34
|
*/
|
|
35
35
|
returnValuesOnConditionCheckFailure?: ConditionCheckFailureReturnValue;
|
|
36
36
|
};
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import type { PutCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../../types.js";
|
|
3
3
|
import { type ConditionInput } from "../expressions/index.js";
|
|
4
|
-
import type { ConditionCheckFailureReturnValue } from "./lib.js";
|
|
4
|
+
import type { ConditionCheckFailureReturnValue, ConsumedCapacityReturnValue } from "./lib.js";
|
|
5
|
+
export type PutItemConsumedCapacityReturnValue = ConsumedCapacityReturnValue;
|
|
5
6
|
export type PutItemReturnValue = ConditionCheckFailureReturnValue;
|
|
6
7
|
export type PutItemInput<T extends Attributes = Attributes> = {
|
|
8
|
+
/**
|
|
9
|
+
* The table where the item will be stored located.
|
|
10
|
+
*/
|
|
7
11
|
table: string;
|
|
12
|
+
/**
|
|
13
|
+
* The item in question.
|
|
14
|
+
*/
|
|
8
15
|
item: T;
|
|
16
|
+
/**
|
|
17
|
+
* A condition expression for the operation, if any.
|
|
18
|
+
*/
|
|
9
19
|
condition?: ConditionInput;
|
|
20
|
+
/**
|
|
21
|
+
* The requested consumed capacity metrics on return, if any.
|
|
22
|
+
*/
|
|
23
|
+
returnConsumedCapacity?: PutItemConsumedCapacityReturnValue;
|
|
24
|
+
/**
|
|
25
|
+
* The requested return values, if any. Defaults to "NONE".
|
|
26
|
+
*/
|
|
10
27
|
returnValues?: PutItemReturnValue;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to store the item in a {@link ConditionalCheckFailureException} when one
|
|
30
|
+
* is thrown. Defaults to "NONE".
|
|
31
|
+
*/
|
|
11
32
|
returnValuesOnConditionCheckFailure?: ConditionCheckFailureReturnValue;
|
|
12
33
|
};
|
|
13
|
-
export type PutItemResult<T extends Attributes> = {
|
|
14
|
-
item?: T;
|
|
15
|
-
};
|
|
16
34
|
export declare const PutItemInput: {
|
|
17
35
|
encode: typeof encode;
|
|
18
36
|
};
|
|
@@ -2,33 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PutItemInput = void 0;
|
|
4
4
|
const index_js_1 = require("../expressions/index.js");
|
|
5
|
-
const lib_js_1 = require("
|
|
5
|
+
const lib_js_1 = require("../lib.js");
|
|
6
|
+
const lib_js_2 = require("./lib.js");
|
|
6
7
|
exports.PutItemInput = {
|
|
7
8
|
encode,
|
|
8
9
|
};
|
|
9
10
|
function encode(input) {
|
|
10
|
-
const
|
|
11
|
+
const formatter = lib_js_2.ExpressionsFormatter.create();
|
|
12
|
+
return (0, lib_js_1.unsetUndefined)({
|
|
11
13
|
TableName: input.table,
|
|
12
14
|
Item: input.item,
|
|
13
|
-
|
|
14
|
-
if (input.returnValues != null) {
|
|
15
|
-
result.ReturnValues = input.returnValues;
|
|
16
|
-
}
|
|
17
|
-
if (input.returnValuesOnConditionCheckFailure != null) {
|
|
18
|
-
result.ReturnValuesOnConditionCheckFailure =
|
|
19
|
-
input.returnValuesOnConditionCheckFailure;
|
|
20
|
-
}
|
|
21
|
-
// Expression attribute names and values can only be specified when a condition is provided,
|
|
22
|
-
// which is optional.
|
|
23
|
-
if (input.condition == null) {
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
const formatter = lib_js_1.ExpressionsFormatter.create();
|
|
27
|
-
return {
|
|
28
|
-
...result,
|
|
29
|
-
ConditionExpression: formatter.format(index_js_1.Condition.from(input.condition)),
|
|
15
|
+
ConditionExpression: (0, lib_js_1.ifDefined)(input.condition, (v) => formatter.format(index_js_1.Condition.from(v))),
|
|
30
16
|
ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
|
|
31
17
|
ExpressionAttributeValues: formatter.getExpressionAttributeValues(),
|
|
32
|
-
|
|
18
|
+
ReturnConsumedCapacity: input.returnConsumedCapacity,
|
|
19
|
+
ReturnValues: input.returnValues,
|
|
20
|
+
ReturnValuesOnConditionCheckFailure: input.returnValuesOnConditionCheckFailure,
|
|
21
|
+
});
|
|
33
22
|
}
|
|
34
23
|
//# sourceMappingURL=put-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/put-item.ts"],"names":[],"mappings":";;;AAEA,sDAAyE;
|
|
1
|
+
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/put-item.ts"],"names":[],"mappings":";;;AAEA,sDAAyE;AACzE,sCAAsD;AAKtD,qCAAgD;AAkCnC,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,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,mBAAmB,EAAE,IAAA,kBAAS,EAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CACpD,SAAS,CAAC,MAAM,CAAC,oBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACpC;QACD,wBAAwB,EAAE,SAAS,CAAC,2BAA2B,EAAE;QACjE,yBAAyB,EAAE,SAAS,CAAC,4BAA4B,EAAE;QACnE,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;QACpD,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,mCAAmC,EACjC,KAAK,CAAC,mCAAmC;KAC5C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PutCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../../types.js";
|
|
3
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
3
4
|
export type PutItemOutput<T extends Attributes = Attributes> = {
|
|
4
5
|
item?: T;
|
|
6
|
+
consumedCapacity?: ConsumedCapacity;
|
|
5
7
|
};
|
|
6
8
|
export declare const PutItemOutput: {
|
|
7
9
|
decode: typeof decode;
|
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PutItemOutput = void 0;
|
|
4
4
|
const types_1 = require("@infra-blocks/types");
|
|
5
5
|
const lib_js_1 = require("../lib.js");
|
|
6
|
+
const consumed_capacity_js_1 = require("./consumed-capacity.js");
|
|
6
7
|
exports.PutItemOutput = {
|
|
7
8
|
decode,
|
|
8
9
|
};
|
|
9
10
|
function decode(output) {
|
|
10
11
|
return (0, lib_js_1.unsetUndefined)({
|
|
11
12
|
item: (0, lib_js_1.ifDefined)(output.Attributes, (types_1.trusted)),
|
|
13
|
+
consumedCapacity: (0, lib_js_1.ifDefined)(output.ConsumedCapacity, consumed_capacity_js_1.ConsumedCapacity.decode),
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=put-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/put-item.ts"],"names":[],"mappings":";;;AACA,+CAA8C;AAE9C,sCAAsD;
|
|
1
|
+
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/put-item.ts"],"names":[],"mappings":";;;AACA,+CAA8C;AAE9C,sCAAsD;AACtD,iEAA0D;AAO7C,QAAA,aAAa,GAAG;IAC3B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,MAAwB;IAExB,OAAO,IAAA,uBAAc,EAAC;QACpB,IAAI,EAAE,IAAA,kBAAS,EAAC,MAAM,CAAC,UAAU,EAAE,CAAA,eAAU,CAAA,CAAC;QAC9C,gBAAgB,EAAE,IAAA,kBAAS,EACzB,MAAM,CAAC,gBAAgB,EACvB,uCAAgB,CAAC,MAAM,CACxB;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -17,7 +17,7 @@ export type DeleteItemInput<K extends KeyAttributes = KeyAttributes> = {
|
|
|
17
17
|
*/
|
|
18
18
|
key: K;
|
|
19
19
|
/**
|
|
20
|
-
* A condition expression for the operation.
|
|
20
|
+
* A condition expression for the operation, if any.
|
|
21
21
|
*/
|
|
22
22
|
condition?: ConditionInput;
|
|
23
23
|
/**
|
|
@@ -25,12 +25,12 @@ export type DeleteItemInput<K extends KeyAttributes = KeyAttributes> = {
|
|
|
25
25
|
*/
|
|
26
26
|
returnConsumedCapacity?: DeleteItemConsumedCapacityReturnValue;
|
|
27
27
|
/**
|
|
28
|
-
* The requested return
|
|
28
|
+
* The requested return values, if any. Defaults to "NONE".
|
|
29
29
|
*/
|
|
30
30
|
returnValues?: DeleteItemReturnValue;
|
|
31
31
|
/**
|
|
32
32
|
* Whether to store the item in a {@link ConditionalCheckFailureException} when one
|
|
33
|
-
* is thrown.
|
|
33
|
+
* is thrown. Defaults to "NONE".
|
|
34
34
|
*/
|
|
35
35
|
returnValuesOnConditionCheckFailure?: ConditionCheckFailureReturnValue;
|
|
36
36
|
};
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import type { PutCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../../types.js";
|
|
3
3
|
import { type ConditionInput } from "../expressions/index.js";
|
|
4
|
-
import type { ConditionCheckFailureReturnValue } from "./lib.js";
|
|
4
|
+
import type { ConditionCheckFailureReturnValue, ConsumedCapacityReturnValue } from "./lib.js";
|
|
5
|
+
export type PutItemConsumedCapacityReturnValue = ConsumedCapacityReturnValue;
|
|
5
6
|
export type PutItemReturnValue = ConditionCheckFailureReturnValue;
|
|
6
7
|
export type PutItemInput<T extends Attributes = Attributes> = {
|
|
8
|
+
/**
|
|
9
|
+
* The table where the item will be stored located.
|
|
10
|
+
*/
|
|
7
11
|
table: string;
|
|
12
|
+
/**
|
|
13
|
+
* The item in question.
|
|
14
|
+
*/
|
|
8
15
|
item: T;
|
|
16
|
+
/**
|
|
17
|
+
* A condition expression for the operation, if any.
|
|
18
|
+
*/
|
|
9
19
|
condition?: ConditionInput;
|
|
20
|
+
/**
|
|
21
|
+
* The requested consumed capacity metrics on return, if any.
|
|
22
|
+
*/
|
|
23
|
+
returnConsumedCapacity?: PutItemConsumedCapacityReturnValue;
|
|
24
|
+
/**
|
|
25
|
+
* The requested return values, if any. Defaults to "NONE".
|
|
26
|
+
*/
|
|
10
27
|
returnValues?: PutItemReturnValue;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to store the item in a {@link ConditionalCheckFailureException} when one
|
|
30
|
+
* is thrown. Defaults to "NONE".
|
|
31
|
+
*/
|
|
11
32
|
returnValuesOnConditionCheckFailure?: ConditionCheckFailureReturnValue;
|
|
12
33
|
};
|
|
13
|
-
export type PutItemResult<T extends Attributes> = {
|
|
14
|
-
item?: T;
|
|
15
|
-
};
|
|
16
34
|
export declare const PutItemInput: {
|
|
17
35
|
encode: typeof encode;
|
|
18
36
|
};
|
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
import { Condition } from "../expressions/index.js";
|
|
2
|
+
import { ifDefined, unsetUndefined } from "../lib.js";
|
|
2
3
|
import { ExpressionsFormatter } from "./lib.js";
|
|
3
4
|
export const PutItemInput = {
|
|
4
5
|
encode,
|
|
5
6
|
};
|
|
6
7
|
function encode(input) {
|
|
7
|
-
const
|
|
8
|
+
const formatter = ExpressionsFormatter.create();
|
|
9
|
+
return unsetUndefined({
|
|
8
10
|
TableName: input.table,
|
|
9
11
|
Item: input.item,
|
|
10
|
-
|
|
11
|
-
if (input.returnValues != null) {
|
|
12
|
-
result.ReturnValues = input.returnValues;
|
|
13
|
-
}
|
|
14
|
-
if (input.returnValuesOnConditionCheckFailure != null) {
|
|
15
|
-
result.ReturnValuesOnConditionCheckFailure =
|
|
16
|
-
input.returnValuesOnConditionCheckFailure;
|
|
17
|
-
}
|
|
18
|
-
// Expression attribute names and values can only be specified when a condition is provided,
|
|
19
|
-
// which is optional.
|
|
20
|
-
if (input.condition == null) {
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
const formatter = ExpressionsFormatter.create();
|
|
24
|
-
return {
|
|
25
|
-
...result,
|
|
26
|
-
ConditionExpression: formatter.format(Condition.from(input.condition)),
|
|
12
|
+
ConditionExpression: ifDefined(input.condition, (v) => formatter.format(Condition.from(v))),
|
|
27
13
|
ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
|
|
28
14
|
ExpressionAttributeValues: formatter.getExpressionAttributeValues(),
|
|
29
|
-
|
|
15
|
+
ReturnConsumedCapacity: input.returnConsumedCapacity,
|
|
16
|
+
ReturnValues: input.returnValues,
|
|
17
|
+
ReturnValuesOnConditionCheckFailure: input.returnValuesOnConditionCheckFailure,
|
|
18
|
+
});
|
|
30
19
|
}
|
|
31
20
|
//# sourceMappingURL=put-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/put-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAuB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/put-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAuB,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAKtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAkChD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAsB;IAEtB,MAAM,SAAS,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC;IAChD,OAAO,cAAc,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,mBAAmB,EAAE,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CACpD,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACpC;QACD,wBAAwB,EAAE,SAAS,CAAC,2BAA2B,EAAE;QACjE,yBAAyB,EAAE,SAAS,CAAC,4BAA4B,EAAE;QACnE,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;QACpD,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,mCAAmC,EACjC,KAAK,CAAC,mCAAmC;KAC5C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PutCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../../types.js";
|
|
3
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
3
4
|
export type PutItemOutput<T extends Attributes = Attributes> = {
|
|
4
5
|
item?: T;
|
|
6
|
+
consumedCapacity?: ConsumedCapacity;
|
|
5
7
|
};
|
|
6
8
|
export declare const PutItemOutput: {
|
|
7
9
|
decode: typeof decode;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { trusted } from "@infra-blocks/types";
|
|
2
2
|
import { ifDefined, unsetUndefined } from "../lib.js";
|
|
3
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
3
4
|
export const PutItemOutput = {
|
|
4
5
|
decode,
|
|
5
6
|
};
|
|
6
7
|
function decode(output) {
|
|
7
8
|
return unsetUndefined({
|
|
8
9
|
item: ifDefined(output.Attributes, (trusted)),
|
|
10
|
+
consumedCapacity: ifDefined(output.ConsumedCapacity, ConsumedCapacity.decode),
|
|
9
11
|
});
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=put-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/put-item.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/put-item.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO1D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,MAAwB;IAExB,OAAO,cAAc,CAAC;QACpB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA,OAAU,CAAA,CAAC;QAC9C,gBAAgB,EAAE,SAAS,CACzB,MAAM,CAAC,gBAAgB,EACvB,gBAAgB,CAAC,MAAM,CACxB;KACF,CAAC,CAAC;AACL,CAAC"}
|