@infra-blocks/aws-dynamodb 0.73.0 → 0.74.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/update-item.d.ts +29 -1
- package/lib/cjs/commands/inputs/update-item.js +19 -18
- package/lib/cjs/commands/inputs/update-item.js.map +1 -1
- package/lib/cjs/commands/outputs/update-item.d.ts +2 -0
- package/lib/cjs/commands/outputs/update-item.js +2 -0
- package/lib/cjs/commands/outputs/update-item.js.map +1 -1
- package/lib/esm/commands/inputs/update-item.d.ts +29 -1
- package/lib/esm/commands/inputs/update-item.js +16 -15
- package/lib/esm/commands/inputs/update-item.js.map +1 -1
- package/lib/esm/commands/outputs/update-item.d.ts +2 -0
- package/lib/esm/commands/outputs/update-item.js +2 -0
- package/lib/esm/commands/outputs/update-item.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,14 +2,42 @@ import type { UpdateCommandInput as NativeUpdateCommandInput } from "@aws-sdk/li
|
|
|
2
2
|
import type { WithRequired } from "@infra-blocks/types";
|
|
3
3
|
import type { KeyAttributes } from "../../types.js";
|
|
4
4
|
import { type ConditionInput, type UpdateInput } from "../expressions/index.js";
|
|
5
|
-
import type { ConditionCheckFailureReturnValue } from "./lib.js";
|
|
5
|
+
import type { ConditionCheckFailureReturnValue, ConsumedCapacityReturnValue } from "./lib.js";
|
|
6
|
+
export type UpdateItemConsumedCapacityReturnValue = ConsumedCapacityReturnValue;
|
|
6
7
|
export type UpdateItemReturnValue = "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW";
|
|
8
|
+
export declare const UPDATE_ITEM_RETURN_VALUES: ReadonlyArray<UpdateItemReturnValue>;
|
|
7
9
|
export interface UpdateItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
10
|
+
/**
|
|
11
|
+
* The table name of the updated item.
|
|
12
|
+
*/
|
|
8
13
|
table: string;
|
|
14
|
+
/**
|
|
15
|
+
* The primary key values of the item to update.
|
|
16
|
+
*
|
|
17
|
+
* This should always include at least the partition key, and the sort key if one
|
|
18
|
+
* is part of the table's primary key. No more than 2 fields are expected here.
|
|
19
|
+
*/
|
|
9
20
|
key: K;
|
|
21
|
+
/**
|
|
22
|
+
* The update expression of the operation.
|
|
23
|
+
*/
|
|
10
24
|
update: UpdateInput;
|
|
25
|
+
/**
|
|
26
|
+
* A condition expression for the operation, if any.
|
|
27
|
+
*/
|
|
11
28
|
condition?: ConditionInput;
|
|
29
|
+
/**
|
|
30
|
+
* The requested consumed capacity metrics on return. Defaults to "NONE".
|
|
31
|
+
*/
|
|
32
|
+
returnConsumedCapacity?: UpdateItemConsumedCapacityReturnValue;
|
|
33
|
+
/**
|
|
34
|
+
* The requested return values. Defaults to "NONE".
|
|
35
|
+
*/
|
|
12
36
|
returnValues?: UpdateItemReturnValue;
|
|
37
|
+
/**
|
|
38
|
+
* The values to store the item in a {@link ConditionalCheckFailureException} when one
|
|
39
|
+
* is thrown. Defaults to "NONE".
|
|
40
|
+
*/
|
|
13
41
|
returnValuesOnConditionCheckFailure?: ConditionCheckFailureReturnValue;
|
|
14
42
|
}
|
|
15
43
|
export declare const UpdateItemInput: {
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateItemInput = void 0;
|
|
3
|
+
exports.UpdateItemInput = exports.UPDATE_ITEM_RETURN_VALUES = 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");
|
|
7
|
+
exports.UPDATE_ITEM_RETURN_VALUES = [
|
|
8
|
+
"NONE",
|
|
9
|
+
"ALL_OLD",
|
|
10
|
+
"UPDATED_OLD",
|
|
11
|
+
"ALL_NEW",
|
|
12
|
+
"UPDATED_NEW",
|
|
13
|
+
];
|
|
6
14
|
exports.UpdateItemInput = {
|
|
7
15
|
encode,
|
|
8
16
|
};
|
|
9
17
|
function encode(input) {
|
|
10
|
-
const formatter =
|
|
11
|
-
|
|
18
|
+
const formatter = lib_js_2.ExpressionsFormatter.create();
|
|
19
|
+
return (0, lib_js_1.unsetUndefined)({
|
|
12
20
|
TableName: input.table,
|
|
13
21
|
Key: input.key,
|
|
14
22
|
UpdateExpression: formatter.format(index_js_1.Update.from(input.update)),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
if (input.condition != null) {
|
|
24
|
-
result.ConditionExpression = formatter.format(index_js_1.Condition.from(input.condition));
|
|
25
|
-
}
|
|
26
|
-
result.ExpressionAttributeNames = formatter.getExpressionAttributeNames();
|
|
27
|
-
result.ExpressionAttributeValues = formatter.getExpressionAttributeValues();
|
|
28
|
-
return result;
|
|
23
|
+
ConditionExpression: (0, lib_js_1.ifDefined)(input.condition, (v) => formatter.format(index_js_1.Condition.from(v))),
|
|
24
|
+
ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
|
|
25
|
+
ExpressionAttributeValues: formatter.getExpressionAttributeValues(),
|
|
26
|
+
ReturnConsumedCapacity: input.returnConsumedCapacity,
|
|
27
|
+
ReturnValues: input.returnValues,
|
|
28
|
+
ReturnValuesOnConditionCheckFailure: input.returnValuesOnConditionCheckFailure,
|
|
29
|
+
});
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=update-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/update-item.ts"],"names":[],"mappings":";;;AAGA,sDAKiC;
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/update-item.ts"],"names":[],"mappings":";;;AAGA,sDAKiC;AACjC,sCAAsD;AAKtD,qCAAgD;AAWnC,QAAA,yBAAyB,GAAyC;IAC7E,MAAM;IACN,SAAS;IACT,aAAa;IACb,SAAS;IACT,aAAa;CACd,CAAC;AAqCW,QAAA,eAAe,GAAG;IAC7B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAyB;IAEzB,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,gBAAgB,EAAE,SAAS,CAAC,MAAM,CAAC,iBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7D,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 { UpdateCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../../types.js";
|
|
3
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
3
4
|
export type UpdateItemOutput<T extends Attributes = Attributes> = {
|
|
4
5
|
attributes?: T;
|
|
6
|
+
consumedCapacity?: ConsumedCapacity;
|
|
5
7
|
};
|
|
6
8
|
export declare const UpdateItemOutput: {
|
|
7
9
|
decode: typeof decode;
|
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UpdateItemOutput = 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.UpdateItemOutput = {
|
|
7
8
|
decode,
|
|
8
9
|
};
|
|
9
10
|
function decode(output) {
|
|
10
11
|
return (0, lib_js_1.unsetUndefined)({
|
|
11
12
|
attributes: (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=update-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/update-item.ts"],"names":[],"mappings":";;;AACA,+CAA8C;AAE9C,sCAAsD;
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/update-item.ts"],"names":[],"mappings":";;;AACA,+CAA8C;AAE9C,sCAAsD;AACtD,iEAA0D;AAO7C,QAAA,gBAAgB,GAAG;IAC9B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,MAA2B;IAE3B,OAAO,IAAA,uBAAc,EAAC;QACpB,UAAU,EAAE,IAAA,kBAAS,EAAC,MAAM,CAAC,UAAU,EAAE,CAAA,eAAU,CAAA,CAAC;QACpD,gBAAgB,EAAE,IAAA,kBAAS,EACzB,MAAM,CAAC,gBAAgB,EACvB,uCAAgB,CAAC,MAAM,CACxB;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -2,14 +2,42 @@ import type { UpdateCommandInput as NativeUpdateCommandInput } from "@aws-sdk/li
|
|
|
2
2
|
import type { WithRequired } from "@infra-blocks/types";
|
|
3
3
|
import type { KeyAttributes } from "../../types.js";
|
|
4
4
|
import { type ConditionInput, type UpdateInput } from "../expressions/index.js";
|
|
5
|
-
import type { ConditionCheckFailureReturnValue } from "./lib.js";
|
|
5
|
+
import type { ConditionCheckFailureReturnValue, ConsumedCapacityReturnValue } from "./lib.js";
|
|
6
|
+
export type UpdateItemConsumedCapacityReturnValue = ConsumedCapacityReturnValue;
|
|
6
7
|
export type UpdateItemReturnValue = "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW";
|
|
8
|
+
export declare const UPDATE_ITEM_RETURN_VALUES: ReadonlyArray<UpdateItemReturnValue>;
|
|
7
9
|
export interface UpdateItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
10
|
+
/**
|
|
11
|
+
* The table name of the updated item.
|
|
12
|
+
*/
|
|
8
13
|
table: string;
|
|
14
|
+
/**
|
|
15
|
+
* The primary key values of the item to update.
|
|
16
|
+
*
|
|
17
|
+
* This should always include at least the partition key, and the sort key if one
|
|
18
|
+
* is part of the table's primary key. No more than 2 fields are expected here.
|
|
19
|
+
*/
|
|
9
20
|
key: K;
|
|
21
|
+
/**
|
|
22
|
+
* The update expression of the operation.
|
|
23
|
+
*/
|
|
10
24
|
update: UpdateInput;
|
|
25
|
+
/**
|
|
26
|
+
* A condition expression for the operation, if any.
|
|
27
|
+
*/
|
|
11
28
|
condition?: ConditionInput;
|
|
29
|
+
/**
|
|
30
|
+
* The requested consumed capacity metrics on return. Defaults to "NONE".
|
|
31
|
+
*/
|
|
32
|
+
returnConsumedCapacity?: UpdateItemConsumedCapacityReturnValue;
|
|
33
|
+
/**
|
|
34
|
+
* The requested return values. Defaults to "NONE".
|
|
35
|
+
*/
|
|
12
36
|
returnValues?: UpdateItemReturnValue;
|
|
37
|
+
/**
|
|
38
|
+
* The values to store the item in a {@link ConditionalCheckFailureException} when one
|
|
39
|
+
* is thrown. Defaults to "NONE".
|
|
40
|
+
*/
|
|
13
41
|
returnValuesOnConditionCheckFailure?: ConditionCheckFailureReturnValue;
|
|
14
42
|
}
|
|
15
43
|
export declare const UpdateItemInput: {
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { Condition, Update, } from "../expressions/index.js";
|
|
2
|
+
import { ifDefined, unsetUndefined } from "../lib.js";
|
|
2
3
|
import { ExpressionsFormatter } from "./lib.js";
|
|
4
|
+
export const UPDATE_ITEM_RETURN_VALUES = [
|
|
5
|
+
"NONE",
|
|
6
|
+
"ALL_OLD",
|
|
7
|
+
"UPDATED_OLD",
|
|
8
|
+
"ALL_NEW",
|
|
9
|
+
"UPDATED_NEW",
|
|
10
|
+
];
|
|
3
11
|
export const UpdateItemInput = {
|
|
4
12
|
encode,
|
|
5
13
|
};
|
|
6
14
|
function encode(input) {
|
|
7
15
|
const formatter = ExpressionsFormatter.create();
|
|
8
|
-
|
|
16
|
+
return unsetUndefined({
|
|
9
17
|
TableName: input.table,
|
|
10
18
|
Key: input.key,
|
|
11
19
|
UpdateExpression: formatter.format(Update.from(input.update)),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
if (input.condition != null) {
|
|
21
|
-
result.ConditionExpression = formatter.format(Condition.from(input.condition));
|
|
22
|
-
}
|
|
23
|
-
result.ExpressionAttributeNames = formatter.getExpressionAttributeNames();
|
|
24
|
-
result.ExpressionAttributeValues = formatter.getExpressionAttributeValues();
|
|
25
|
-
return result;
|
|
20
|
+
ConditionExpression: ifDefined(input.condition, (v) => formatter.format(Condition.from(v))),
|
|
21
|
+
ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
|
|
22
|
+
ExpressionAttributeValues: formatter.getExpressionAttributeValues(),
|
|
23
|
+
ReturnConsumedCapacity: input.returnConsumedCapacity,
|
|
24
|
+
ReturnValues: input.returnValues,
|
|
25
|
+
ReturnValuesOnConditionCheckFailure: input.returnValuesOnConditionCheckFailure,
|
|
26
|
+
});
|
|
26
27
|
}
|
|
27
28
|
//# sourceMappingURL=update-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/update-item.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EAET,MAAM,GAEP,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/update-item.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EAET,MAAM,GAEP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAKtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAWhD,MAAM,CAAC,MAAM,yBAAyB,GAAyC;IAC7E,MAAM;IACN,SAAS;IACT,aAAa;IACb,SAAS;IACT,aAAa;CACd,CAAC;AAqCF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAyB;IAEzB,MAAM,SAAS,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC;IAChD,OAAO,cAAc,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,gBAAgB,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7D,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 { UpdateCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../../types.js";
|
|
3
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
3
4
|
export type UpdateItemOutput<T extends Attributes = Attributes> = {
|
|
4
5
|
attributes?: T;
|
|
6
|
+
consumedCapacity?: ConsumedCapacity;
|
|
5
7
|
};
|
|
6
8
|
export declare const UpdateItemOutput: {
|
|
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 UpdateItemOutput = {
|
|
4
5
|
decode,
|
|
5
6
|
};
|
|
6
7
|
function decode(output) {
|
|
7
8
|
return unsetUndefined({
|
|
8
9
|
attributes: ifDefined(output.Attributes, (trusted)),
|
|
10
|
+
consumedCapacity: ifDefined(output.ConsumedCapacity, ConsumedCapacity.decode),
|
|
9
11
|
});
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=update-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/update-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":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/outputs/update-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,gBAAgB,GAAG;IAC9B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,MAA2B;IAE3B,OAAO,cAAc,CAAC;QACpB,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA,OAAU,CAAA,CAAC;QACpD,gBAAgB,EAAE,SAAS,CACzB,MAAM,CAAC,gBAAgB,EACvB,gBAAgB,CAAC,MAAM,CACxB;KACF,CAAC,CAAC;AACL,CAAC"}
|