@infra-blocks/aws-dynamodb 0.28.0-alpha.0 → 0.29.0-alpha.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/expressions/condition/functions.d.ts +6 -6
- package/lib/cjs/commands/expressions/condition/functions.js +11 -7
- package/lib/cjs/commands/expressions/condition/functions.js.map +1 -1
- package/lib/cjs/commands/expressions/operands/path.d.ts +40 -1
- package/lib/cjs/commands/expressions/operands/path.js +26 -1
- package/lib/cjs/commands/expressions/operands/path.js.map +1 -1
- package/lib/cjs/commands/expressions/update/add.d.ts +3 -3
- package/lib/cjs/commands/expressions/update/add.js +4 -3
- package/lib/cjs/commands/expressions/update/add.js.map +1 -1
- package/lib/cjs/commands/expressions/update/delete.d.ts +3 -3
- package/lib/cjs/commands/expressions/update/delete.js +4 -2
- package/lib/cjs/commands/expressions/update/delete.js.map +1 -1
- package/lib/cjs/commands/expressions/update/if-not-exists.d.ts +2 -2
- package/lib/cjs/commands/expressions/update/if-not-exists.js +3 -1
- package/lib/cjs/commands/expressions/update/if-not-exists.js.map +1 -1
- package/lib/cjs/commands/expressions/update/remove.d.ts +3 -3
- package/lib/cjs/commands/expressions/update/remove.js +4 -2
- package/lib/cjs/commands/expressions/update/remove.js.map +1 -1
- package/lib/cjs/commands/expressions/update/set.d.ts +3 -3
- package/lib/cjs/commands/expressions/update/set.js +3 -2
- package/lib/cjs/commands/expressions/update/set.js.map +1 -1
- package/lib/esm/commands/expressions/condition/functions.d.ts +6 -6
- package/lib/esm/commands/expressions/condition/functions.js +11 -7
- package/lib/esm/commands/expressions/condition/functions.js.map +1 -1
- package/lib/esm/commands/expressions/operands/path.d.ts +40 -1
- package/lib/esm/commands/expressions/operands/path.js +26 -1
- package/lib/esm/commands/expressions/operands/path.js.map +1 -1
- package/lib/esm/commands/expressions/update/add.d.ts +3 -3
- package/lib/esm/commands/expressions/update/add.js +4 -3
- package/lib/esm/commands/expressions/update/add.js.map +1 -1
- package/lib/esm/commands/expressions/update/delete.d.ts +3 -3
- package/lib/esm/commands/expressions/update/delete.js +4 -2
- package/lib/esm/commands/expressions/update/delete.js.map +1 -1
- package/lib/esm/commands/expressions/update/if-not-exists.d.ts +2 -2
- package/lib/esm/commands/expressions/update/if-not-exists.js +3 -1
- package/lib/esm/commands/expressions/update/if-not-exists.js.map +1 -1
- package/lib/esm/commands/expressions/update/remove.d.ts +3 -3
- package/lib/esm/commands/expressions/update/remove.js +4 -2
- package/lib/esm/commands/expressions/update/remove.js.map +1 -1
- package/lib/esm/commands/expressions/update/set.d.ts +3 -3
- package/lib/esm/commands/expressions/update/set.js +3 -2
- package/lib/esm/commands/expressions/update/set.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import type { NativeBinary, NativeString, NativeType } from "../../../types.js";
|
|
2
|
-
import
|
|
2
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
3
3
|
import type { Value } from "../operands/value.js";
|
|
4
4
|
import { ConditionExpression } from "./expression.js";
|
|
5
5
|
import type { Size } from "./size.js";
|
|
6
6
|
/**
|
|
7
7
|
* Returns a condition that uses the `attribute_exists` function.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param rawPath - The attribute path to check for existence.
|
|
10
10
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path exists.
|
|
11
11
|
*
|
|
12
12
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
13
13
|
*/
|
|
14
|
-
export declare function attributeExists(
|
|
14
|
+
export declare function attributeExists(rawPath: RawPath): ConditionExpression;
|
|
15
15
|
/**
|
|
16
16
|
* Returns a condition that uses the `attribute_not_exists` function.
|
|
17
17
|
*
|
|
18
|
-
* @param
|
|
18
|
+
* @param rawPath - The attribute path to check for non-existence.
|
|
19
19
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path does not exist.
|
|
20
20
|
*
|
|
21
21
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
22
22
|
*/
|
|
23
|
-
export declare function attributeNotExists(
|
|
23
|
+
export declare function attributeNotExists(rawPath: RawPath): ConditionExpression;
|
|
24
24
|
/**
|
|
25
25
|
* Returns a condition that uses the `attribute_type` function.
|
|
26
26
|
*
|
|
@@ -31,7 +31,7 @@ export declare function attributeNotExists(attribute: Path): ConditionExpression
|
|
|
31
31
|
*
|
|
32
32
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
33
33
|
*/
|
|
34
|
-
export declare function attributeType(attribute:
|
|
34
|
+
export declare function attributeType(attribute: RawPath, type: Value<NativeType>): ConditionExpression;
|
|
35
35
|
/**
|
|
36
36
|
* This type aggregates the types of operands that can be used with the {@link beginsWith} function.
|
|
37
37
|
*
|
|
@@ -5,31 +5,34 @@ exports.attributeNotExists = attributeNotExists;
|
|
|
5
5
|
exports.attributeType = attributeType;
|
|
6
6
|
exports.beginsWith = beginsWith;
|
|
7
7
|
exports.contains = contains;
|
|
8
|
+
const path_js_1 = require("../operands/path.js");
|
|
8
9
|
const expression_js_1 = require("./expression.js");
|
|
9
10
|
/**
|
|
10
11
|
* Returns a condition that uses the `attribute_exists` function.
|
|
11
12
|
*
|
|
12
|
-
* @param
|
|
13
|
+
* @param rawPath - The attribute path to check for existence.
|
|
13
14
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path exists.
|
|
14
15
|
*
|
|
15
16
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
16
17
|
*/
|
|
17
|
-
function attributeExists(
|
|
18
|
+
function attributeExists(rawPath) {
|
|
19
|
+
const path = path_js_1.Path.normalize(rawPath);
|
|
18
20
|
return expression_js_1.ConditionExpression.from({
|
|
19
|
-
stringify: ({ names }) => `attribute_exists(${
|
|
21
|
+
stringify: ({ names }) => `attribute_exists(${path.substitute({ names })})`,
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Returns a condition that uses the `attribute_not_exists` function.
|
|
24
26
|
*
|
|
25
|
-
* @param
|
|
27
|
+
* @param rawPath - The attribute path to check for non-existence.
|
|
26
28
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path does not exist.
|
|
27
29
|
*
|
|
28
30
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
29
31
|
*/
|
|
30
|
-
function attributeNotExists(
|
|
32
|
+
function attributeNotExists(rawPath) {
|
|
33
|
+
const path = path_js_1.Path.normalize(rawPath);
|
|
31
34
|
return expression_js_1.ConditionExpression.from({
|
|
32
|
-
stringify: ({ names }) => `attribute_not_exists(${
|
|
35
|
+
stringify: ({ names }) => `attribute_not_exists(${path.substitute({ names })})`,
|
|
33
36
|
});
|
|
34
37
|
}
|
|
35
38
|
/**
|
|
@@ -43,8 +46,9 @@ function attributeNotExists(attribute) {
|
|
|
43
46
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
44
47
|
*/
|
|
45
48
|
function attributeType(attribute, type) {
|
|
49
|
+
const path = path_js_1.Path.normalize(attribute);
|
|
46
50
|
return expression_js_1.ConditionExpression.from({
|
|
47
|
-
stringify: ({ names, values }) => `attribute_type(${
|
|
51
|
+
stringify: ({ names, values }) => `attribute_type(${path.substitute({ names })}, ${type.substitute({ values })})`,
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":";;AAcA,0CAKC;AAUD,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":";;AAcA,0CAKC;AAUD,gDAMC;AAYD,sCASC;AAmBD,gCAQC;AAsBD,4BAQC;AAhHD,iDAAyD;AAEzD,mDAAsD;AAGtD;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,OAAgB;IAC9C,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,mCAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;KAC5E,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,OAAgB;IACjD,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,mCAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,wBAAwB,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;KACxD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAC3B,SAAkB,EAClB,IAAuB;IAEvB,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,mCAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAC/B,kBAAkB,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG;KAClF,CAAC,CAAC;AACL,CAAC;AASD;;;;;;;;;GASG;AACH,SAAgB,UAAU,CACxB,KAAwB,EACxB,MAAyB;IAEzB,OAAO,mCAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAC/B,eAAe,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG;KACjG,CAAC,CAAC;AACL,CAAC;AAYD;;;;;;;;;GASG;AACH,SAAgB,QAAQ,CACtB,KAA2B,EAC3B,MAA6B;IAE7B,OAAO,mCAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAC/B,YAAY,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG;KAC9F,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import type { AttributePath } from "../../../types.js";
|
|
2
2
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
3
|
import type { IOperand } from "./type.js";
|
|
4
|
+
/**
|
|
5
|
+
* This type represents the types that can implicitly be used
|
|
6
|
+
* as path operands.
|
|
7
|
+
*/
|
|
8
|
+
export type ImplicitPath = AttributePath;
|
|
9
|
+
/**
|
|
10
|
+
* This type aggregates the types that can be used as path operands.
|
|
11
|
+
*
|
|
12
|
+
* An {@link ImplicitPath} can be used in APIs that expect a {@link RawPath}
|
|
13
|
+
* just as well as an explicit {@link Path} instance.
|
|
14
|
+
*
|
|
15
|
+
* Using the {@link attributeExists} function as example, the following two
|
|
16
|
+
* invokations are equivalent:
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Explicit path.
|
|
19
|
+
* attributeExists(path("foo.bar.baz"));
|
|
20
|
+
* // Implicit path.
|
|
21
|
+
* attributeExists("foo.bar.baz");
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type RawPath = AttributePath | Path;
|
|
4
25
|
/**
|
|
5
26
|
* Represents an attribute path operand in an expression.
|
|
6
27
|
*
|
|
@@ -10,10 +31,28 @@ import type { IOperand } from "./type.js";
|
|
|
10
31
|
*/
|
|
11
32
|
export declare class Path implements IOperand {
|
|
12
33
|
private readonly path;
|
|
13
|
-
constructor(
|
|
34
|
+
private constructor();
|
|
14
35
|
substitute(params: {
|
|
15
36
|
names: AttributeNames;
|
|
16
37
|
}): string;
|
|
38
|
+
/**
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
static from(path: AttributePath): Path;
|
|
42
|
+
/**
|
|
43
|
+
* Turns {@link RawPath} path into a {@link Path} instance.
|
|
44
|
+
*
|
|
45
|
+
* If the provided path is already a {@link Path}, it will be returned as-is.
|
|
46
|
+
* Otherwise, a new {@link Path} instance will be created from the provided
|
|
47
|
+
* argument.
|
|
48
|
+
*
|
|
49
|
+
* @param loosePath - The path to return as is or convert to a {@link Path} instance.
|
|
50
|
+
*
|
|
51
|
+
* @returns The normalized {@link Path} instance.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
static normalize(loosePath: RawPath): Path;
|
|
17
56
|
}
|
|
18
57
|
/**
|
|
19
58
|
* Factory function to create a {@link Path}.
|
|
@@ -18,6 +18,31 @@ class Path {
|
|
|
18
18
|
const { names } = params;
|
|
19
19
|
return names.substitute(this.path);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
static from(path) {
|
|
25
|
+
return new Path(path);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Turns {@link RawPath} path into a {@link Path} instance.
|
|
29
|
+
*
|
|
30
|
+
* If the provided path is already a {@link Path}, it will be returned as-is.
|
|
31
|
+
* Otherwise, a new {@link Path} instance will be created from the provided
|
|
32
|
+
* argument.
|
|
33
|
+
*
|
|
34
|
+
* @param loosePath - The path to return as is or convert to a {@link Path} instance.
|
|
35
|
+
*
|
|
36
|
+
* @returns The normalized {@link Path} instance.
|
|
37
|
+
*
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
static normalize(loosePath) {
|
|
41
|
+
if (loosePath instanceof Path) {
|
|
42
|
+
return loosePath;
|
|
43
|
+
}
|
|
44
|
+
return Path.from(loosePath);
|
|
45
|
+
}
|
|
21
46
|
}
|
|
22
47
|
exports.Path = Path;
|
|
23
48
|
/**
|
|
@@ -28,6 +53,6 @@ exports.Path = Path;
|
|
|
28
53
|
* @returns A new {@link Path} instance for the provided path.
|
|
29
54
|
*/
|
|
30
55
|
function path(path) {
|
|
31
|
-
return
|
|
56
|
+
return Path.from(path);
|
|
32
57
|
}
|
|
33
58
|
//# sourceMappingURL=path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/path.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/path.ts"],"names":[],"mappings":";;;AAiFA,oBAEC;AAxDD;;;;;;GAMG;AACH,MAAa,IAAI;IACE,IAAI,CAAgB;IAErC,YAAoB,IAAmB;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,UAAU,CAAC,MAAiC;QAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QACzB,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,IAAmB;QAC7B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,SAAS,CAAC,SAAkB;QACjC,IAAI,SAAS,YAAY,IAAI,EAAE,CAAC;YAC9B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;CACF;AAtCD,oBAsCC;AAED;;;;;;GAMG;AACH,SAAgB,IAAI,CAAC,IAAmB;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NativeNumber, NativeSet } from "../../../types.js";
|
|
2
2
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
3
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
-
import
|
|
4
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
5
5
|
import type { Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
@@ -29,12 +29,12 @@ export declare class AddAction implements IUpdateAction {
|
|
|
29
29
|
*
|
|
30
30
|
* This action only supports numbers and sets as values.
|
|
31
31
|
*
|
|
32
|
-
* @param
|
|
32
|
+
* @param rawPath - The attribute path to modify.
|
|
33
33
|
* @param value - The value to add to the attribute.
|
|
34
34
|
*
|
|
35
35
|
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
36
36
|
*
|
|
37
37
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
38
38
|
*/
|
|
39
|
-
export declare function add(
|
|
39
|
+
export declare function add(rawPath: RawPath, value: Value<NumberOrSet>): UpdateAction;
|
|
40
40
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AddAction = void 0;
|
|
4
4
|
exports.add = add;
|
|
5
|
-
|
|
5
|
+
const path_js_1 = require("../operands/path.js");
|
|
6
6
|
class AddAction {
|
|
7
7
|
path;
|
|
8
8
|
value;
|
|
@@ -32,14 +32,15 @@ exports.AddAction = AddAction;
|
|
|
32
32
|
*
|
|
33
33
|
* This action only supports numbers and sets as values.
|
|
34
34
|
*
|
|
35
|
-
* @param
|
|
35
|
+
* @param rawPath - The attribute path to modify.
|
|
36
36
|
* @param value - The value to add to the attribute.
|
|
37
37
|
*
|
|
38
38
|
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
39
39
|
*
|
|
40
40
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
41
41
|
*/
|
|
42
|
-
function add(
|
|
42
|
+
function add(rawPath, value) {
|
|
43
|
+
const path = path_js_1.Path.normalize(rawPath);
|
|
43
44
|
return AddAction.from({ path, value });
|
|
44
45
|
}
|
|
45
46
|
//# sourceMappingURL=add.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":";;;AAyDA,kBAGC;AAzDD,iDAAyD;AAOzD,MAAa,SAAS;IACH,IAAI,CAAO;IACX,KAAK,CAAqB;IAE3C,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,MAAiD;QAC3D,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF;AA5BD,8BA4BC;AAED;;;;;;;;;;;;;;;GAeG;AAEH,SAAgB,GAAG,CAAC,OAAgB,EAAE,KAAyB;IAC7D,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NativeSet } from "../../../types.js";
|
|
2
2
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
3
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
-
import
|
|
4
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
5
5
|
import type { Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
@@ -25,11 +25,11 @@ export declare class DeleteAction implements IUpdateAction {
|
|
|
25
25
|
* This operation only supports sets as values. The resulting set will be the original set minus the
|
|
26
26
|
* provided subset.
|
|
27
27
|
*
|
|
28
|
-
* @param
|
|
28
|
+
* @param rawPath - The attribute path to modify.
|
|
29
29
|
* @param value - The value to remove from the attribute.
|
|
30
30
|
*
|
|
31
31
|
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
32
32
|
*
|
|
33
33
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
34
34
|
*/
|
|
35
|
-
export declare function deleteFrom(
|
|
35
|
+
export declare function deleteFrom(rawPath: RawPath, value: Value<NativeSet>): UpdateAction;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleteAction = void 0;
|
|
4
4
|
exports.deleteFrom = deleteFrom;
|
|
5
|
+
const path_js_1 = require("../operands/path.js");
|
|
5
6
|
class DeleteAction {
|
|
6
7
|
path;
|
|
7
8
|
value;
|
|
@@ -30,14 +31,15 @@ exports.DeleteAction = DeleteAction;
|
|
|
30
31
|
* This operation only supports sets as values. The resulting set will be the original set minus the
|
|
31
32
|
* provided subset.
|
|
32
33
|
*
|
|
33
|
-
* @param
|
|
34
|
+
* @param rawPath - The attribute path to modify.
|
|
34
35
|
* @param value - The value to remove from the attribute.
|
|
35
36
|
*
|
|
36
37
|
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
37
38
|
*
|
|
38
39
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
39
40
|
*/
|
|
40
|
-
function deleteFrom(
|
|
41
|
+
function deleteFrom(rawPath, value) {
|
|
42
|
+
const path = path_js_1.Path.normalize(rawPath);
|
|
41
43
|
return DeleteAction.from({ path, value });
|
|
42
44
|
}
|
|
43
45
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/delete.ts"],"names":[],"mappings":";;;AAsDA,
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/delete.ts"],"names":[],"mappings":";;;AAsDA,gCAMC;AAzDD,iDAAyD;AAKzD,MAAa,YAAY;IACN,IAAI,CAAO;IACX,KAAK,CAAmB;IAEzC,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,MAA+C;QACzD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;AA9BD,oCA8BC;AAED;;;;;;;;;;;;GAYG;AAEH,SAAgB,UAAU,CACxB,OAAgB,EAChB,KAAuB;IAEvB,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
2
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
-
import
|
|
3
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
4
4
|
import type { IOperand, Operand } from "../operands/type.js";
|
|
5
5
|
export declare class IfNotExistsOperand implements IOperand {
|
|
6
6
|
private readonly path;
|
|
@@ -14,4 +14,4 @@ export declare class IfNotExistsOperand implements IOperand {
|
|
|
14
14
|
values: AttributeValues;
|
|
15
15
|
}): string;
|
|
16
16
|
}
|
|
17
|
-
export declare function ifNotExists(
|
|
17
|
+
export declare function ifNotExists(rawPath: RawPath, defaultValue: Operand): IfNotExistsOperand;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IfNotExistsOperand = void 0;
|
|
4
4
|
exports.ifNotExists = ifNotExists;
|
|
5
|
+
const path_js_1 = require("../operands/path.js");
|
|
5
6
|
class IfNotExistsOperand {
|
|
6
7
|
path;
|
|
7
8
|
defaultValue;
|
|
@@ -16,7 +17,8 @@ class IfNotExistsOperand {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
exports.IfNotExistsOperand = IfNotExistsOperand;
|
|
19
|
-
function ifNotExists(
|
|
20
|
+
function ifNotExists(rawPath, defaultValue) {
|
|
21
|
+
const path = path_js_1.Path.normalize(rawPath);
|
|
20
22
|
return new IfNotExistsOperand({ path, defaultValue });
|
|
21
23
|
}
|
|
22
24
|
//# sourceMappingURL=if-not-exists.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if-not-exists.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/if-not-exists.ts"],"names":[],"mappings":";;;AAwBA,
|
|
1
|
+
{"version":3,"file":"if-not-exists.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/if-not-exists.ts"],"names":[],"mappings":";;;AAwBA,kCAMC;AA5BD,iDAAyD;AAGzD,MAAa,kBAAkB;IACZ,IAAI,CAAO;IACX,YAAY,CAAU;IAEvC,YAAY,MAA6C;QACvD,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,OAAgB,EAChB,YAAqB;IAErB,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,IAAI,kBAAkB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
|
-
import
|
|
2
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
3
3
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
4
4
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
5
5
|
export declare class RemoveAction implements IUpdateAction {
|
|
@@ -14,10 +14,10 @@ export declare class RemoveAction implements IUpdateAction {
|
|
|
14
14
|
/**
|
|
15
15
|
* Returns an action that will remove the specific attribute at the provided path.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
17
|
+
* @param rawPath - The path of the attribute to remove.
|
|
18
18
|
*
|
|
19
19
|
* @returns A {@link RemoveAction} corresponding to the path provided.
|
|
20
20
|
*
|
|
21
21
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
22
22
|
*/
|
|
23
|
-
export declare function remove(
|
|
23
|
+
export declare function remove(rawPath: RawPath): UpdateAction;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RemoveAction = void 0;
|
|
4
4
|
exports.remove = remove;
|
|
5
|
+
const path_js_1 = require("../operands/path.js");
|
|
5
6
|
class RemoveAction {
|
|
6
7
|
path;
|
|
7
8
|
constructor(path) {
|
|
@@ -22,13 +23,14 @@ exports.RemoveAction = RemoveAction;
|
|
|
22
23
|
/**
|
|
23
24
|
* Returns an action that will remove the specific attribute at the provided path.
|
|
24
25
|
*
|
|
25
|
-
* @param
|
|
26
|
+
* @param rawPath - The path of the attribute to remove.
|
|
26
27
|
*
|
|
27
28
|
* @returns A {@link RemoveAction} corresponding to the path provided.
|
|
28
29
|
*
|
|
29
30
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
30
31
|
*/
|
|
31
|
-
function remove(
|
|
32
|
+
function remove(rawPath) {
|
|
33
|
+
const path = path_js_1.Path.normalize(rawPath);
|
|
32
34
|
return RemoveAction.from(path);
|
|
33
35
|
}
|
|
34
36
|
//# sourceMappingURL=remove.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/remove.ts"],"names":[],"mappings":";;;AAmCA,
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/remove.ts"],"names":[],"mappings":";;;AAmCA,wBAGC;AArCD,iDAAyD;AAIzD,MAAa,YAAY;IACN,IAAI,CAAO;IAE5B,YAAoB,IAAU;QAC5B,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,IAAU;QACpB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF;AAnBD,oCAmBC;AAED;;;;;;;;GAQG;AACH,SAAgB,MAAM,CAAC,OAAgB;IACrC,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
2
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
-
import
|
|
3
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
4
4
|
import type { Operand } from "../operands/type.js";
|
|
5
5
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
6
6
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
@@ -26,6 +26,6 @@ export declare class SetAction implements IUpdateAction {
|
|
|
26
26
|
}): string;
|
|
27
27
|
static from(params: SetActionParams): SetAction;
|
|
28
28
|
}
|
|
29
|
-
export declare function set(
|
|
30
|
-
export declare function set(
|
|
29
|
+
export declare function set(rawPath: RawPath, operand: SetOperand): UpdateAction;
|
|
30
|
+
export declare function set(rawPath: RawPath, operand: SetOperand, operator: SetOperator, secondOperand: SetOperand): UpdateAction;
|
|
31
31
|
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SetAction = void 0;
|
|
4
4
|
exports.set = set;
|
|
5
|
+
const path_js_1 = require("../operands/path.js");
|
|
5
6
|
class SetAction {
|
|
6
7
|
params;
|
|
7
8
|
constructor(params) {
|
|
@@ -29,9 +30,9 @@ class SetAction {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
exports.SetAction = SetAction;
|
|
32
|
-
function set(
|
|
33
|
+
function set(rawPath, operand, operator, secondOperand) {
|
|
33
34
|
return SetAction.from({
|
|
34
|
-
path,
|
|
35
|
+
path: path_js_1.Path.normalize(rawPath),
|
|
35
36
|
operand,
|
|
36
37
|
operator,
|
|
37
38
|
secondOperand,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/set.ts"],"names":[],"mappings":";;;AAsEA,kBAYC;
|
|
1
|
+
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/set.ts"],"names":[],"mappings":";;;AAsEA,kBAYC;AAhFD,iDAAyD;AAsBzD,MAAa,SAAS;IACH,MAAM,CAAkB;IAEzC,YAAoB,MAAuB;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,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,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CACxF;YACE,KAAK;YACL,MAAM;SACP,CACF,EAAE,CAAC;QACJ,IAAI,UAAU,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;YAC9D,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CACxE;gBACE,KAAK;gBACL,MAAM;aACP,CACF,EAAE,CAAC;QACN,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAAuB;QACjC,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF;AApCD,8BAoCC;AAUD,SAAgB,GAAG,CACjB,OAAgB,EAChB,OAAmB,EACnB,QAAsB,EACtB,aAA0B;IAE1B,OAAO,SAAS,CAAC,IAAI,CAAC;QACpB,IAAI,EAAE,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAC7B,OAAO;QACP,QAAQ;QACR,aAAa;KACd,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import type { NativeBinary, NativeString, NativeType } from "../../../types.js";
|
|
2
|
-
import
|
|
2
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
3
3
|
import type { Value } from "../operands/value.js";
|
|
4
4
|
import { ConditionExpression } from "./expression.js";
|
|
5
5
|
import type { Size } from "./size.js";
|
|
6
6
|
/**
|
|
7
7
|
* Returns a condition that uses the `attribute_exists` function.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param rawPath - The attribute path to check for existence.
|
|
10
10
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path exists.
|
|
11
11
|
*
|
|
12
12
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
13
13
|
*/
|
|
14
|
-
export declare function attributeExists(
|
|
14
|
+
export declare function attributeExists(rawPath: RawPath): ConditionExpression;
|
|
15
15
|
/**
|
|
16
16
|
* Returns a condition that uses the `attribute_not_exists` function.
|
|
17
17
|
*
|
|
18
|
-
* @param
|
|
18
|
+
* @param rawPath - The attribute path to check for non-existence.
|
|
19
19
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path does not exist.
|
|
20
20
|
*
|
|
21
21
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
22
22
|
*/
|
|
23
|
-
export declare function attributeNotExists(
|
|
23
|
+
export declare function attributeNotExists(rawPath: RawPath): ConditionExpression;
|
|
24
24
|
/**
|
|
25
25
|
* Returns a condition that uses the `attribute_type` function.
|
|
26
26
|
*
|
|
@@ -31,7 +31,7 @@ export declare function attributeNotExists(attribute: Path): ConditionExpression
|
|
|
31
31
|
*
|
|
32
32
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
33
33
|
*/
|
|
34
|
-
export declare function attributeType(attribute:
|
|
34
|
+
export declare function attributeType(attribute: RawPath, type: Value<NativeType>): ConditionExpression;
|
|
35
35
|
/**
|
|
36
36
|
* This type aggregates the types of operands that can be used with the {@link beginsWith} function.
|
|
37
37
|
*
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
+
import { Path } from "../operands/path.js";
|
|
1
2
|
import { ConditionExpression } from "./expression.js";
|
|
2
3
|
/**
|
|
3
4
|
* Returns a condition that uses the `attribute_exists` function.
|
|
4
5
|
*
|
|
5
|
-
* @param
|
|
6
|
+
* @param rawPath - The attribute path to check for existence.
|
|
6
7
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path exists.
|
|
7
8
|
*
|
|
8
9
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
9
10
|
*/
|
|
10
|
-
export function attributeExists(
|
|
11
|
+
export function attributeExists(rawPath) {
|
|
12
|
+
const path = Path.normalize(rawPath);
|
|
11
13
|
return ConditionExpression.from({
|
|
12
|
-
stringify: ({ names }) => `attribute_exists(${
|
|
14
|
+
stringify: ({ names }) => `attribute_exists(${path.substitute({ names })})`,
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Returns a condition that uses the `attribute_not_exists` function.
|
|
17
19
|
*
|
|
18
|
-
* @param
|
|
20
|
+
* @param rawPath - The attribute path to check for non-existence.
|
|
19
21
|
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path does not exist.
|
|
20
22
|
*
|
|
21
23
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
22
24
|
*/
|
|
23
|
-
export function attributeNotExists(
|
|
25
|
+
export function attributeNotExists(rawPath) {
|
|
26
|
+
const path = Path.normalize(rawPath);
|
|
24
27
|
return ConditionExpression.from({
|
|
25
|
-
stringify: ({ names }) => `attribute_not_exists(${
|
|
28
|
+
stringify: ({ names }) => `attribute_not_exists(${path.substitute({ names })})`,
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
@@ -36,8 +39,9 @@ export function attributeNotExists(attribute) {
|
|
|
36
39
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
37
40
|
*/
|
|
38
41
|
export function attributeType(attribute, type) {
|
|
42
|
+
const path = Path.normalize(attribute);
|
|
39
43
|
return ConditionExpression.from({
|
|
40
|
-
stringify: ({ names, values }) => `attribute_type(${
|
|
44
|
+
stringify: ({ names, values }) => `attribute_type(${path.substitute({ names })}, ${type.substitute({ values })})`,
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,mBAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;KAC5E,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,mBAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,wBAAwB,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;KACxD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAkB,EAClB,IAAuB;IAEvB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,mBAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAC/B,kBAAkB,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG;KAClF,CAAC,CAAC;AACL,CAAC;AASD;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CACxB,KAAwB,EACxB,MAAyB;IAEzB,OAAO,mBAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAC/B,eAAe,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG;KACjG,CAAC,CAAC;AACL,CAAC;AAYD;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CACtB,KAA2B,EAC3B,MAA6B;IAE7B,OAAO,mBAAmB,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAC/B,YAAY,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG;KAC9F,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import type { AttributePath } from "../../../types.js";
|
|
2
2
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
3
|
import type { IOperand } from "./type.js";
|
|
4
|
+
/**
|
|
5
|
+
* This type represents the types that can implicitly be used
|
|
6
|
+
* as path operands.
|
|
7
|
+
*/
|
|
8
|
+
export type ImplicitPath = AttributePath;
|
|
9
|
+
/**
|
|
10
|
+
* This type aggregates the types that can be used as path operands.
|
|
11
|
+
*
|
|
12
|
+
* An {@link ImplicitPath} can be used in APIs that expect a {@link RawPath}
|
|
13
|
+
* just as well as an explicit {@link Path} instance.
|
|
14
|
+
*
|
|
15
|
+
* Using the {@link attributeExists} function as example, the following two
|
|
16
|
+
* invokations are equivalent:
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Explicit path.
|
|
19
|
+
* attributeExists(path("foo.bar.baz"));
|
|
20
|
+
* // Implicit path.
|
|
21
|
+
* attributeExists("foo.bar.baz");
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type RawPath = AttributePath | Path;
|
|
4
25
|
/**
|
|
5
26
|
* Represents an attribute path operand in an expression.
|
|
6
27
|
*
|
|
@@ -10,10 +31,28 @@ import type { IOperand } from "./type.js";
|
|
|
10
31
|
*/
|
|
11
32
|
export declare class Path implements IOperand {
|
|
12
33
|
private readonly path;
|
|
13
|
-
constructor(
|
|
34
|
+
private constructor();
|
|
14
35
|
substitute(params: {
|
|
15
36
|
names: AttributeNames;
|
|
16
37
|
}): string;
|
|
38
|
+
/**
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
static from(path: AttributePath): Path;
|
|
42
|
+
/**
|
|
43
|
+
* Turns {@link RawPath} path into a {@link Path} instance.
|
|
44
|
+
*
|
|
45
|
+
* If the provided path is already a {@link Path}, it will be returned as-is.
|
|
46
|
+
* Otherwise, a new {@link Path} instance will be created from the provided
|
|
47
|
+
* argument.
|
|
48
|
+
*
|
|
49
|
+
* @param loosePath - The path to return as is or convert to a {@link Path} instance.
|
|
50
|
+
*
|
|
51
|
+
* @returns The normalized {@link Path} instance.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
static normalize(loosePath: RawPath): Path;
|
|
17
56
|
}
|
|
18
57
|
/**
|
|
19
58
|
* Factory function to create a {@link Path}.
|
|
@@ -14,6 +14,31 @@ export class Path {
|
|
|
14
14
|
const { names } = params;
|
|
15
15
|
return names.substitute(this.path);
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
static from(path) {
|
|
21
|
+
return new Path(path);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Turns {@link RawPath} path into a {@link Path} instance.
|
|
25
|
+
*
|
|
26
|
+
* If the provided path is already a {@link Path}, it will be returned as-is.
|
|
27
|
+
* Otherwise, a new {@link Path} instance will be created from the provided
|
|
28
|
+
* argument.
|
|
29
|
+
*
|
|
30
|
+
* @param loosePath - The path to return as is or convert to a {@link Path} instance.
|
|
31
|
+
*
|
|
32
|
+
* @returns The normalized {@link Path} instance.
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
static normalize(loosePath) {
|
|
37
|
+
if (loosePath instanceof Path) {
|
|
38
|
+
return loosePath;
|
|
39
|
+
}
|
|
40
|
+
return Path.from(loosePath);
|
|
41
|
+
}
|
|
17
42
|
}
|
|
18
43
|
/**
|
|
19
44
|
* Factory function to create a {@link Path}.
|
|
@@ -23,6 +48,6 @@ export class Path {
|
|
|
23
48
|
* @returns A new {@link Path} instance for the provided path.
|
|
24
49
|
*/
|
|
25
50
|
export function path(path) {
|
|
26
|
-
return
|
|
51
|
+
return Path.from(path);
|
|
27
52
|
}
|
|
28
53
|
//# sourceMappingURL=path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/path.ts"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,MAAM,OAAO,IAAI;IACE,IAAI,CAAgB;IAErC,YAAoB,IAAmB;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,UAAU,CAAC,MAAiC;QAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QACzB,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,IAAmB;QAC7B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,SAAS,CAAC,SAAkB;QACjC,IAAI,SAAS,YAAY,IAAI,EAAE,CAAC;YAC9B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,IAAmB;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NativeNumber, NativeSet } from "../../../types.js";
|
|
2
2
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
3
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
-
import
|
|
4
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
5
5
|
import type { Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
@@ -29,12 +29,12 @@ export declare class AddAction implements IUpdateAction {
|
|
|
29
29
|
*
|
|
30
30
|
* This action only supports numbers and sets as values.
|
|
31
31
|
*
|
|
32
|
-
* @param
|
|
32
|
+
* @param rawPath - The attribute path to modify.
|
|
33
33
|
* @param value - The value to add to the attribute.
|
|
34
34
|
*
|
|
35
35
|
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
36
36
|
*
|
|
37
37
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
38
38
|
*/
|
|
39
|
-
export declare function add(
|
|
39
|
+
export declare function add(rawPath: RawPath, value: Value<NumberOrSet>): UpdateAction;
|
|
40
40
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { Path } from "../operands/path.js";
|
|
2
2
|
export class AddAction {
|
|
3
3
|
path;
|
|
4
4
|
value;
|
|
@@ -27,14 +27,15 @@ export class AddAction {
|
|
|
27
27
|
*
|
|
28
28
|
* This action only supports numbers and sets as values.
|
|
29
29
|
*
|
|
30
|
-
* @param
|
|
30
|
+
* @param rawPath - The attribute path to modify.
|
|
31
31
|
* @param value - The value to add to the attribute.
|
|
32
32
|
*
|
|
33
33
|
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
34
34
|
*
|
|
35
35
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
36
36
|
*/
|
|
37
|
-
export function add(
|
|
37
|
+
export function add(rawPath, value) {
|
|
38
|
+
const path = Path.normalize(rawPath);
|
|
38
39
|
return AddAction.from({ path, value });
|
|
39
40
|
}
|
|
40
41
|
//# sourceMappingURL=add.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAOzD,MAAM,OAAO,SAAS;IACH,IAAI,CAAO;IACX,KAAK,CAAqB;IAE3C,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,MAAiD;QAC3D,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,KAAyB;IAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NativeSet } from "../../../types.js";
|
|
2
2
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
3
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
-
import
|
|
4
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
5
5
|
import type { Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
@@ -25,11 +25,11 @@ export declare class DeleteAction implements IUpdateAction {
|
|
|
25
25
|
* This operation only supports sets as values. The resulting set will be the original set minus the
|
|
26
26
|
* provided subset.
|
|
27
27
|
*
|
|
28
|
-
* @param
|
|
28
|
+
* @param rawPath - The attribute path to modify.
|
|
29
29
|
* @param value - The value to remove from the attribute.
|
|
30
30
|
*
|
|
31
31
|
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
32
32
|
*
|
|
33
33
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
34
34
|
*/
|
|
35
|
-
export declare function deleteFrom(
|
|
35
|
+
export declare function deleteFrom(rawPath: RawPath, value: Value<NativeSet>): UpdateAction;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Path } from "../operands/path.js";
|
|
1
2
|
export class DeleteAction {
|
|
2
3
|
path;
|
|
3
4
|
value;
|
|
@@ -25,14 +26,15 @@ export class DeleteAction {
|
|
|
25
26
|
* This operation only supports sets as values. The resulting set will be the original set minus the
|
|
26
27
|
* provided subset.
|
|
27
28
|
*
|
|
28
|
-
* @param
|
|
29
|
+
* @param rawPath - The attribute path to modify.
|
|
29
30
|
* @param value - The value to remove from the attribute.
|
|
30
31
|
*
|
|
31
32
|
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
32
33
|
*
|
|
33
34
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
34
35
|
*/
|
|
35
|
-
export function deleteFrom(
|
|
36
|
+
export function deleteFrom(rawPath, value) {
|
|
37
|
+
const path = Path.normalize(rawPath);
|
|
36
38
|
return DeleteAction.from({ path, value });
|
|
37
39
|
}
|
|
38
40
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/delete.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAKzD,MAAM,OAAO,YAAY;IACN,IAAI,CAAO;IACX,KAAK,CAAmB;IAEzC,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,MAA+C;QACzD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;AAED;;;;;;;;;;;;GAYG;AAEH,MAAM,UAAU,UAAU,CACxB,OAAgB,EAChB,KAAuB;IAEvB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
2
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
-
import
|
|
3
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
4
4
|
import type { IOperand, Operand } from "../operands/type.js";
|
|
5
5
|
export declare class IfNotExistsOperand implements IOperand {
|
|
6
6
|
private readonly path;
|
|
@@ -14,4 +14,4 @@ export declare class IfNotExistsOperand implements IOperand {
|
|
|
14
14
|
values: AttributeValues;
|
|
15
15
|
}): string;
|
|
16
16
|
}
|
|
17
|
-
export declare function ifNotExists(
|
|
17
|
+
export declare function ifNotExists(rawPath: RawPath, defaultValue: Operand): IfNotExistsOperand;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Path } from "../operands/path.js";
|
|
1
2
|
export class IfNotExistsOperand {
|
|
2
3
|
path;
|
|
3
4
|
defaultValue;
|
|
@@ -11,7 +12,8 @@ export class IfNotExistsOperand {
|
|
|
11
12
|
return `if_not_exists(${this.path.substitute({ names })}, ${this.defaultValue.substitute({ names, values })})`;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
export function ifNotExists(
|
|
15
|
+
export function ifNotExists(rawPath, defaultValue) {
|
|
16
|
+
const path = Path.normalize(rawPath);
|
|
15
17
|
return new IfNotExistsOperand({ path, defaultValue });
|
|
16
18
|
}
|
|
17
19
|
//# sourceMappingURL=if-not-exists.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if-not-exists.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/if-not-exists.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"if-not-exists.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/if-not-exists.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAGzD,MAAM,OAAO,kBAAkB;IACZ,IAAI,CAAO;IACX,YAAY,CAAU;IAEvC,YAAY,MAA6C;QACvD,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;AAED,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,YAAqB;IAErB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,IAAI,kBAAkB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
|
-
import
|
|
2
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
3
3
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
4
4
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
5
5
|
export declare class RemoveAction implements IUpdateAction {
|
|
@@ -14,10 +14,10 @@ export declare class RemoveAction implements IUpdateAction {
|
|
|
14
14
|
/**
|
|
15
15
|
* Returns an action that will remove the specific attribute at the provided path.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
17
|
+
* @param rawPath - The path of the attribute to remove.
|
|
18
18
|
*
|
|
19
19
|
* @returns A {@link RemoveAction} corresponding to the path provided.
|
|
20
20
|
*
|
|
21
21
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
22
22
|
*/
|
|
23
|
-
export declare function remove(
|
|
23
|
+
export declare function remove(rawPath: RawPath): UpdateAction;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Path } from "../operands/path.js";
|
|
1
2
|
export class RemoveAction {
|
|
2
3
|
path;
|
|
3
4
|
constructor(path) {
|
|
@@ -17,13 +18,14 @@ export class RemoveAction {
|
|
|
17
18
|
/**
|
|
18
19
|
* Returns an action that will remove the specific attribute at the provided path.
|
|
19
20
|
*
|
|
20
|
-
* @param
|
|
21
|
+
* @param rawPath - The path of the attribute to remove.
|
|
21
22
|
*
|
|
22
23
|
* @returns A {@link RemoveAction} corresponding to the path provided.
|
|
23
24
|
*
|
|
24
25
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
25
26
|
*/
|
|
26
|
-
export function remove(
|
|
27
|
+
export function remove(rawPath) {
|
|
28
|
+
const path = Path.normalize(rawPath);
|
|
27
29
|
return RemoveAction.from(path);
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=remove.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/remove.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAIzD,MAAM,OAAO,YAAY;IACN,IAAI,CAAO;IAE5B,YAAoB,IAAU;QAC5B,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,IAAU;QACpB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAC,OAAgB;IACrC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
2
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
-
import
|
|
3
|
+
import { Path, type RawPath } from "../operands/path.js";
|
|
4
4
|
import type { Operand } from "../operands/type.js";
|
|
5
5
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
6
6
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
@@ -26,6 +26,6 @@ export declare class SetAction implements IUpdateAction {
|
|
|
26
26
|
}): string;
|
|
27
27
|
static from(params: SetActionParams): SetAction;
|
|
28
28
|
}
|
|
29
|
-
export declare function set(
|
|
30
|
-
export declare function set(
|
|
29
|
+
export declare function set(rawPath: RawPath, operand: SetOperand): UpdateAction;
|
|
30
|
+
export declare function set(rawPath: RawPath, operand: SetOperand, operator: SetOperator, secondOperand: SetOperand): UpdateAction;
|
|
31
31
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Path } from "../operands/path.js";
|
|
1
2
|
export class SetAction {
|
|
2
3
|
params;
|
|
3
4
|
constructor(params) {
|
|
@@ -24,9 +25,9 @@ export class SetAction {
|
|
|
24
25
|
return new SetAction(params);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
export function set(
|
|
28
|
+
export function set(rawPath, operand, operator, secondOperand) {
|
|
28
29
|
return SetAction.from({
|
|
29
|
-
path,
|
|
30
|
+
path: Path.normalize(rawPath),
|
|
30
31
|
operand,
|
|
31
32
|
operator,
|
|
32
33
|
secondOperand,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/set.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/set.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAsBzD,MAAM,OAAO,SAAS;IACH,MAAM,CAAkB;IAEzC,YAAoB,MAAuB;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,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,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CACxF;YACE,KAAK;YACL,MAAM;SACP,CACF,EAAE,CAAC;QACJ,IAAI,UAAU,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;YAC9D,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CACxE;gBACE,KAAK;gBACL,MAAM;aACP,CACF,EAAE,CAAC;QACN,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAAuB;QACjC,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF;AAUD,MAAM,UAAU,GAAG,CACjB,OAAgB,EAChB,OAAmB,EACnB,QAAsB,EACtB,aAA0B;IAE1B,OAAO,SAAS,CAAC,IAAI,CAAC;QACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAC7B,OAAO;QACP,QAAQ;QACR,aAAa;KACd,CAAC,CAAC;AACL,CAAC"}
|