@infra-blocks/aws-dynamodb 0.58.0 → 0.59.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/client.d.ts +3 -4
- package/lib/cjs/client.js +4 -6
- package/lib/cjs/client.js.map +1 -1
- package/lib/cjs/commands/command/codecs/update-item.d.ts +6 -0
- package/lib/cjs/commands/command/codecs/update-item.js +10 -0
- package/lib/cjs/commands/command/codecs/update-item.js.map +1 -0
- package/lib/cjs/commands/command/command.d.ts +2 -2
- package/lib/cjs/commands/command/command.js.map +1 -1
- package/lib/cjs/commands/command/commands.d.ts +2 -1
- package/lib/cjs/commands/command/commands.js.map +1 -1
- package/lib/cjs/commands/command/index.d.ts +1 -0
- package/lib/cjs/commands/command/index.js +3 -1
- package/lib/cjs/commands/command/index.js.map +1 -1
- package/lib/cjs/commands/command/inputs/index.d.ts +1 -0
- package/lib/cjs/commands/command/inputs/lib.d.ts +1 -1
- package/lib/cjs/commands/command/inputs/put-item.d.ts +2 -2
- package/lib/cjs/commands/command/inputs/query.d.ts +1 -1
- package/lib/cjs/commands/command/inputs/update-item.d.ts +13 -0
- package/lib/cjs/commands/command/inputs/update-item.js +36 -0
- package/lib/cjs/commands/command/inputs/update-item.js.map +1 -0
- package/lib/cjs/commands/command/outputs/index.d.ts +1 -0
- package/lib/cjs/commands/command/outputs/update-item.d.ts +3 -0
- package/lib/cjs/commands/command/outputs/update-item.js +7 -0
- package/lib/cjs/commands/command/outputs/update-item.js.map +1 -0
- package/lib/cjs/commands/command/update-item.d.ts +8 -0
- package/lib/cjs/commands/command/update-item.js +17 -0
- package/lib/cjs/commands/command/update-item.js.map +1 -0
- package/lib/cjs/commands/index.d.ts +0 -1
- package/lib/cjs/commands/write-transaction.d.ts +2 -3
- package/lib/cjs/commands/write-transaction.js +2 -2
- package/lib/cjs/commands/write-transaction.js.map +1 -1
- package/lib/esm/client.d.ts +3 -4
- package/lib/esm/client.js +5 -7
- package/lib/esm/client.js.map +1 -1
- package/lib/esm/commands/command/codecs/update-item.d.ts +6 -0
- package/lib/esm/commands/command/codecs/update-item.js +7 -0
- package/lib/esm/commands/command/codecs/update-item.js.map +1 -0
- package/lib/esm/commands/command/command.d.ts +2 -2
- package/lib/esm/commands/command/command.js.map +1 -1
- package/lib/esm/commands/command/commands.d.ts +2 -1
- package/lib/esm/commands/command/commands.js.map +1 -1
- package/lib/esm/commands/command/index.d.ts +1 -0
- package/lib/esm/commands/command/index.js +1 -0
- package/lib/esm/commands/command/index.js.map +1 -1
- package/lib/esm/commands/command/inputs/index.d.ts +1 -0
- package/lib/esm/commands/command/inputs/lib.d.ts +1 -1
- package/lib/esm/commands/command/inputs/put-item.d.ts +2 -2
- package/lib/esm/commands/command/inputs/query.d.ts +1 -1
- package/lib/esm/commands/command/inputs/update-item.d.ts +13 -0
- package/lib/esm/commands/command/inputs/update-item.js +33 -0
- package/lib/esm/commands/command/inputs/update-item.js.map +1 -0
- package/lib/esm/commands/command/outputs/index.d.ts +1 -0
- package/lib/esm/commands/command/outputs/update-item.d.ts +3 -0
- package/lib/esm/commands/command/outputs/update-item.js +4 -0
- package/lib/esm/commands/command/outputs/update-item.js.map +1 -0
- package/lib/esm/commands/command/update-item.d.ts +8 -0
- package/lib/esm/commands/command/update-item.js +13 -0
- package/lib/esm/commands/command/update-item.js.map +1 -0
- package/lib/esm/commands/index.d.ts +0 -1
- package/lib/esm/commands/write-transaction.d.ts +2 -3
- package/lib/esm/commands/write-transaction.js +2 -2
- package/lib/esm/commands/write-transaction.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/commands/update-item.d.ts +0 -20
- package/lib/cjs/commands/update-item.js +0 -51
- package/lib/cjs/commands/update-item.js.map +0 -1
- package/lib/esm/commands/update-item.d.ts +0 -20
- package/lib/esm/commands/update-item.js +0 -47
- package/lib/esm/commands/update-item.js.map +0 -1
package/lib/cjs/client.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ import type { Logger } from "@infra-blocks/logger-interface";
|
|
|
5
5
|
import { type Retry, type RetryConfig } from "@infra-blocks/retry";
|
|
6
6
|
import type { CommandOutput } from "./commands/command/command.js";
|
|
7
7
|
import type { DynamoDbClientCommand } from "./commands/command/commands.js";
|
|
8
|
-
import { type CreateTableInput, type CreateTableOutput, type DeleteItemInput, type DeleteItemOutput, type DeleteTableInput, type DeleteTableOutput, type GetItemInput, type GetItemOutput, type PutItemInput, type PutItemOutput, type QueryInput, type QueryOutput } from "./commands/index.js";
|
|
9
|
-
import { type UpdateItemParams } from "./commands/update-item.js";
|
|
8
|
+
import { type CreateTableInput, type CreateTableOutput, type DeleteItemInput, type DeleteItemOutput, type DeleteTableInput, type DeleteTableOutput, type GetItemInput, type GetItemOutput, type PutItemInput, type PutItemOutput, type QueryInput, type QueryOutput, type UpdateItemInput } from "./commands/index.js";
|
|
10
9
|
import { type UpdateTimeToLiveParams } from "./commands/update-time-to-live.js";
|
|
11
10
|
import { type WriteTransactionParams } from "./commands/write-transaction.js";
|
|
12
11
|
import type { Attributes, KeyAttributes, KeySchema } from "./types.js";
|
|
@@ -182,11 +181,11 @@ export declare class DynamoDbClient {
|
|
|
182
181
|
* In this design, the `params.update` is a list of {@link UpdateAction}s that
|
|
183
182
|
* can be constructed using the provided factory methods, such as {@link assign}.
|
|
184
183
|
*
|
|
185
|
-
* @param
|
|
184
|
+
* @param input - The parameters to use to update the item.
|
|
186
185
|
*
|
|
187
186
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
|
|
188
187
|
*/
|
|
189
|
-
updateItem<K extends KeyAttributes>(
|
|
188
|
+
updateItem<K extends KeyAttributes = KeyAttributes>(input: UpdateItemInput<K>): Promise<void>;
|
|
190
189
|
/**
|
|
191
190
|
* Updates the time to live settings of a table using the UpdateTimeToLive API.
|
|
192
191
|
*
|
package/lib/cjs/client.js
CHANGED
|
@@ -7,7 +7,6 @@ const null_logger_1 = require("@infra-blocks/null-logger");
|
|
|
7
7
|
const retry_1 = require("@infra-blocks/retry");
|
|
8
8
|
const types_1 = require("@infra-blocks/types");
|
|
9
9
|
const index_js_1 = require("./commands/index.js");
|
|
10
|
-
const update_item_js_1 = require("./commands/update-item.js");
|
|
11
10
|
const update_time_to_live_js_1 = require("./commands/update-time-to-live.js");
|
|
12
11
|
const write_transaction_js_1 = require("./commands/write-transaction.js");
|
|
13
12
|
const error_js_1 = require("./error.js");
|
|
@@ -232,16 +231,15 @@ class DynamoDbClient {
|
|
|
232
231
|
* In this design, the `params.update` is a list of {@link UpdateAction}s that
|
|
233
232
|
* can be constructed using the provided factory methods, such as {@link assign}.
|
|
234
233
|
*
|
|
235
|
-
* @param
|
|
234
|
+
* @param input - The parameters to use to update the item.
|
|
236
235
|
*
|
|
237
236
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
|
|
238
237
|
*/
|
|
239
|
-
async updateItem(
|
|
238
|
+
async updateItem(input) {
|
|
240
239
|
if (this.logger.isDebugEnabled()) {
|
|
241
|
-
this.logger.debug("updateItem(%s)", JSON.stringify(
|
|
240
|
+
this.logger.debug("updateItem(%s)", JSON.stringify(input));
|
|
242
241
|
}
|
|
243
|
-
|
|
244
|
-
await this.client.send(command.toAwsCommand());
|
|
242
|
+
await this.send(new index_js_1.UpdateItem(input));
|
|
245
243
|
}
|
|
246
244
|
/**
|
|
247
245
|
* Updates the time to live settings of a table using the UpdateTimeToLive API.
|
package/lib/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AACA,8DAA6E;AAE7E,wDAA+D;AAE/D,2DAAuD;AACvD,+CAA0E;AAC1E,+CAA8C;AAG9C,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AACA,8DAA6E;AAE7E,wDAA+D;AAE/D,2DAAuD;AACvD,+CAA0E;AAC1E,+CAA8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"__esModule", { value: true });
|
|
3
|
+
exports.UpdateItemCodec = void 0;
|
|
4
|
+
const update_item_js_1 = require("../inputs/update-item.js");
|
|
5
|
+
const update_item_js_2 = require("../outputs/update-item.js");
|
|
6
|
+
exports.UpdateItemCodec = {
|
|
7
|
+
encode: update_item_js_1.encode,
|
|
8
|
+
decode: update_item_js_2.decode,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=update-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/codecs/update-item.ts"],"names":[],"mappings":";;;AAAA,6DAAkD;AAClD,8DAAmD;AAEtC,QAAA,eAAe,GAAG;IAC7B,MAAM,EAAN,uBAAM;IACN,MAAM,EAAN,uBAAM;CACP,CAAC"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* each other trolololol. Hence, we use `any` where necessary as an escape hatch to this typing nightmare.
|
|
6
6
|
*/
|
|
7
7
|
import type { CreateTableCommand, DeleteTableCommand } from "@aws-sdk/client-dynamodb";
|
|
8
|
-
import type { DeleteCommand, DynamoDBDocumentClient, GetCommand, PutCommand, QueryCommand } from "@aws-sdk/lib-dynamodb";
|
|
8
|
+
import type { DeleteCommand, DynamoDBDocumentClient, GetCommand, PutCommand, QueryCommand, UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
9
9
|
import type { GetOutputType } from "@smithy/types";
|
|
10
10
|
import type { Codec } from "./codecs/codec.js";
|
|
11
|
-
type NativeCommand = DeleteCommand | GetCommand | CreateTableCommand | DeleteTableCommand | PutCommand | QueryCommand;
|
|
11
|
+
type NativeCommand = DeleteCommand | GetCommand | CreateTableCommand | DeleteTableCommand | PutCommand | QueryCommand | UpdateCommand;
|
|
12
12
|
type NativeCommandCtor<C extends NativeCommand> = new (input: C["input"]) => C;
|
|
13
13
|
export type CommandOutput<C extends Command<unknown, unknown>> = Awaited<ReturnType<C["execute"]>>;
|
|
14
14
|
export type CommandInput<C extends Command<unknown, unknown>> = C["input"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/commands/command/command.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/commands/command/command.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAcH,+CAA8C;AA2B9C,gBAAgB;AAChB,MAAsB,eAAe;IAM1B,KAAK,CAAI;IAEC,KAAK,CAA4C;IACjD,OAAO,CAAuB;IAEjD,YAAsB,MAIrB;QACC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAA0C;QACtD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,MAAM,YAAY,GAAe,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAc,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,CAAC;IACnD,CAAC;CACF;AA7BD,0CA6BC"}
|
|
@@ -4,4 +4,5 @@ import type { DeleteTable } from "./delete-table.js";
|
|
|
4
4
|
import type { GetItem } from "./get-item.js";
|
|
5
5
|
import type { PutItem } from "./put-item.js";
|
|
6
6
|
import type { Query } from "./query.js";
|
|
7
|
-
|
|
7
|
+
import type { UpdateItem } from "./update-item.js";
|
|
8
|
+
export type DynamoDbClientCommand = DeleteItem | GetItem | CreateTable | DeleteTable | PutItem | Query | UpdateItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/commands/command/commands.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/commands/command/commands.ts"],"names":[],"mappings":";;AAiBA,8CAA8C"}
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Query = exports.PutItem = exports.GetItem = exports.DeleteTable = exports.DeleteItem = exports.CreateTable = void 0;
|
|
17
|
+
exports.UpdateItem = exports.Query = exports.PutItem = exports.GetItem = exports.DeleteTable = exports.DeleteItem = exports.CreateTable = void 0;
|
|
18
18
|
var create_table_js_1 = require("./create-table.js");
|
|
19
19
|
Object.defineProperty(exports, "CreateTable", { enumerable: true, get: function () { return create_table_js_1.CreateTable; } });
|
|
20
20
|
var delete_item_js_1 = require("./delete-item.js");
|
|
@@ -30,4 +30,6 @@ var put_item_js_1 = require("./put-item.js");
|
|
|
30
30
|
Object.defineProperty(exports, "PutItem", { enumerable: true, get: function () { return put_item_js_1.PutItem; } });
|
|
31
31
|
var query_js_1 = require("./query.js");
|
|
32
32
|
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return query_js_1.Query; } });
|
|
33
|
+
var update_item_js_1 = require("./update-item.js");
|
|
34
|
+
Object.defineProperty(exports, "UpdateItem", { enumerable: true, get: function () { return update_item_js_1.UpdateItem; } });
|
|
33
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,+GAA+G;AAC/G,oDAAkC;AAClC,qDAAmC;AACnC,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,+GAA+G;AAC/G,oDAAkC;AAClC,qDAAmC;AACnC,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AACd,mDAA8C;AAArC,4GAAA,UAAU,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttributePath, AttributeValue } from "../../../
|
|
1
|
+
import type { AttributePath, AttributeValue } from "../../../types.js";
|
|
2
2
|
import { type PathSubstitution, type ValueSubstitution } from "../../attributes/index.js";
|
|
3
3
|
import type { ConditionParams } from "../../expressions/index.js";
|
|
4
4
|
export declare function intoExpressionComponents(condition: ConditionParams): {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PutCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import type { Attributes } from "../../../
|
|
3
|
-
import type { ConditionParams } from "../../index.js";
|
|
2
|
+
import type { Attributes } from "../../../types.js";
|
|
3
|
+
import type { ConditionParams } from "../../expressions/index.js";
|
|
4
4
|
export type PutItemReturnValue = "ALL_OLD" | "NONE";
|
|
5
5
|
export type PutItemInput<T extends Attributes = Attributes> = {
|
|
6
6
|
table: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import type { KeyAttributes } from "../../../
|
|
2
|
+
import type { KeyAttributes } from "../../../types.js";
|
|
3
3
|
import type { KeyConditionExpression } from "../../expressions/index.js";
|
|
4
4
|
export type QueryInput<K extends KeyAttributes = KeyAttributes> = {
|
|
5
5
|
table: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UpdateCommandInput as NativeUpdateCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { WithRequired } from "@infra-blocks/types";
|
|
3
|
+
import type { KeyAttributes } from "../../../types.js";
|
|
4
|
+
import { type ConditionParams, type UpdateExpressionParams } from "../../expressions/index.js";
|
|
5
|
+
type UpdateCommandInput = WithRequired<NativeUpdateCommandInput, "UpdateExpression">;
|
|
6
|
+
export interface UpdateItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
7
|
+
table: string;
|
|
8
|
+
key: K;
|
|
9
|
+
update: UpdateExpressionParams;
|
|
10
|
+
condition?: ConditionParams;
|
|
11
|
+
}
|
|
12
|
+
export declare function encode<K extends KeyAttributes = KeyAttributes>(input: UpdateItemInput<K>): UpdateCommandInput;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encode = encode;
|
|
4
|
+
const index_js_1 = require("../../attributes/index.js");
|
|
5
|
+
const expression_js_1 = require("../../expressions/condition/expression.js");
|
|
6
|
+
const index_js_2 = require("../../expressions/index.js");
|
|
7
|
+
function encode(input) {
|
|
8
|
+
const { table, key, condition, update } = input;
|
|
9
|
+
const names = index_js_1.AttributeNames.create();
|
|
10
|
+
const values = index_js_1.AttributeValues.create();
|
|
11
|
+
const result = {
|
|
12
|
+
TableName: table,
|
|
13
|
+
Key: key,
|
|
14
|
+
UpdateExpression: index_js_2.UpdateExpression.from(update).stringify({
|
|
15
|
+
names,
|
|
16
|
+
values,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
// If there is no condition, we know that the names and values are finalized and
|
|
20
|
+
// we are ready to return the payload.
|
|
21
|
+
if (condition == null) {
|
|
22
|
+
result.ExpressionAttributeNames = names.getSubstitutions();
|
|
23
|
+
result.ExpressionAttributeValues = values.getSubstitutions();
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
// Otherwise, we need to stringify the condition, reusing the same names and values
|
|
27
|
+
// as before.
|
|
28
|
+
result.ConditionExpression = (0, expression_js_1.conditionExpression)(condition).stringify({
|
|
29
|
+
names,
|
|
30
|
+
values,
|
|
31
|
+
});
|
|
32
|
+
result.ExpressionAttributeNames = names.getSubstitutions();
|
|
33
|
+
result.ExpressionAttributeValues = values.getSubstitutions();
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=update-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/update-item.ts"],"names":[],"mappings":";;AAgCA,wBAiCC;AA9DD,wDAA4E;AAC5E,6EAAgF;AAChF,yDAIoC;AAuBpC,SAAgB,MAAM,CACpB,KAAyB;IAEzB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEhD,MAAM,KAAK,GAAG,yBAAc,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,0BAAe,CAAC,MAAM,EAAE,CAAC;IACxC,MAAM,MAAM,GAAuB;QACjC,SAAS,EAAE,KAAK;QAChB,GAAG,EAAE,GAAG;QACR,gBAAgB,EAAE,2BAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;YACxD,KAAK;YACL,MAAM;SACP,CAAC;KACH,CAAC;IAEF,gFAAgF;IAChF,sCAAsC;IACtC,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;QACtB,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3D,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mFAAmF;IACnF,aAAa;IACb,MAAM,CAAC,mBAAmB,GAAG,IAAA,mCAAmB,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC;QACpE,KAAK;QACL,MAAM;KACP,CAAC,CAAC;IACH,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC7D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -4,3 +4,4 @@ export type { DeleteTableOutput } from "./delete-table.js";
|
|
|
4
4
|
export type { GetItemOutput } from "./get-item.js";
|
|
5
5
|
export type { PutItemOutput } from "./put-item.js";
|
|
6
6
|
export type { QueryOutput } from "./query.js";
|
|
7
|
+
export type { UpdateItemOutput } from "./update-item.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/update-item.ts"],"names":[],"mappings":";;AAIA,wBAEC;AAFD,SAAgB,MAAM,CAAC,CAA0B;IAC/C,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { KeyAttributes } from "../../types.js";
|
|
3
|
+
import { AbstractCommand } from "./command.js";
|
|
4
|
+
import type { UpdateItemInput } from "./inputs/update-item.js";
|
|
5
|
+
import type { UpdateItemOutput } from "./outputs/update-item.js";
|
|
6
|
+
export declare class UpdateItem<K extends KeyAttributes = KeyAttributes> extends AbstractCommand<UpdateItemInput<K>, UpdateItemOutput, UpdateCommand> {
|
|
7
|
+
constructor(input: UpdateItemInput<K>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateItem = void 0;
|
|
4
|
+
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
5
|
+
const update_item_js_1 = require("./codecs/update-item.js");
|
|
6
|
+
const command_js_1 = require("./command.js");
|
|
7
|
+
class UpdateItem extends command_js_1.AbstractCommand {
|
|
8
|
+
constructor(input) {
|
|
9
|
+
super({
|
|
10
|
+
input,
|
|
11
|
+
codec: update_item_js_1.UpdateItemCodec,
|
|
12
|
+
command: lib_dynamodb_1.UpdateCommand,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UpdateItem = UpdateItem;
|
|
17
|
+
//# sourceMappingURL=update-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/command/update-item.ts"],"names":[],"mappings":";;;AAAA,wDAAsD;AAEtD,4DAA0D;AAC1D,6CAA+C;AAI/C,MAAa,UAEX,SAAQ,4BAAoE;IAC5E,YAAY,KAAyB;QACnC,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,gCAAe;YACtB,OAAO,EAAE,4BAAa;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AAVD,gCAUC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./command/index.js";
|
|
2
2
|
export * from "./expressions/index.js";
|
|
3
|
-
export type { UpdateItemParams } from "./update-item.js";
|
|
4
3
|
export type { UpdateTimeToLiveParams } from "./update-time-to-live.js";
|
|
5
4
|
export type { ConditionCheckParams, WriteTransactionParams, } from "./write-transaction.js";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TransactWriteCommand, type TransactWriteCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../types.js";
|
|
3
|
-
import type { DeleteItemInput, PutItemInput } from "./command/
|
|
3
|
+
import type { DeleteItemInput, PutItemInput, UpdateItemInput } from "./command/index.js";
|
|
4
4
|
import type { ConditionParams } from "./expressions/index.js";
|
|
5
5
|
import type { Command } from "./types.js";
|
|
6
|
-
import { type UpdateItemParams } from "./update-item.js";
|
|
7
6
|
export type ConditionCheckParams = {
|
|
8
7
|
table: string;
|
|
9
8
|
key: Attributes;
|
|
@@ -12,7 +11,7 @@ export type ConditionCheckParams = {
|
|
|
12
11
|
export type WriteTransactionAction = {
|
|
13
12
|
put: PutItemInput;
|
|
14
13
|
} | {
|
|
15
|
-
update:
|
|
14
|
+
update: UpdateItemInput;
|
|
16
15
|
} | {
|
|
17
16
|
delete: DeleteItemInput;
|
|
18
17
|
} | {
|
|
@@ -7,8 +7,8 @@ const names_js_1 = require("./attributes/names.js");
|
|
|
7
7
|
const values_js_1 = require("./attributes/values.js");
|
|
8
8
|
const delete_item_js_1 = require("./command/codecs/delete-item.js");
|
|
9
9
|
const put_item_js_1 = require("./command/codecs/put-item.js");
|
|
10
|
+
const update_item_js_1 = require("./command/codecs/update-item.js");
|
|
10
11
|
const expression_js_1 = require("./expressions/condition/expression.js");
|
|
11
|
-
const update_item_js_1 = require("./update-item.js");
|
|
12
12
|
const ConditionCheck = {
|
|
13
13
|
toAwsCommandInput(params) {
|
|
14
14
|
const { table, key, condition } = params;
|
|
@@ -37,7 +37,7 @@ const WriteTransactionAction = {
|
|
|
37
37
|
}
|
|
38
38
|
if ("update" in write) {
|
|
39
39
|
return {
|
|
40
|
-
Update: update_item_js_1.
|
|
40
|
+
Update: update_item_js_1.UpdateItemCodec.encode(write.update),
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
if ("delete" in write) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-transaction.js","sourceRoot":"","sources":["../../../src/commands/write-transaction.ts"],"names":[],"mappings":";;;AAAA,wDAG+B;AAC/B,+CAAsE;AAEtE,oDAAuD;AACvD,sDAAyD;AACzD,oEAAkE;AAClE,8DAA4D;
|
|
1
|
+
{"version":3,"file":"write-transaction.js","sourceRoot":"","sources":["../../../src/commands/write-transaction.ts"],"names":[],"mappings":";;;AAAA,wDAG+B;AAC/B,+CAAsE;AAEtE,oDAAuD;AACvD,sDAAyD;AACzD,oEAAkE;AAClE,8DAA4D;AAC5D,oEAAkE;AAMlE,yEAA4E;AAM5E,MAAM,cAAc,GAAG;IACrB,iBAAiB,CAAC,MAA4B;QAC5C,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAEzC,MAAM,KAAK,GAAG,yBAAc,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,2BAAe,CAAC,MAAM,EAAE,CAAC;QACxC,gFAAgF;QAChF,MAAM,UAAU,GAAG,IAAA,mCAAmB,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC;YAC1D,KAAK;YACL,MAAM;SACP,CAAC,CAAC;QAEH,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,GAAG,EAAE,GAAG;YACR,mBAAmB,EAAE,UAAU;YAC/B,wBAAwB,EAAE,KAAK,CAAC,gBAAgB,EAAE;YAClD,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE;SACrD,CAAC;IACJ,CAAC;CACF,CAAC;AAMF,MAAM,sBAAsB,GAAG;IAC7B,iBAAiB,CAAC,KAA6B;QAC7C,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACnB,OAAO;gBACL,GAAG,EAAE,0BAAY,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;aACpC,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,gCAAe,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;aAC7C,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,gCAAe,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;aAC7C,CAAC;QACJ,CAAC;QACD,IAAI,gBAAgB,IAAI,KAAK,EAAE,CAAC;YAC9B,OAAO;gBACL,cAAc,EAAE,cAAc,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC;aACvE,CAAC;QACJ,CAAC;QACD,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC;IACrB,CAAC;CACF,CAAC;AAkBF,2HAA2H;AAC3H,MAAa,gBAAgB;IAGV,MAAM,CAA2B;IAElD,YAAoB,MAA8B;QAChD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,iBAAiB;QACf,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,iBAAiB,CAAC;SACzE,CAAC;IACJ,CAAC;IAED,YAAY;QACV,OAAO,IAAI,mCAAoB,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF;AAvBD,4CAuBC"}
|
package/lib/esm/client.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ import type { Logger } from "@infra-blocks/logger-interface";
|
|
|
5
5
|
import { type Retry, type RetryConfig } from "@infra-blocks/retry";
|
|
6
6
|
import type { CommandOutput } from "./commands/command/command.js";
|
|
7
7
|
import type { DynamoDbClientCommand } from "./commands/command/commands.js";
|
|
8
|
-
import { type CreateTableInput, type CreateTableOutput, type DeleteItemInput, type DeleteItemOutput, type DeleteTableInput, type DeleteTableOutput, type GetItemInput, type GetItemOutput, type PutItemInput, type PutItemOutput, type QueryInput, type QueryOutput } from "./commands/index.js";
|
|
9
|
-
import { type UpdateItemParams } from "./commands/update-item.js";
|
|
8
|
+
import { type CreateTableInput, type CreateTableOutput, type DeleteItemInput, type DeleteItemOutput, type DeleteTableInput, type DeleteTableOutput, type GetItemInput, type GetItemOutput, type PutItemInput, type PutItemOutput, type QueryInput, type QueryOutput, type UpdateItemInput } from "./commands/index.js";
|
|
10
9
|
import { type UpdateTimeToLiveParams } from "./commands/update-time-to-live.js";
|
|
11
10
|
import { type WriteTransactionParams } from "./commands/write-transaction.js";
|
|
12
11
|
import type { Attributes, KeyAttributes, KeySchema } from "./types.js";
|
|
@@ -182,11 +181,11 @@ export declare class DynamoDbClient {
|
|
|
182
181
|
* In this design, the `params.update` is a list of {@link UpdateAction}s that
|
|
183
182
|
* can be constructed using the provided factory methods, such as {@link assign}.
|
|
184
183
|
*
|
|
185
|
-
* @param
|
|
184
|
+
* @param input - The parameters to use to update the item.
|
|
186
185
|
*
|
|
187
186
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
|
|
188
187
|
*/
|
|
189
|
-
updateItem<K extends KeyAttributes>(
|
|
188
|
+
updateItem<K extends KeyAttributes = KeyAttributes>(input: UpdateItemInput<K>): Promise<void>;
|
|
190
189
|
/**
|
|
191
190
|
* Updates the time to live settings of a table using the UpdateTimeToLive API.
|
|
192
191
|
*
|
package/lib/esm/client.js
CHANGED
|
@@ -3,8 +3,7 @@ import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
|
|
|
3
3
|
import { NullLogger } from "@infra-blocks/null-logger";
|
|
4
4
|
import { retry } from "@infra-blocks/retry";
|
|
5
5
|
import { trusted } from "@infra-blocks/types";
|
|
6
|
-
import { CreateTable, DeleteItem, DeleteTable, GetItem, PutItem, Query, } from "./commands/index.js";
|
|
7
|
-
import { UpdateItem } from "./commands/update-item.js";
|
|
6
|
+
import { CreateTable, DeleteItem, DeleteTable, GetItem, PutItem, Query, UpdateItem, } from "./commands/index.js";
|
|
8
7
|
import { UpdateTimeToLive, } from "./commands/update-time-to-live.js";
|
|
9
8
|
import { WriteTransaction, } from "./commands/write-transaction.js";
|
|
10
9
|
import { TooManyItemsException } from "./error.js";
|
|
@@ -229,16 +228,15 @@ export class DynamoDbClient {
|
|
|
229
228
|
* In this design, the `params.update` is a list of {@link UpdateAction}s that
|
|
230
229
|
* can be constructed using the provided factory methods, such as {@link assign}.
|
|
231
230
|
*
|
|
232
|
-
* @param
|
|
231
|
+
* @param input - The parameters to use to update the item.
|
|
233
232
|
*
|
|
234
233
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
|
|
235
234
|
*/
|
|
236
|
-
async updateItem(
|
|
235
|
+
async updateItem(input) {
|
|
237
236
|
if (this.logger.isDebugEnabled()) {
|
|
238
|
-
this.logger.debug("updateItem(%s)", JSON.stringify(
|
|
237
|
+
this.logger.debug("updateItem(%s)", JSON.stringify(input));
|
|
239
238
|
}
|
|
240
|
-
|
|
241
|
-
await this.client.send(command.toAwsCommand());
|
|
239
|
+
await this.send(new UpdateItem(input));
|
|
242
240
|
}
|
|
243
241
|
/**
|
|
244
242
|
* Updates the time to live settings of a table using the UpdateTimeToLive API.
|
package/lib/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAgC,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,q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,GAAG,MAAM,CAAC;QACxD,OAAO,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,MAAM,CAAC,MAAqB;QACjC,MAAM,CAAC,GAAG,MAAM,IAAI,EAAE,CAAC;QACvB,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,sBAAsB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;QACjE,OAAO,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/codecs/update-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;IACN,MAAM;CACP,CAAC"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* each other trolololol. Hence, we use `any` where necessary as an escape hatch to this typing nightmare.
|
|
6
6
|
*/
|
|
7
7
|
import type { CreateTableCommand, DeleteTableCommand } from "@aws-sdk/client-dynamodb";
|
|
8
|
-
import type { DeleteCommand, DynamoDBDocumentClient, GetCommand, PutCommand, QueryCommand } from "@aws-sdk/lib-dynamodb";
|
|
8
|
+
import type { DeleteCommand, DynamoDBDocumentClient, GetCommand, PutCommand, QueryCommand, UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
9
9
|
import type { GetOutputType } from "@smithy/types";
|
|
10
10
|
import type { Codec } from "./codecs/codec.js";
|
|
11
|
-
type NativeCommand = DeleteCommand | GetCommand | CreateTableCommand | DeleteTableCommand | PutCommand | QueryCommand;
|
|
11
|
+
type NativeCommand = DeleteCommand | GetCommand | CreateTableCommand | DeleteTableCommand | PutCommand | QueryCommand | UpdateCommand;
|
|
12
12
|
type NativeCommandCtor<C extends NativeCommand> = new (input: C["input"]) => C;
|
|
13
13
|
export type CommandOutput<C extends Command<unknown, unknown>> = Awaited<ReturnType<C["execute"]>>;
|
|
14
14
|
export type CommandInput<C extends Command<unknown, unknown>> = C["input"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/commands/command/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/commands/command/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA2B9C,gBAAgB;AAChB,MAAM,OAAgB,eAAe;IAM1B,KAAK,CAAI;IAEC,KAAK,CAA4C;IACjD,OAAO,CAAuB;IAEjD,YAAsB,MAIrB;QACC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAA0C;QACtD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,MAAM,YAAY,GAAe,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAc,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -4,4 +4,5 @@ import type { DeleteTable } from "./delete-table.js";
|
|
|
4
4
|
import type { GetItem } from "./get-item.js";
|
|
5
5
|
import type { PutItem } from "./put-item.js";
|
|
6
6
|
import type { Query } from "./query.js";
|
|
7
|
-
|
|
7
|
+
import type { UpdateItem } from "./update-item.js";
|
|
8
|
+
export type DynamoDbClientCommand = DeleteItem | GetItem | CreateTable | DeleteTable | PutItem | Query | UpdateItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/commands/command/commands.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/commands/command/commands.ts"],"names":[],"mappings":";AAiBA,8CAA8C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,+GAA+G;AAC/G,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,+GAA+G;AAC/G,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttributePath, AttributeValue } from "../../../
|
|
1
|
+
import type { AttributePath, AttributeValue } from "../../../types.js";
|
|
2
2
|
import { type PathSubstitution, type ValueSubstitution } from "../../attributes/index.js";
|
|
3
3
|
import type { ConditionParams } from "../../expressions/index.js";
|
|
4
4
|
export declare function intoExpressionComponents(condition: ConditionParams): {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PutCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import type { Attributes } from "../../../
|
|
3
|
-
import type { ConditionParams } from "../../index.js";
|
|
2
|
+
import type { Attributes } from "../../../types.js";
|
|
3
|
+
import type { ConditionParams } from "../../expressions/index.js";
|
|
4
4
|
export type PutItemReturnValue = "ALL_OLD" | "NONE";
|
|
5
5
|
export type PutItemInput<T extends Attributes = Attributes> = {
|
|
6
6
|
table: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import type { KeyAttributes } from "../../../
|
|
2
|
+
import type { KeyAttributes } from "../../../types.js";
|
|
3
3
|
import type { KeyConditionExpression } from "../../expressions/index.js";
|
|
4
4
|
export type QueryInput<K extends KeyAttributes = KeyAttributes> = {
|
|
5
5
|
table: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UpdateCommandInput as NativeUpdateCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { WithRequired } from "@infra-blocks/types";
|
|
3
|
+
import type { KeyAttributes } from "../../../types.js";
|
|
4
|
+
import { type ConditionParams, type UpdateExpressionParams } from "../../expressions/index.js";
|
|
5
|
+
type UpdateCommandInput = WithRequired<NativeUpdateCommandInput, "UpdateExpression">;
|
|
6
|
+
export interface UpdateItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
7
|
+
table: string;
|
|
8
|
+
key: K;
|
|
9
|
+
update: UpdateExpressionParams;
|
|
10
|
+
condition?: ConditionParams;
|
|
11
|
+
}
|
|
12
|
+
export declare function encode<K extends KeyAttributes = KeyAttributes>(input: UpdateItemInput<K>): UpdateCommandInput;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AttributeNames, AttributeValues } from "../../attributes/index.js";
|
|
2
|
+
import { conditionExpression } from "../../expressions/condition/expression.js";
|
|
3
|
+
import { UpdateExpression, } from "../../expressions/index.js";
|
|
4
|
+
export function encode(input) {
|
|
5
|
+
const { table, key, condition, update } = input;
|
|
6
|
+
const names = AttributeNames.create();
|
|
7
|
+
const values = AttributeValues.create();
|
|
8
|
+
const result = {
|
|
9
|
+
TableName: table,
|
|
10
|
+
Key: key,
|
|
11
|
+
UpdateExpression: UpdateExpression.from(update).stringify({
|
|
12
|
+
names,
|
|
13
|
+
values,
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
// If there is no condition, we know that the names and values are finalized and
|
|
17
|
+
// we are ready to return the payload.
|
|
18
|
+
if (condition == null) {
|
|
19
|
+
result.ExpressionAttributeNames = names.getSubstitutions();
|
|
20
|
+
result.ExpressionAttributeValues = values.getSubstitutions();
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
// Otherwise, we need to stringify the condition, reusing the same names and values
|
|
24
|
+
// as before.
|
|
25
|
+
result.ConditionExpression = conditionExpression(condition).stringify({
|
|
26
|
+
names,
|
|
27
|
+
values,
|
|
28
|
+
});
|
|
29
|
+
result.ExpressionAttributeNames = names.getSubstitutions();
|
|
30
|
+
result.ExpressionAttributeValues = values.getSubstitutions();
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=update-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/update-item.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAEL,gBAAgB,GAEjB,MAAM,4BAA4B,CAAC;AAuBpC,MAAM,UAAU,MAAM,CACpB,KAAyB;IAEzB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEhD,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;IACxC,MAAM,MAAM,GAAuB;QACjC,SAAS,EAAE,KAAK;QAChB,GAAG,EAAE,GAAG;QACR,gBAAgB,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;YACxD,KAAK;YACL,MAAM;SACP,CAAC;KACH,CAAC;IAEF,gFAAgF;IAChF,sCAAsC;IACtC,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;QACtB,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3D,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mFAAmF;IACnF,aAAa;IACb,MAAM,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;QACpE,KAAK;QACL,MAAM;KACP,CAAC,CAAC;IACH,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC7D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -4,3 +4,4 @@ export type { DeleteTableOutput } from "./delete-table.js";
|
|
|
4
4
|
export type { GetItemOutput } from "./get-item.js";
|
|
5
5
|
export type { PutItemOutput } from "./put-item.js";
|
|
6
6
|
export type { QueryOutput } from "./query.js";
|
|
7
|
+
export type { UpdateItemOutput } from "./update-item.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/update-item.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,MAAM,CAAC,CAA0B;IAC/C,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { KeyAttributes } from "../../types.js";
|
|
3
|
+
import { AbstractCommand } from "./command.js";
|
|
4
|
+
import type { UpdateItemInput } from "./inputs/update-item.js";
|
|
5
|
+
import type { UpdateItemOutput } from "./outputs/update-item.js";
|
|
6
|
+
export declare class UpdateItem<K extends KeyAttributes = KeyAttributes> extends AbstractCommand<UpdateItemInput<K>, UpdateItemOutput, UpdateCommand> {
|
|
7
|
+
constructor(input: UpdateItemInput<K>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import { UpdateItemCodec } from "./codecs/update-item.js";
|
|
3
|
+
import { AbstractCommand } from "./command.js";
|
|
4
|
+
export class UpdateItem extends AbstractCommand {
|
|
5
|
+
constructor(input) {
|
|
6
|
+
super({
|
|
7
|
+
input,
|
|
8
|
+
codec: UpdateItemCodec,
|
|
9
|
+
command: UpdateCommand,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=update-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/command/update-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,MAAM,OAAO,UAEX,SAAQ,eAAoE;IAC5E,YAAY,KAAyB;QACnC,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,aAAa;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./command/index.js";
|
|
2
2
|
export * from "./expressions/index.js";
|
|
3
|
-
export type { UpdateItemParams } from "./update-item.js";
|
|
4
3
|
export type { UpdateTimeToLiveParams } from "./update-time-to-live.js";
|
|
5
4
|
export type { ConditionCheckParams, WriteTransactionParams, } from "./write-transaction.js";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TransactWriteCommand, type TransactWriteCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes } from "../types.js";
|
|
3
|
-
import type { DeleteItemInput, PutItemInput } from "./command/
|
|
3
|
+
import type { DeleteItemInput, PutItemInput, UpdateItemInput } from "./command/index.js";
|
|
4
4
|
import type { ConditionParams } from "./expressions/index.js";
|
|
5
5
|
import type { Command } from "./types.js";
|
|
6
|
-
import { type UpdateItemParams } from "./update-item.js";
|
|
7
6
|
export type ConditionCheckParams = {
|
|
8
7
|
table: string;
|
|
9
8
|
key: Attributes;
|
|
@@ -12,7 +11,7 @@ export type ConditionCheckParams = {
|
|
|
12
11
|
export type WriteTransactionAction = {
|
|
13
12
|
put: PutItemInput;
|
|
14
13
|
} | {
|
|
15
|
-
update:
|
|
14
|
+
update: UpdateItemInput;
|
|
16
15
|
} | {
|
|
17
16
|
delete: DeleteItemInput;
|
|
18
17
|
} | {
|
|
@@ -4,8 +4,8 @@ import { AttributeNames } from "./attributes/names.js";
|
|
|
4
4
|
import { AttributeValues } from "./attributes/values.js";
|
|
5
5
|
import { DeleteItemCodec } from "./command/codecs/delete-item.js";
|
|
6
6
|
import { PutItemCodec } from "./command/codecs/put-item.js";
|
|
7
|
+
import { UpdateItemCodec } from "./command/codecs/update-item.js";
|
|
7
8
|
import { conditionExpression } from "./expressions/condition/expression.js";
|
|
8
|
-
import { UpdateItem } from "./update-item.js";
|
|
9
9
|
const ConditionCheck = {
|
|
10
10
|
toAwsCommandInput(params) {
|
|
11
11
|
const { table, key, condition } = params;
|
|
@@ -34,7 +34,7 @@ const WriteTransactionAction = {
|
|
|
34
34
|
}
|
|
35
35
|
if ("update" in write) {
|
|
36
36
|
return {
|
|
37
|
-
Update:
|
|
37
|
+
Update: UpdateItemCodec.encode(write.update),
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
if ("delete" in write) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-transaction.js","sourceRoot":"","sources":["../../../src/commands/write-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"write-transaction.js","sourceRoot":"","sources":["../../../src/commands/write-transaction.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AAK,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;aAC7C,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;aAC7C,CAAC;QACJ,CAAC;QACD,IAAI,gBAAgB,IAAI,KAAK,EAAE,CAAC;YAC9B,OAAO;gBACL,cAAc,EAAE,cAAc,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC;aACvE,CAAC;QACJ,CAAC;QACD,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;CACF,CAAC;AAkBF,2HAA2H;AAC3H,MAAM,OAAO,gBAAgB;IAGV,MAAM,CAA2B;IAElD,YAAoB,MAA8B;QAChD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,iBAAiB;QACf,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,iBAAiB,CAAC;SACzE,CAAC;IACJ,CAAC;IAED,YAAY;QACV,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type UpdateCommandInput as NativeUpdateCommandInput, UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import type { WithRequired } from "@infra-blocks/types";
|
|
3
|
-
import type { KeyAttributes } from "../types.js";
|
|
4
|
-
import { type ConditionParams, type UpdateExpressionParams } from "./expressions/index.js";
|
|
5
|
-
import type { Command } from "./types.js";
|
|
6
|
-
type UpdateCommandInput = WithRequired<NativeUpdateCommandInput, "UpdateExpression">;
|
|
7
|
-
export interface UpdateItemParams<K extends KeyAttributes = KeyAttributes> {
|
|
8
|
-
table: string;
|
|
9
|
-
key: K;
|
|
10
|
-
update: UpdateExpressionParams;
|
|
11
|
-
condition?: ConditionParams;
|
|
12
|
-
}
|
|
13
|
-
export declare class UpdateItem<K extends KeyAttributes> implements Command<UpdateCommandInput, UpdateCommand> {
|
|
14
|
-
private readonly params;
|
|
15
|
-
private constructor();
|
|
16
|
-
toAwsCommandInput(): UpdateCommandInput;
|
|
17
|
-
toAwsCommand(): UpdateCommand;
|
|
18
|
-
static from<K extends KeyAttributes>(params: UpdateItemParams<K>): UpdateItem<K>;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateItem = void 0;
|
|
4
|
-
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
5
|
-
const names_js_1 = require("./attributes/names.js");
|
|
6
|
-
const values_js_1 = require("./attributes/values.js");
|
|
7
|
-
const expression_js_1 = require("./expressions/condition/expression.js");
|
|
8
|
-
const index_js_1 = require("./expressions/index.js");
|
|
9
|
-
class UpdateItem {
|
|
10
|
-
params;
|
|
11
|
-
constructor(params) {
|
|
12
|
-
this.params = params;
|
|
13
|
-
}
|
|
14
|
-
toAwsCommandInput() {
|
|
15
|
-
const { table, key, condition, update } = this.params;
|
|
16
|
-
const names = names_js_1.AttributeNames.create();
|
|
17
|
-
const values = values_js_1.AttributeValues.create();
|
|
18
|
-
const input = {
|
|
19
|
-
TableName: table,
|
|
20
|
-
Key: key,
|
|
21
|
-
UpdateExpression: index_js_1.UpdateExpression.from(update).stringify({
|
|
22
|
-
names,
|
|
23
|
-
values,
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
// If there is no condition, we know that the names and values are finalized and
|
|
27
|
-
// we are ready to return the payload.
|
|
28
|
-
if (condition == null) {
|
|
29
|
-
input.ExpressionAttributeNames = names.getSubstitutions();
|
|
30
|
-
input.ExpressionAttributeValues = values.getSubstitutions();
|
|
31
|
-
return input;
|
|
32
|
-
}
|
|
33
|
-
// Otherwise, we need to stringify the condition, reusing the same names and values
|
|
34
|
-
// as before.
|
|
35
|
-
input.ConditionExpression = (0, expression_js_1.conditionExpression)(condition).stringify({
|
|
36
|
-
names,
|
|
37
|
-
values,
|
|
38
|
-
});
|
|
39
|
-
input.ExpressionAttributeNames = names.getSubstitutions();
|
|
40
|
-
input.ExpressionAttributeValues = values.getSubstitutions();
|
|
41
|
-
return input;
|
|
42
|
-
}
|
|
43
|
-
toAwsCommand() {
|
|
44
|
-
return new lib_dynamodb_1.UpdateCommand(this.toAwsCommandInput());
|
|
45
|
-
}
|
|
46
|
-
static from(params) {
|
|
47
|
-
return new UpdateItem(params);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.UpdateItem = UpdateItem;
|
|
51
|
-
//# sourceMappingURL=update-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../src/commands/update-item.ts"],"names":[],"mappings":";;;AAAA,wDAG+B;AAG/B,oDAAuD;AACvD,sDAAyD;AACzD,yEAA4E;AAC5E,qDAIgC;AAwBhC,MAAa,UAAU;IAGJ,MAAM,CAAsB;IAE7C,YAAoB,MAA2B;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,iBAAiB;QACf,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAEtD,MAAM,KAAK,GAAG,yBAAc,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,2BAAe,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,KAAK,GAAuB;YAChC,SAAS,EAAE,KAAK;YAChB,GAAG,EAAE,GAAG;YACR,gBAAgB,EAAE,2BAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;gBACxD,KAAK;gBACL,MAAM;aACP,CAAC;SACH,CAAC;QAEF,gFAAgF;QAChF,sCAAsC;QACtC,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;YACtB,KAAK,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC1D,KAAK,CAAC,yBAAyB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC5D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,mFAAmF;QACnF,aAAa;QACb,KAAK,CAAC,mBAAmB,GAAG,IAAA,mCAAmB,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC;YACnE,KAAK;YACL,MAAM;SACP,CAAC,CAAC;QACH,KAAK,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC1D,KAAK,CAAC,yBAAyB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,YAAY;QACV,OAAO,IAAI,4BAAa,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,IAAI,CACT,MAA2B;QAE3B,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF;AAnDD,gCAmDC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type UpdateCommandInput as NativeUpdateCommandInput, UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import type { WithRequired } from "@infra-blocks/types";
|
|
3
|
-
import type { KeyAttributes } from "../types.js";
|
|
4
|
-
import { type ConditionParams, type UpdateExpressionParams } from "./expressions/index.js";
|
|
5
|
-
import type { Command } from "./types.js";
|
|
6
|
-
type UpdateCommandInput = WithRequired<NativeUpdateCommandInput, "UpdateExpression">;
|
|
7
|
-
export interface UpdateItemParams<K extends KeyAttributes = KeyAttributes> {
|
|
8
|
-
table: string;
|
|
9
|
-
key: K;
|
|
10
|
-
update: UpdateExpressionParams;
|
|
11
|
-
condition?: ConditionParams;
|
|
12
|
-
}
|
|
13
|
-
export declare class UpdateItem<K extends KeyAttributes> implements Command<UpdateCommandInput, UpdateCommand> {
|
|
14
|
-
private readonly params;
|
|
15
|
-
private constructor();
|
|
16
|
-
toAwsCommandInput(): UpdateCommandInput;
|
|
17
|
-
toAwsCommand(): UpdateCommand;
|
|
18
|
-
static from<K extends KeyAttributes>(params: UpdateItemParams<K>): UpdateItem<K>;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { UpdateCommand, } from "@aws-sdk/lib-dynamodb";
|
|
2
|
-
import { AttributeNames } from "./attributes/names.js";
|
|
3
|
-
import { AttributeValues } from "./attributes/values.js";
|
|
4
|
-
import { conditionExpression } from "./expressions/condition/expression.js";
|
|
5
|
-
import { UpdateExpression, } from "./expressions/index.js";
|
|
6
|
-
export class UpdateItem {
|
|
7
|
-
params;
|
|
8
|
-
constructor(params) {
|
|
9
|
-
this.params = params;
|
|
10
|
-
}
|
|
11
|
-
toAwsCommandInput() {
|
|
12
|
-
const { table, key, condition, update } = this.params;
|
|
13
|
-
const names = AttributeNames.create();
|
|
14
|
-
const values = AttributeValues.create();
|
|
15
|
-
const input = {
|
|
16
|
-
TableName: table,
|
|
17
|
-
Key: key,
|
|
18
|
-
UpdateExpression: UpdateExpression.from(update).stringify({
|
|
19
|
-
names,
|
|
20
|
-
values,
|
|
21
|
-
}),
|
|
22
|
-
};
|
|
23
|
-
// If there is no condition, we know that the names and values are finalized and
|
|
24
|
-
// we are ready to return the payload.
|
|
25
|
-
if (condition == null) {
|
|
26
|
-
input.ExpressionAttributeNames = names.getSubstitutions();
|
|
27
|
-
input.ExpressionAttributeValues = values.getSubstitutions();
|
|
28
|
-
return input;
|
|
29
|
-
}
|
|
30
|
-
// Otherwise, we need to stringify the condition, reusing the same names and values
|
|
31
|
-
// as before.
|
|
32
|
-
input.ConditionExpression = conditionExpression(condition).stringify({
|
|
33
|
-
names,
|
|
34
|
-
values,
|
|
35
|
-
});
|
|
36
|
-
input.ExpressionAttributeNames = names.getSubstitutions();
|
|
37
|
-
input.ExpressionAttributeValues = values.getSubstitutions();
|
|
38
|
-
return input;
|
|
39
|
-
}
|
|
40
|
-
toAwsCommand() {
|
|
41
|
-
return new UpdateCommand(this.toAwsCommandInput());
|
|
42
|
-
}
|
|
43
|
-
static from(params) {
|
|
44
|
-
return new UpdateItem(params);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=update-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../src/commands/update-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,GACd,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAEL,gBAAgB,GAEjB,MAAM,wBAAwB,CAAC;AAwBhC,MAAM,OAAO,UAAU;IAGJ,MAAM,CAAsB;IAE7C,YAAoB,MAA2B;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,iBAAiB;QACf,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAEtD,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,KAAK,GAA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