@infra-blocks/aws-dynamodb 0.21.0 → 0.22.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/create-table.js +3 -4
- package/lib/cjs/commands/create-table.js.map +1 -1
- package/lib/cjs/commands/expressions/index.d.ts +1 -1
- package/lib/cjs/commands/expressions/index.js +1 -1
- package/lib/cjs/commands/expressions/index.js.map +1 -1
- package/lib/cjs/commands/expressions/update/action.d.ts +33 -0
- package/lib/cjs/commands/expressions/update/action.js +3 -0
- package/lib/cjs/commands/expressions/update/action.js.map +1 -0
- package/lib/cjs/commands/expressions/update/add.d.ts +40 -0
- package/lib/cjs/commands/expressions/update/add.js +45 -0
- package/lib/cjs/commands/expressions/update/add.js.map +1 -0
- package/lib/cjs/commands/expressions/update/clauses.d.ts +22 -0
- package/lib/cjs/commands/expressions/update/clauses.js +50 -0
- package/lib/cjs/commands/expressions/update/clauses.js.map +1 -0
- package/lib/cjs/commands/expressions/update/delete.d.ts +35 -0
- package/lib/cjs/commands/expressions/update/delete.js +43 -0
- package/lib/cjs/commands/expressions/update/delete.js.map +1 -0
- package/lib/cjs/commands/expressions/update/expression.d.ts +22 -0
- package/lib/cjs/commands/expressions/update/expression.js +69 -0
- package/lib/cjs/commands/expressions/update/expression.js.map +1 -0
- package/lib/cjs/commands/expressions/update/if-not-exists.d.ts +17 -0
- package/lib/cjs/commands/expressions/update/if-not-exists.js +22 -0
- package/lib/cjs/commands/expressions/update/if-not-exists.js.map +1 -0
- package/lib/cjs/commands/expressions/update/index.d.ts +7 -0
- package/lib/cjs/commands/expressions/update/index.js +29 -0
- package/lib/cjs/commands/expressions/update/index.js.map +1 -0
- package/lib/cjs/commands/expressions/update/remove.d.ts +23 -0
- package/lib/cjs/commands/expressions/update/remove.js +34 -0
- package/lib/cjs/commands/expressions/update/remove.js.map +1 -0
- package/lib/cjs/commands/expressions/update/set.d.ts +57 -0
- package/lib/cjs/commands/expressions/update/set.js +86 -0
- package/lib/cjs/commands/expressions/update/set.js.map +1 -0
- package/lib/cjs/commands/put-item.js +4 -5
- package/lib/cjs/commands/put-item.js.map +1 -1
- package/lib/esm/commands/create-table.js +3 -4
- package/lib/esm/commands/create-table.js.map +1 -1
- package/lib/esm/commands/expressions/index.d.ts +1 -1
- package/lib/esm/commands/expressions/index.js +1 -1
- package/lib/esm/commands/expressions/index.js.map +1 -1
- package/lib/esm/commands/expressions/update/action.d.ts +33 -0
- package/lib/esm/commands/expressions/update/action.js +2 -0
- package/lib/esm/commands/expressions/update/action.js.map +1 -0
- package/lib/esm/commands/expressions/update/add.d.ts +40 -0
- package/lib/esm/commands/expressions/update/add.js +40 -0
- package/lib/esm/commands/expressions/update/add.js.map +1 -0
- package/lib/esm/commands/expressions/update/clauses.d.ts +22 -0
- package/lib/esm/commands/expressions/update/clauses.js +46 -0
- package/lib/esm/commands/expressions/update/clauses.js.map +1 -0
- package/lib/esm/commands/expressions/update/delete.d.ts +35 -0
- package/lib/esm/commands/expressions/update/delete.js +38 -0
- package/lib/esm/commands/expressions/update/delete.js.map +1 -0
- package/lib/esm/commands/expressions/update/expression.d.ts +22 -0
- package/lib/esm/commands/expressions/update/expression.js +65 -0
- package/lib/esm/commands/expressions/update/expression.js.map +1 -0
- package/lib/esm/commands/expressions/update/if-not-exists.d.ts +17 -0
- package/lib/esm/commands/expressions/update/if-not-exists.js +17 -0
- package/lib/esm/commands/expressions/update/if-not-exists.js.map +1 -0
- package/lib/esm/commands/expressions/update/index.d.ts +7 -0
- package/lib/esm/commands/expressions/update/index.js +7 -0
- package/lib/esm/commands/expressions/update/index.js.map +1 -0
- package/lib/esm/commands/expressions/update/remove.d.ts +23 -0
- package/lib/esm/commands/expressions/update/remove.js +29 -0
- package/lib/esm/commands/expressions/update/remove.js.map +1 -0
- package/lib/esm/commands/expressions/update/set.d.ts +57 -0
- package/lib/esm/commands/expressions/update/set.js +79 -0
- package/lib/esm/commands/expressions/update/set.js.map +1 -0
- package/lib/esm/commands/put-item.js +4 -5
- package/lib/esm/commands/put-item.js.map +1 -1
- package/package.json +2 -2
- package/lib/cjs/commands/expressions/update.d.ts +0 -163
- package/lib/cjs/commands/expressions/update.js +0 -258
- package/lib/cjs/commands/expressions/update.js.map +0 -1
- package/lib/esm/commands/expressions/update.d.ts +0 -163
- package/lib/esm/commands/expressions/update.js +0 -243
- package/lib/esm/commands/expressions/update.js.map +0 -1
|
@@ -15,7 +15,6 @@ class CreateTable {
|
|
|
15
15
|
this.lsis = lsis;
|
|
16
16
|
}
|
|
17
17
|
toAwsCommandInput() {
|
|
18
|
-
const { name } = this;
|
|
19
18
|
const attributeDefinitions = new Map();
|
|
20
19
|
const primaryKeySchema = keySchema({
|
|
21
20
|
attributeDefinitions,
|
|
@@ -28,7 +27,7 @@ class CreateTable {
|
|
|
28
27
|
AttributeName: name,
|
|
29
28
|
AttributeType: type,
|
|
30
29
|
})),
|
|
31
|
-
TableName: name,
|
|
30
|
+
TableName: this.name,
|
|
32
31
|
KeySchema: primaryKeySchema,
|
|
33
32
|
GlobalSecondaryIndexes: globalSecondaryIndexes.length > 0 ? globalSecondaryIndexes : undefined,
|
|
34
33
|
LocalSecondaryIndexes: localSecondaryIndexes.length > 0 ? localSecondaryIndexes : undefined,
|
|
@@ -39,7 +38,7 @@ class CreateTable {
|
|
|
39
38
|
return new client_dynamodb_1.CreateTableCommand(this.toAwsCommandInput());
|
|
40
39
|
}
|
|
41
40
|
gsiInput(attributeDefinitions) {
|
|
42
|
-
const
|
|
41
|
+
const gsis = this.gsis ?? {};
|
|
43
42
|
const globalSecondaryIndexes = [];
|
|
44
43
|
for (const [indexName, field] of Object.entries(gsis)) {
|
|
45
44
|
const ks = keySchema({
|
|
@@ -57,7 +56,7 @@ class CreateTable {
|
|
|
57
56
|
return globalSecondaryIndexes;
|
|
58
57
|
}
|
|
59
58
|
lsiInput(attributeDefinitions) {
|
|
60
|
-
const
|
|
59
|
+
const lsis = this.lsis ?? {};
|
|
61
60
|
const localSecondaryIndexes = [];
|
|
62
61
|
for (const [indexName, field] of Object.entries(lsis)) {
|
|
63
62
|
const ks = keySchema({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-table.js","sourceRoot":"","sources":["../../../src/commands/create-table.ts"],"names":[],"mappings":";;;AAAA,8DAMkC;AAWlC,MAAa,WAAW;IAGL,IAAI,CAAS;IACb,UAAU,CAAQ;IAClB,IAAI,CAAyB;IAC7B,IAAI,CAAyB;IAE9C,YAAoB,MAAyB;QAC3C,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,iBAAiB;QACf,MAAM,
|
|
1
|
+
{"version":3,"file":"create-table.js","sourceRoot":"","sources":["../../../src/commands/create-table.ts"],"names":[],"mappings":";;;AAAA,8DAMkC;AAWlC,MAAa,WAAW;IAGL,IAAI,CAAS;IACb,UAAU,CAAQ;IAClB,IAAI,CAAyB;IAC7B,IAAI,CAAyB;IAE9C,YAAoB,MAAyB;QAC3C,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,iBAAiB;QACf,MAAM,oBAAoB,GAAgC,IAAI,GAAG,EAAE,CAAC;QACpE,MAAM,gBAAgB,GAAG,SAAS,CAAC;YACjC,oBAAoB;YACpB,GAAG,EAAE,IAAI,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AAI,EAAE,CAAC;QACxB,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7D,SAAS,CAAC,IAAI,CAAC;YACb,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI;YAC/B,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./condition.js"), exports);
|
|
18
18
|
__exportStar(require("./key-condition.js"), exports);
|
|
19
19
|
__exportStar(require("./operands/index.js"), exports);
|
|
20
|
-
__exportStar(require("./update.js"), exports);
|
|
20
|
+
__exportStar(require("./update/index.js"), exports);
|
|
21
21
|
/*
|
|
22
22
|
TODO: In the expression interfaces, a slight QoL improvement would be to assume that
|
|
23
23
|
strings are attribute names by default, and other types are values by default. The user
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/expressions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/expressions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,oDAAkC;AAElC;;;;;GAKG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
|
+
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
+
import type { AddAction } from "./add.js";
|
|
4
|
+
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
5
|
+
import type { DeleteAction } from "./delete.js";
|
|
6
|
+
import type { RemoveAction } from "./remove.js";
|
|
7
|
+
import type { SetAction } from "./set.js";
|
|
8
|
+
export interface IUpdateAction {
|
|
9
|
+
/**
|
|
10
|
+
* Registers the action within the {@link UpdateExpressionClauses}.
|
|
11
|
+
*
|
|
12
|
+
* @param clauses - The clauses to register the action in.
|
|
13
|
+
*/
|
|
14
|
+
register(clauses: UpdateExpressionClauses): void;
|
|
15
|
+
/**
|
|
16
|
+
* Stringifies the action within the clause.
|
|
17
|
+
*
|
|
18
|
+
* For example, if the action is a `SetAction`, it will be invoked as such:
|
|
19
|
+
* `SET ${action.stringify({names, values})}`. So the clause identifier is managed
|
|
20
|
+
* by the caller.
|
|
21
|
+
*
|
|
22
|
+
* @param params.names - The attribute names to substitute in the action.
|
|
23
|
+
* @param params.values - The attribute values to substitute in the action.
|
|
24
|
+
*/
|
|
25
|
+
stringify(params: {
|
|
26
|
+
names: AttributeNames;
|
|
27
|
+
values: AttributeValues;
|
|
28
|
+
}): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* This type aggregates all the possible update actions that can be performed.
|
|
32
|
+
*/
|
|
33
|
+
export type UpdateAction = AddAction | DeleteAction | RemoveAction | SetAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/action.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AttributeValueNumber, AttributeValueSet } from "../../../types.js";
|
|
2
|
+
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
|
+
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
+
import type { AttributeOperand } from "../operands/name.js";
|
|
5
|
+
import type { ValueOperand } from "../operands/value.js";
|
|
6
|
+
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
|
+
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
8
|
+
type NumberOrSet = AttributeValueNumber | AttributeValueSet;
|
|
9
|
+
export declare class AddAction implements IUpdateAction {
|
|
10
|
+
private readonly path;
|
|
11
|
+
private readonly value;
|
|
12
|
+
private constructor();
|
|
13
|
+
register(clauses: UpdateExpressionClauses): void;
|
|
14
|
+
stringify(params: {
|
|
15
|
+
names: AttributeNames;
|
|
16
|
+
values: AttributeValues;
|
|
17
|
+
}): string;
|
|
18
|
+
static from(params: {
|
|
19
|
+
path: AttributeOperand;
|
|
20
|
+
value: ValueOperand<NumberOrSet>;
|
|
21
|
+
}): AddAction;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns an action that will add the provided value to the attribute at the specified path.
|
|
25
|
+
*
|
|
26
|
+
* What adding means depends on the types of the operands:p
|
|
27
|
+
* - If both the attribute and the value are numbers, then an increment operation is performed.
|
|
28
|
+
* - If both the attribute and the value are sets, then a concatenation is performed.
|
|
29
|
+
*
|
|
30
|
+
* This action only supports numbers and sets as values.
|
|
31
|
+
*
|
|
32
|
+
* @param path - The attribute path to modify.
|
|
33
|
+
* @param value - The value to add to the attribute.
|
|
34
|
+
*
|
|
35
|
+
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
36
|
+
*
|
|
37
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
38
|
+
*/
|
|
39
|
+
export declare function add(path: AttributeOperand, value: ValueOperand<NumberOrSet>): UpdateAction;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddAction = void 0;
|
|
4
|
+
exports.add = add;
|
|
5
|
+
// Note: the first operand *must* be an attribute name, and the second operand *must* be a value.
|
|
6
|
+
class AddAction {
|
|
7
|
+
path;
|
|
8
|
+
value;
|
|
9
|
+
constructor(params) {
|
|
10
|
+
const { path, value } = params;
|
|
11
|
+
this.path = path;
|
|
12
|
+
this.value = value;
|
|
13
|
+
}
|
|
14
|
+
register(clauses) {
|
|
15
|
+
clauses.pushAddAction(this);
|
|
16
|
+
}
|
|
17
|
+
stringify(params) {
|
|
18
|
+
const { names, values } = params;
|
|
19
|
+
return `${this.path.substitute({ names })} ${this.value.substitute({ values })}`;
|
|
20
|
+
}
|
|
21
|
+
static from(params) {
|
|
22
|
+
return new AddAction(params);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.AddAction = AddAction;
|
|
26
|
+
/**
|
|
27
|
+
* Returns an action that will add the provided value to the attribute at the specified path.
|
|
28
|
+
*
|
|
29
|
+
* What adding means depends on the types of the operands:p
|
|
30
|
+
* - If both the attribute and the value are numbers, then an increment operation is performed.
|
|
31
|
+
* - If both the attribute and the value are sets, then a concatenation is performed.
|
|
32
|
+
*
|
|
33
|
+
* This action only supports numbers and sets as values.
|
|
34
|
+
*
|
|
35
|
+
* @param path - The attribute path to modify.
|
|
36
|
+
* @param value - The value to add to the attribute.
|
|
37
|
+
*
|
|
38
|
+
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
39
|
+
*
|
|
40
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
41
|
+
*/
|
|
42
|
+
function add(path, value) {
|
|
43
|
+
return AddAction.from({ path, value });
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":";;;AAgEA,kBAKC;AAxDD,iGAAiG;AACjG,MAAa,SAAS;IACH,IAAI,CAAmB;IACvB,KAAK,CAA4B;IAElD,YAAoB,MAGnB;QACC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,QAAQ,CAAC,OAAgC;QACvC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,CAAC,MAGT;QACC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QACjC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACnF,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAGX;QACC,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF;AA/BD,8BA+BC;AAED;;;;;;;;;;;;;;;GAeG;AAEH,SAAgB,GAAG,CACjB,IAAsB,EACtB,KAAgC;IAEhC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UpdateAction } from "./action.js";
|
|
2
|
+
import type { AddAction } from "./add.js";
|
|
3
|
+
import type { DeleteAction } from "./delete.js";
|
|
4
|
+
import type { RemoveAction } from "./remove.js";
|
|
5
|
+
import type { SetAction } from "./set.js";
|
|
6
|
+
export declare class UpdateExpressionClauses {
|
|
7
|
+
private add?;
|
|
8
|
+
private delete?;
|
|
9
|
+
private remove?;
|
|
10
|
+
private set?;
|
|
11
|
+
private constructor();
|
|
12
|
+
getAddActions(): AddAction[] | undefined;
|
|
13
|
+
getDeleteActions(): DeleteAction[] | undefined;
|
|
14
|
+
getRemoveActions(): RemoveAction[] | undefined;
|
|
15
|
+
getSetActions(): SetAction[] | undefined;
|
|
16
|
+
pushAddAction(action: AddAction): void;
|
|
17
|
+
pushDeleteAction(action: DeleteAction): void;
|
|
18
|
+
pushRemoveAction(action: RemoveAction): void;
|
|
19
|
+
pushSetAction(action: SetAction): void;
|
|
20
|
+
static create(): UpdateExpressionClauses;
|
|
21
|
+
static from(params: ReadonlyArray<UpdateAction>): UpdateExpressionClauses;
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateExpressionClauses = void 0;
|
|
4
|
+
class UpdateExpressionClauses {
|
|
5
|
+
add;
|
|
6
|
+
delete;
|
|
7
|
+
remove;
|
|
8
|
+
set;
|
|
9
|
+
constructor() { }
|
|
10
|
+
getAddActions() {
|
|
11
|
+
return this.add;
|
|
12
|
+
}
|
|
13
|
+
getDeleteActions() {
|
|
14
|
+
return this.delete;
|
|
15
|
+
}
|
|
16
|
+
getRemoveActions() {
|
|
17
|
+
return this.remove;
|
|
18
|
+
}
|
|
19
|
+
getSetActions() {
|
|
20
|
+
return this.set;
|
|
21
|
+
}
|
|
22
|
+
pushAddAction(action) {
|
|
23
|
+
this.add ??= [];
|
|
24
|
+
this.add.push(action);
|
|
25
|
+
}
|
|
26
|
+
pushDeleteAction(action) {
|
|
27
|
+
this.delete ??= [];
|
|
28
|
+
this.delete.push(action);
|
|
29
|
+
}
|
|
30
|
+
pushRemoveAction(action) {
|
|
31
|
+
this.remove ??= [];
|
|
32
|
+
this.remove.push(action);
|
|
33
|
+
}
|
|
34
|
+
pushSetAction(action) {
|
|
35
|
+
this.set ??= [];
|
|
36
|
+
this.set.push(action);
|
|
37
|
+
}
|
|
38
|
+
static create() {
|
|
39
|
+
return new UpdateExpressionClauses();
|
|
40
|
+
}
|
|
41
|
+
static from(params) {
|
|
42
|
+
const clauses = UpdateExpressionClauses.create();
|
|
43
|
+
for (const action of params) {
|
|
44
|
+
action.register(clauses);
|
|
45
|
+
}
|
|
46
|
+
return clauses;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.UpdateExpressionClauses = UpdateExpressionClauses;
|
|
50
|
+
//# sourceMappingURL=clauses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clauses.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/clauses.ts"],"names":[],"mappings":";;;AAMA,MAAa,uBAAuB;IAC1B,GAAG,CAAe;IAClB,MAAM,CAAkB;IACxB,MAAM,CAAkB;IACxB,GAAG,CAAe;IAE1B,gBAAuB,CAAC;IAExB,aAAa;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,aAAa,CAAC,MAAiB;QAC7B,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,gBAAgB,CAAC,MAAoB;QACnC,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,gBAAgB,CAAC,MAAoB;QACnC,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,aAAa,CAAC,MAAiB;QAC7B,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,uBAAuB,EAAE,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAAmC;QAC7C,MAAM,OAAO,GAAG,uBAAuB,CAAC,MAAM,EAAE,CAAC;QACjD,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAvDD,0DAuDC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AttributeValueSet } from "../../../types.js";
|
|
2
|
+
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
|
+
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
+
import type { AttributeOperand } from "../operands/name.js";
|
|
5
|
+
import type { ValueOperand } from "../operands/value.js";
|
|
6
|
+
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
|
+
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
8
|
+
export declare class DeleteAction implements IUpdateAction {
|
|
9
|
+
private readonly path;
|
|
10
|
+
private readonly value;
|
|
11
|
+
private constructor();
|
|
12
|
+
register(clauses: UpdateExpressionClauses): void;
|
|
13
|
+
stringify(params: {
|
|
14
|
+
names: AttributeNames;
|
|
15
|
+
values: AttributeValues;
|
|
16
|
+
}): string;
|
|
17
|
+
static from(params: {
|
|
18
|
+
path: AttributeOperand;
|
|
19
|
+
value: ValueOperand<AttributeValueSet>;
|
|
20
|
+
}): DeleteAction;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns an action that will delete the provided subset from the attribute at the specified path.
|
|
24
|
+
*
|
|
25
|
+
* This operation only supports sets as values. The resulting set will be the original set minus the
|
|
26
|
+
* provided subset.
|
|
27
|
+
*
|
|
28
|
+
* @param path - The attribute path to modify.
|
|
29
|
+
* @param value - The value to remove from the attribute.
|
|
30
|
+
*
|
|
31
|
+
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
32
|
+
*
|
|
33
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
34
|
+
*/
|
|
35
|
+
export declare function deleteFrom(path: AttributeOperand, value: ValueOperand<AttributeValueSet>): UpdateAction;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteAction = void 0;
|
|
4
|
+
exports.deleteFrom = deleteFrom;
|
|
5
|
+
class DeleteAction {
|
|
6
|
+
path;
|
|
7
|
+
value;
|
|
8
|
+
constructor(params) {
|
|
9
|
+
const { path, value } = params;
|
|
10
|
+
this.path = path;
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
register(clauses) {
|
|
14
|
+
clauses.pushDeleteAction(this);
|
|
15
|
+
}
|
|
16
|
+
stringify(params) {
|
|
17
|
+
const { names, values } = params;
|
|
18
|
+
return `${this.path.substitute({ names })} ${this.value.substitute({
|
|
19
|
+
values,
|
|
20
|
+
})}`;
|
|
21
|
+
}
|
|
22
|
+
static from(params) {
|
|
23
|
+
return new DeleteAction(params);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.DeleteAction = DeleteAction;
|
|
27
|
+
/**
|
|
28
|
+
* Returns an action that will delete the provided subset from the attribute at the specified path.
|
|
29
|
+
*
|
|
30
|
+
* This operation only supports sets as values. The resulting set will be the original set minus the
|
|
31
|
+
* provided subset.
|
|
32
|
+
*
|
|
33
|
+
* @param path - The attribute path to modify.
|
|
34
|
+
* @param value - The value to remove from the attribute.
|
|
35
|
+
*
|
|
36
|
+
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
37
|
+
*
|
|
38
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
39
|
+
*/
|
|
40
|
+
function deleteFrom(path, value) {
|
|
41
|
+
return DeleteAction.from({ path, value });
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/delete.ts"],"names":[],"mappings":";;;AAyDA,gCAKC;AAtDD,MAAa,YAAY;IACN,IAAI,CAAmB;IACvB,KAAK,CAAkC;IAExD,YAAoB,MAGnB;QACC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,QAAQ,CAAC,OAAgC;QACvC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,CAAC,MAGT;QACC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QACjC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;YACjE,MAAM;SACP,CAAC,EAAE,CAAC;IACP,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAGX;QACC,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;AAjCD,oCAiCC;AAED;;;;;;;;;;;;GAYG;AAEH,SAAgB,UAAU,CACxB,IAAsB,EACtB,KAAsC;IAEtC,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
|
+
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
+
import type { IExpression } from "../expression.js";
|
|
4
|
+
import type { UpdateAction } from "./action.js";
|
|
5
|
+
export type UpdateExpressionParams = ReadonlyArray<UpdateAction>;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html
|
|
9
|
+
*/
|
|
10
|
+
export declare class UpdateExpression implements IExpression {
|
|
11
|
+
private readonly clauses;
|
|
12
|
+
private constructor();
|
|
13
|
+
stringify(params: {
|
|
14
|
+
names: AttributeNames;
|
|
15
|
+
values: AttributeValues;
|
|
16
|
+
}): string;
|
|
17
|
+
private pushAddActions;
|
|
18
|
+
private pushDeleteActions;
|
|
19
|
+
private pushRemoveActions;
|
|
20
|
+
private pushSetActions;
|
|
21
|
+
static from(params: UpdateExpressionParams): UpdateExpression;
|
|
22
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateExpression = void 0;
|
|
4
|
+
const clauses_js_1 = require("./clauses.js");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html
|
|
8
|
+
*/
|
|
9
|
+
class UpdateExpression {
|
|
10
|
+
clauses;
|
|
11
|
+
constructor(clauses) {
|
|
12
|
+
this.clauses = clauses;
|
|
13
|
+
}
|
|
14
|
+
stringify(params) {
|
|
15
|
+
const { names, values } = params;
|
|
16
|
+
const parts = [];
|
|
17
|
+
this.pushAddActions({ parts, names, values });
|
|
18
|
+
this.pushDeleteActions({ parts, names, values });
|
|
19
|
+
this.pushRemoveActions({ parts, names });
|
|
20
|
+
this.pushSetActions({ parts, names, values });
|
|
21
|
+
return parts.join("\n");
|
|
22
|
+
}
|
|
23
|
+
pushAddActions(params) {
|
|
24
|
+
const { parts, names, values } = params;
|
|
25
|
+
const actions = this.clauses.getAddActions();
|
|
26
|
+
if (actions == null || actions.length === 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
parts.push(`ADD ${actions
|
|
30
|
+
.map((action) => action.stringify({ names, values }))
|
|
31
|
+
.join(",")}`);
|
|
32
|
+
}
|
|
33
|
+
pushDeleteActions(params) {
|
|
34
|
+
const { parts, names, values } = params;
|
|
35
|
+
const actions = this.clauses.getDeleteActions();
|
|
36
|
+
if (actions == null || actions.length === 0) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
parts.push(`DELETE ${actions
|
|
40
|
+
.map((action) => action.stringify({ names, values }))
|
|
41
|
+
.join(",")}`);
|
|
42
|
+
}
|
|
43
|
+
pushRemoveActions(params) {
|
|
44
|
+
const { parts, names } = params;
|
|
45
|
+
const actions = this.clauses.getRemoveActions();
|
|
46
|
+
if (actions == null || actions.length === 0) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
parts.push(`REMOVE ${actions
|
|
50
|
+
.map((action) => action.stringify({ names }))
|
|
51
|
+
.join(",")}`);
|
|
52
|
+
}
|
|
53
|
+
pushSetActions(params) {
|
|
54
|
+
const { parts, names, values } = params;
|
|
55
|
+
const actions = this.clauses.getSetActions();
|
|
56
|
+
if (actions == null || actions.length === 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
parts.push(`SET ${actions
|
|
60
|
+
.map((action) => action.stringify({ names, values }))
|
|
61
|
+
.join(",")}`);
|
|
62
|
+
}
|
|
63
|
+
static from(params) {
|
|
64
|
+
const clauses = clauses_js_1.UpdateExpressionClauses.from(params);
|
|
65
|
+
return new UpdateExpression(clauses);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.UpdateExpression = UpdateExpression;
|
|
69
|
+
//# sourceMappingURL=expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/expression.ts"],"names":[],"mappings":";;;AAIA,6CAAuD;AA2BvD;;;GAGG;AAEH,MAAa,gBAAgB;IACV,OAAO,CAA0B;IAElD,YAAoB,OAAgC;QAClD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,SAAS,CAAC,MAGT;QACC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;Q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OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AA5FD,4CA4FC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
|
+
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
+
import type { AttributeOperand } from "../operands/name.js";
|
|
4
|
+
import type { IOperand, Operand } from "../operands/type.js";
|
|
5
|
+
export declare class IfNotExistsOperand implements IOperand {
|
|
6
|
+
private readonly path;
|
|
7
|
+
private readonly defaultValue;
|
|
8
|
+
constructor(params: {
|
|
9
|
+
path: AttributeOperand;
|
|
10
|
+
defaultValue: Operand;
|
|
11
|
+
});
|
|
12
|
+
substitute(params: {
|
|
13
|
+
names: AttributeNames;
|
|
14
|
+
values: AttributeValues;
|
|
15
|
+
}): string;
|
|
16
|
+
}
|
|
17
|
+
export declare function ifNotExists(path: AttributeOperand, defaultValue: Operand): IfNotExistsOperand;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IfNotExistsOperand = void 0;
|
|
4
|
+
exports.ifNotExists = ifNotExists;
|
|
5
|
+
class IfNotExistsOperand {
|
|
6
|
+
path;
|
|
7
|
+
defaultValue;
|
|
8
|
+
constructor(params) {
|
|
9
|
+
const { path, defaultValue } = params;
|
|
10
|
+
this.path = path;
|
|
11
|
+
this.defaultValue = defaultValue;
|
|
12
|
+
}
|
|
13
|
+
substitute(params) {
|
|
14
|
+
const { names, values } = params;
|
|
15
|
+
return `if_not_exists(${this.path.substitute({ names })}, ${this.defaultValue.substitute({ names, values })})`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.IfNotExistsOperand = IfNotExistsOperand;
|
|
19
|
+
function ifNotExists(path, defaultValue) {
|
|
20
|
+
return new IfNotExistsOperand({ path, defaultValue });
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=if-not-exists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if-not-exists.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/if-not-exists.ts"],"names":[],"mappings":";;;AAwBA,kCAKC;AAxBD,MAAa,kBAAkB;IACZ,IAAI,CAAmB;IACvB,YAAY,CAAU;IAEvC,YAAY,MAAyD;QACnE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,UAAU,CAAC,MAGV;QACC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QACjC,OAAO,iBAAiB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC;IACjH,CAAC;CACF;AAjBD,gDAiBC;AAED,SAAgB,WAAW,CACzB,IAAsB,EACtB,YAAqB;IAErB,OAAO,IAAI,kBAAkB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { UpdateAction } from "./action.js";
|
|
2
|
+
export { add } from "./add.js";
|
|
3
|
+
export { deleteFrom } from "./delete.js";
|
|
4
|
+
export * from "./expression.js";
|
|
5
|
+
export { ifNotExists } from "./if-not-exists.js";
|
|
6
|
+
export { remove } from "./remove.js";
|
|
7
|
+
export { set } from "./set.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.set = exports.remove = exports.ifNotExists = exports.deleteFrom = exports.add = void 0;
|
|
18
|
+
var add_js_1 = require("./add.js");
|
|
19
|
+
Object.defineProperty(exports, "add", { enumerable: true, get: function () { return add_js_1.add; } });
|
|
20
|
+
var delete_js_1 = require("./delete.js");
|
|
21
|
+
Object.defineProperty(exports, "deleteFrom", { enumerable: true, get: function () { return delete_js_1.deleteFrom; } });
|
|
22
|
+
__exportStar(require("./expression.js"), exports);
|
|
23
|
+
var if_not_exists_js_1 = require("./if-not-exists.js");
|
|
24
|
+
Object.defineProperty(exports, "ifNotExists", { enumerable: true, get: function () { return if_not_exists_js_1.ifNotExists; } });
|
|
25
|
+
var remove_js_1 = require("./remove.js");
|
|
26
|
+
Object.defineProperty(exports, "remove", { enumerable: true, get: function () { return remove_js_1.remove; } });
|
|
27
|
+
var set_js_1 = require("./set.js");
|
|
28
|
+
Object.defineProperty(exports, "set", { enumerable: true, get: function () { return set_js_1.set; } });
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AACZ,yCAAyC;AAAhC,uGAAA,UAAU,OAAA;AACnB,kDAAgC;AAChC,uDAAiD;AAAxC,+GAAA,WAAW,OAAA;AACpB,yCAAqC;AAA5B,mGAAA,MAAM,OAAA;AACf,mCAA+B;AAAtB,6FAAA,GAAG,OAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
|
+
import type { AttributeOperand } from "../operands/name.js";
|
|
3
|
+
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
4
|
+
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
5
|
+
export declare class RemoveAction implements IUpdateAction {
|
|
6
|
+
private readonly path;
|
|
7
|
+
private constructor();
|
|
8
|
+
register(clauses: UpdateExpressionClauses): void;
|
|
9
|
+
stringify(params: {
|
|
10
|
+
names: AttributeNames;
|
|
11
|
+
}): string;
|
|
12
|
+
static from(path: AttributeOperand): RemoveAction;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns an action that will remove the specific attribute at the provided path.
|
|
16
|
+
*
|
|
17
|
+
* @param path - The path of the attribute to remove.
|
|
18
|
+
*
|
|
19
|
+
* @returns A {@link RemoveAction} corresponding to the path provided.
|
|
20
|
+
*
|
|
21
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
22
|
+
*/
|
|
23
|
+
export declare function remove(path: AttributeOperand): UpdateAction;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveAction = void 0;
|
|
4
|
+
exports.remove = remove;
|
|
5
|
+
class RemoveAction {
|
|
6
|
+
path;
|
|
7
|
+
constructor(path) {
|
|
8
|
+
this.path = path;
|
|
9
|
+
}
|
|
10
|
+
register(clauses) {
|
|
11
|
+
clauses.pushRemoveAction(this);
|
|
12
|
+
}
|
|
13
|
+
stringify(params) {
|
|
14
|
+
const { names } = params;
|
|
15
|
+
return this.path.substitute({ names });
|
|
16
|
+
}
|
|
17
|
+
static from(path) {
|
|
18
|
+
return new RemoveAction(path);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.RemoveAction = RemoveAction;
|
|
22
|
+
/**
|
|
23
|
+
* Returns an action that will remove the specific attribute at the provided path.
|
|
24
|
+
*
|
|
25
|
+
* @param path - The path of the attribute to remove.
|
|
26
|
+
*
|
|
27
|
+
* @returns A {@link RemoveAction} corresponding to the path provided.
|
|
28
|
+
*
|
|
29
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
30
|
+
*/
|
|
31
|
+
function remove(path) {
|
|
32
|
+
return RemoveAction.from(path);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/remove.ts"],"names":[],"mappings":";;;AAoCA,wBAEC;AAjCD,MAAa,YAAY;IACN,IAAI,CAAmB;IAExC,YAAoB,IAAsB;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,OAAgC;QACvC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,CAAC,MAAiC;QACzC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,IAAsB;QAChC,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF;AAnBD,oCAmBC;AAED;;;;;;;;GAQG;AAEH,SAAgB,MAAM,CAAC,IAAsB;IAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|