@infra-blocks/aws-dynamodb 0.29.0 → 0.30.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/condition.d.ts +1 -17
- package/lib/cjs/commands/expressions/condition/condition.js +0 -24
- package/lib/cjs/commands/expressions/condition/condition.js.map +1 -1
- package/lib/cjs/commands/expressions/condition/functions.d.ts +3 -3
- package/lib/cjs/commands/expressions/condition/functions.js +4 -2
- package/lib/cjs/commands/expressions/condition/functions.js.map +1 -1
- package/lib/cjs/commands/expressions/operands/value.d.ts +14 -2
- package/lib/cjs/commands/expressions/operands/value.js +19 -1
- package/lib/cjs/commands/expressions/operands/value.js.map +1 -1
- package/lib/cjs/commands/expressions/update/add.d.ts +3 -3
- package/lib/cjs/commands/expressions/update/add.js +4 -2
- 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.js +1 -0
- package/lib/cjs/commands/expressions/update/if-not-exists.js.map +1 -1
- package/lib/esm/commands/expressions/condition/condition.d.ts +1 -17
- package/lib/esm/commands/expressions/condition/condition.js +1 -21
- package/lib/esm/commands/expressions/condition/condition.js.map +1 -1
- package/lib/esm/commands/expressions/condition/functions.d.ts +3 -3
- package/lib/esm/commands/expressions/condition/functions.js +4 -2
- package/lib/esm/commands/expressions/condition/functions.js.map +1 -1
- package/lib/esm/commands/expressions/operands/value.d.ts +14 -2
- package/lib/esm/commands/expressions/operands/value.js +19 -1
- package/lib/esm/commands/expressions/operands/value.js.map +1 -1
- package/lib/esm/commands/expressions/update/add.d.ts +3 -3
- package/lib/esm/commands/expressions/update/add.js +4 -2
- 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.js +1 -0
- package/lib/esm/commands/expressions/update/if-not-exists.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import type { AttributeValue } from "../../../types.js";
|
|
2
|
-
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
|
-
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
-
import type { IExpression } from "../expression.js";
|
|
5
2
|
import type { Path } from "../operands/path.js";
|
|
6
3
|
import type { Value } from "../operands/value.js";
|
|
7
4
|
import type { ConditionComparisonParams } from "./comparisons.js";
|
|
8
|
-
import {
|
|
5
|
+
import type { ConditionExpression } from "./expression.js";
|
|
9
6
|
import type { Size } from "./size.js";
|
|
10
7
|
export type ConditionParams = ConditionExpression | ConditionComparisonParams | ConditionExpression;
|
|
11
8
|
export type ConditionOperand<T extends AttributeValue = AttributeValue> = Path | Value<T> | Size;
|
|
12
|
-
export declare class Condition implements IExpression {
|
|
13
|
-
private readonly inner;
|
|
14
|
-
private constructor();
|
|
15
|
-
stringify(params: {
|
|
16
|
-
names: AttributeNames;
|
|
17
|
-
values: AttributeValues;
|
|
18
|
-
}): string;
|
|
19
|
-
/**
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
static from(params: ConditionParams): Condition;
|
|
23
|
-
}
|
|
24
|
-
export declare function condition(params: ConditionParams): Condition;
|
|
@@ -1,27 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Condition = void 0;
|
|
4
|
-
exports.condition = condition;
|
|
5
|
-
const expression_js_1 = require("./expression.js");
|
|
6
|
-
// TODO: remove/rename?
|
|
7
|
-
class Condition {
|
|
8
|
-
inner;
|
|
9
|
-
constructor(params) {
|
|
10
|
-
this.inner = params;
|
|
11
|
-
}
|
|
12
|
-
stringify(params) {
|
|
13
|
-
return this.inner.stringify(params);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
static from(params) {
|
|
19
|
-
return new Condition((0, expression_js_1.conditionExpression)(params));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.Condition = Condition;
|
|
23
|
-
// TODO: not meant to be exported publicly.
|
|
24
|
-
function condition(params) {
|
|
25
|
-
return Condition.from(params);
|
|
26
|
-
}
|
|
27
3
|
//# sourceMappingURL=condition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/condition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/condition.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NativeBinary, NativeString, NativeType } from "../../../types.js";
|
|
2
2
|
import { Path, type RawPath } from "../operands/path.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type RawValue, Value } from "../operands/value.js";
|
|
4
4
|
import { ConditionExpression } from "./expression.js";
|
|
5
5
|
import type { Size } from "./size.js";
|
|
6
6
|
/**
|
|
@@ -25,13 +25,13 @@ export declare function attributeNotExists(rawPath: RawPath): ConditionExpressio
|
|
|
25
25
|
* Returns a condition that uses the `attribute_type` function.
|
|
26
26
|
*
|
|
27
27
|
* @param attribute - The attribute path to check.
|
|
28
|
-
* @param
|
|
28
|
+
* @param rawType - The expected type of the attribute.
|
|
29
29
|
*
|
|
30
30
|
* @returns A {@link ConditionExpression} that evaluates to true if the attribute is of the expected type.
|
|
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: RawPath,
|
|
34
|
+
export declare function attributeType(attribute: RawPath, rawType: RawValue<NativeType>): ConditionExpression;
|
|
35
35
|
/**
|
|
36
36
|
* This type aggregates the types of operands that can be used with the {@link beginsWith} function.
|
|
37
37
|
*
|
|
@@ -6,6 +6,7 @@ exports.attributeType = attributeType;
|
|
|
6
6
|
exports.beginsWith = beginsWith;
|
|
7
7
|
exports.contains = contains;
|
|
8
8
|
const path_js_1 = require("../operands/path.js");
|
|
9
|
+
const value_js_1 = require("../operands/value.js");
|
|
9
10
|
const expression_js_1 = require("./expression.js");
|
|
10
11
|
/**
|
|
11
12
|
* Returns a condition that uses the `attribute_exists` function.
|
|
@@ -39,14 +40,15 @@ function attributeNotExists(rawPath) {
|
|
|
39
40
|
* Returns a condition that uses the `attribute_type` function.
|
|
40
41
|
*
|
|
41
42
|
* @param attribute - The attribute path to check.
|
|
42
|
-
* @param
|
|
43
|
+
* @param rawType - The expected type of the attribute.
|
|
43
44
|
*
|
|
44
45
|
* @returns A {@link ConditionExpression} that evaluates to true if the attribute is of the expected type.
|
|
45
46
|
*
|
|
46
47
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
47
48
|
*/
|
|
48
|
-
function attributeType(attribute,
|
|
49
|
+
function attributeType(attribute, rawType) {
|
|
49
50
|
const path = path_js_1.Path.normalize(attribute);
|
|
51
|
+
const type = value_js_1.Value.normalize(rawType);
|
|
50
52
|
return expression_js_1.ConditionExpression.from({
|
|
51
53
|
stringify: ({ names, values }) => `attribute_type(${path.substitute({ names })}, ${type.substitute({ values })})`,
|
|
52
54
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":";;AAcA,0CAKC;AAUD,gDAMC;AAYD,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":";;AAcA,0CAKC;AAUD,gDAMC;AAYD,sCAUC;AAmBD,gCAQC;AAsBD,4BAQC;AAjHD,iDAAyD;AACzD,mDAA4D;AAC5D,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,OAA6B;IAE7B,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,gBAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACtC,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,8 @@
|
|
|
1
|
-
import type { AttributeValue } from "../../../types.js";
|
|
1
|
+
import type { AttributePath, AttributeValue } from "../../../types.js";
|
|
2
2
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
3
|
import type { IOperand } from "./type.js";
|
|
4
|
+
export type ImplicitValue = Exclude<AttributeValue, AttributePath>;
|
|
5
|
+
export type RawValue<T extends AttributeValue = AttributeValue> = T extends ImplicitValue ? T | Value<T> : Value<T>;
|
|
4
6
|
/**
|
|
5
7
|
* Represents a value operand in an expression.
|
|
6
8
|
*
|
|
@@ -10,10 +12,20 @@ import type { IOperand } from "./type.js";
|
|
|
10
12
|
*/
|
|
11
13
|
export declare class Value<T extends AttributeValue = AttributeValue> implements IOperand {
|
|
12
14
|
private readonly value;
|
|
13
|
-
constructor(
|
|
15
|
+
private constructor();
|
|
14
16
|
substitute(params: {
|
|
15
17
|
values: AttributeValues;
|
|
16
18
|
}): string;
|
|
19
|
+
/**
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
static from<T extends AttributeValue = AttributeValue>(value: T): Value<T>;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param value
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
static normalize<T extends AttributeValue = AttributeValue>(value: RawValue<T>): Value<T>;
|
|
17
29
|
}
|
|
18
30
|
/**
|
|
19
31
|
* Factory function to create a {@link Value}.
|
|
@@ -18,6 +18,24 @@ class Value {
|
|
|
18
18
|
const { values } = params;
|
|
19
19
|
return values.substitute(this.value);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
static from(value) {
|
|
25
|
+
return new Value(value);
|
|
26
|
+
}
|
|
27
|
+
// TODO: docs
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param value
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
static normalize(value) {
|
|
34
|
+
if (value instanceof Value) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return Value.from(value);
|
|
38
|
+
}
|
|
21
39
|
}
|
|
22
40
|
exports.Value = Value;
|
|
23
41
|
/**
|
|
@@ -28,6 +46,6 @@ exports.Value = Value;
|
|
|
28
46
|
* @returns A new {@link Value} instance for the provided value.
|
|
29
47
|
*/
|
|
30
48
|
function value(value) {
|
|
31
|
-
return
|
|
49
|
+
return Value.from(value);
|
|
32
50
|
}
|
|
33
51
|
//# sourceMappingURL=value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/value.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/value.ts"],"names":[],"mappings":";;;AA6DA,sBAIC;AAxDD;;;;;;GAMG;AACH,MAAa,KAAK;IAGC,KAAK,CAAI;IAE1B,YAAoB,KAAQ;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,UAAU,CAAC,MAAmC;QAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAA4C,KAAQ;QAC7D,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,aAAa;IACb;;;;OAIG;IACH,MAAM,CAAC,SAAS,CACd,KAAkB;QAElB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,KAAiB,CAAC;QAC3B,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAa,CAAC;IACvC,CAAC;CACF;AApCD,sBAoCC;AAED;;;;;;GAMG;AACH,SAAgB,KAAK,CACnB,KAAQ;IAER,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -2,7 +2,7 @@ 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
4
|
import { Path, type RawPath } from "../operands/path.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type RawValue, Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
8
8
|
type NumberOrSet = NativeNumber | NativeSet;
|
|
@@ -30,11 +30,11 @@ export declare class AddAction implements IUpdateAction {
|
|
|
30
30
|
* This action only supports numbers and sets as values.
|
|
31
31
|
*
|
|
32
32
|
* @param rawPath - The attribute path to modify.
|
|
33
|
-
* @param
|
|
33
|
+
* @param rawVAlue - 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(rawPath: RawPath,
|
|
39
|
+
export declare function add(rawPath: RawPath, rawVAlue: RawValue<NumberOrSet>): UpdateAction;
|
|
40
40
|
export {};
|
|
@@ -3,6 +3,7 @@ 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
|
+
const value_js_1 = require("../operands/value.js");
|
|
6
7
|
class AddAction {
|
|
7
8
|
path;
|
|
8
9
|
value;
|
|
@@ -33,14 +34,15 @@ exports.AddAction = AddAction;
|
|
|
33
34
|
* This action only supports numbers and sets as values.
|
|
34
35
|
*
|
|
35
36
|
* @param rawPath - The attribute path to modify.
|
|
36
|
-
* @param
|
|
37
|
+
* @param rawVAlue - The value to add to the attribute.
|
|
37
38
|
*
|
|
38
39
|
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
39
40
|
*
|
|
40
41
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
41
42
|
*/
|
|
42
|
-
function add(rawPath,
|
|
43
|
+
function add(rawPath, rawVAlue) {
|
|
43
44
|
const path = path_js_1.Path.normalize(rawPath);
|
|
45
|
+
const value = value_js_1.Value.normalize(rawVAlue);
|
|
44
46
|
return AddAction.from({ path, value });
|
|
45
47
|
}
|
|
46
48
|
//# sourceMappingURL=add.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":";;;AAyDA,
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":";;;AAyDA,kBAOC;AA7DD,iDAAyD;AACzD,mDAA4D;AAM5D,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,CACjB,OAAgB,EAChB,QAA+B;IAE/B,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,gBAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -2,7 +2,7 @@ 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
4
|
import { Path, type RawPath } from "../operands/path.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type RawValue, Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
8
8
|
export declare class DeleteAction implements IUpdateAction {
|
|
@@ -26,10 +26,10 @@ export declare class DeleteAction implements IUpdateAction {
|
|
|
26
26
|
* provided subset.
|
|
27
27
|
*
|
|
28
28
|
* @param rawPath - The attribute path to modify.
|
|
29
|
-
* @param
|
|
29
|
+
* @param rawValue - 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(rawPath: RawPath,
|
|
35
|
+
export declare function deleteFrom(rawPath: RawPath, rawValue: RawValue<NativeSet>): UpdateAction;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeleteAction = void 0;
|
|
4
4
|
exports.deleteFrom = deleteFrom;
|
|
5
5
|
const path_js_1 = require("../operands/path.js");
|
|
6
|
+
const value_js_1 = require("../operands/value.js");
|
|
6
7
|
class DeleteAction {
|
|
7
8
|
path;
|
|
8
9
|
value;
|
|
@@ -32,14 +33,15 @@ exports.DeleteAction = DeleteAction;
|
|
|
32
33
|
* provided subset.
|
|
33
34
|
*
|
|
34
35
|
* @param rawPath - The attribute path to modify.
|
|
35
|
-
* @param
|
|
36
|
+
* @param rawValue - The value to remove from the attribute.
|
|
36
37
|
*
|
|
37
38
|
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
38
39
|
*
|
|
39
40
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
40
41
|
*/
|
|
41
|
-
function deleteFrom(rawPath,
|
|
42
|
+
function deleteFrom(rawPath, rawValue) {
|
|
42
43
|
const path = path_js_1.Path.normalize(rawPath);
|
|
44
|
+
const value = value_js_1.Value.normalize(rawValue);
|
|
43
45
|
return DeleteAction.from({ path, value });
|
|
44
46
|
}
|
|
45
47
|
//# 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,gCAOC;AA1DD,iDAAyD;AACzD,mDAA4D;AAI5D,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,QAA6B;IAE7B,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,gBAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IfNotExistsOperand = void 0;
|
|
4
4
|
exports.ifNotExists = ifNotExists;
|
|
5
5
|
const path_js_1 = require("../operands/path.js");
|
|
6
|
+
// TODO: generic type on this bitch.
|
|
6
7
|
class IfNotExistsOperand {
|
|
7
8
|
path;
|
|
8
9
|
defaultValue;
|
|
@@ -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":";;;AAyBA,kCAMC;AA7BD,iDAAyD;AAGzD,oCAAoC;AACpC,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,24 +1,8 @@
|
|
|
1
1
|
import type { AttributeValue } from "../../../types.js";
|
|
2
|
-
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
|
-
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
-
import type { IExpression } from "../expression.js";
|
|
5
2
|
import type { Path } from "../operands/path.js";
|
|
6
3
|
import type { Value } from "../operands/value.js";
|
|
7
4
|
import type { ConditionComparisonParams } from "./comparisons.js";
|
|
8
|
-
import {
|
|
5
|
+
import type { ConditionExpression } from "./expression.js";
|
|
9
6
|
import type { Size } from "./size.js";
|
|
10
7
|
export type ConditionParams = ConditionExpression | ConditionComparisonParams | ConditionExpression;
|
|
11
8
|
export type ConditionOperand<T extends AttributeValue = AttributeValue> = Path | Value<T> | Size;
|
|
12
|
-
export declare class Condition implements IExpression {
|
|
13
|
-
private readonly inner;
|
|
14
|
-
private constructor();
|
|
15
|
-
stringify(params: {
|
|
16
|
-
names: AttributeNames;
|
|
17
|
-
values: AttributeValues;
|
|
18
|
-
}): string;
|
|
19
|
-
/**
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
static from(params: ConditionParams): Condition;
|
|
23
|
-
}
|
|
24
|
-
export declare function condition(params: ConditionParams): Condition;
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
// TODO: remove/rename?
|
|
3
|
-
export class Condition {
|
|
4
|
-
inner;
|
|
5
|
-
constructor(params) {
|
|
6
|
-
this.inner = params;
|
|
7
|
-
}
|
|
8
|
-
stringify(params) {
|
|
9
|
-
return this.inner.stringify(params);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
static from(params) {
|
|
15
|
-
return new Condition(conditionExpression(params));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
// TODO: not meant to be exported publicly.
|
|
19
|
-
export function condition(params) {
|
|
20
|
-
return Condition.from(params);
|
|
21
|
-
}
|
|
1
|
+
export {};
|
|
22
2
|
//# sourceMappingURL=condition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/condition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/condition.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NativeBinary, NativeString, NativeType } from "../../../types.js";
|
|
2
2
|
import { Path, type RawPath } from "../operands/path.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type RawValue, Value } from "../operands/value.js";
|
|
4
4
|
import { ConditionExpression } from "./expression.js";
|
|
5
5
|
import type { Size } from "./size.js";
|
|
6
6
|
/**
|
|
@@ -25,13 +25,13 @@ export declare function attributeNotExists(rawPath: RawPath): ConditionExpressio
|
|
|
25
25
|
* Returns a condition that uses the `attribute_type` function.
|
|
26
26
|
*
|
|
27
27
|
* @param attribute - The attribute path to check.
|
|
28
|
-
* @param
|
|
28
|
+
* @param rawType - The expected type of the attribute.
|
|
29
29
|
*
|
|
30
30
|
* @returns A {@link ConditionExpression} that evaluates to true if the attribute is of the expected type.
|
|
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: RawPath,
|
|
34
|
+
export declare function attributeType(attribute: RawPath, rawType: RawValue<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,4 +1,5 @@
|
|
|
1
1
|
import { Path } from "../operands/path.js";
|
|
2
|
+
import { Value } from "../operands/value.js";
|
|
2
3
|
import { ConditionExpression } from "./expression.js";
|
|
3
4
|
/**
|
|
4
5
|
* Returns a condition that uses the `attribute_exists` function.
|
|
@@ -32,14 +33,15 @@ export function attributeNotExists(rawPath) {
|
|
|
32
33
|
* Returns a condition that uses the `attribute_type` function.
|
|
33
34
|
*
|
|
34
35
|
* @param attribute - The attribute path to check.
|
|
35
|
-
* @param
|
|
36
|
+
* @param rawType - The expected type of the attribute.
|
|
36
37
|
*
|
|
37
38
|
* @returns A {@link ConditionExpression} that evaluates to true if the attribute is of the expected type.
|
|
38
39
|
*
|
|
39
40
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
40
41
|
*/
|
|
41
|
-
export function attributeType(attribute,
|
|
42
|
+
export function attributeType(attribute, rawType) {
|
|
42
43
|
const path = Path.normalize(attribute);
|
|
44
|
+
const type = Value.normalize(rawType);
|
|
43
45
|
return ConditionExpression.from({
|
|
44
46
|
stringify: ({ names, values }) => `attribute_type(${path.substitute({ names })}, ${type.substitute({ values })})`,
|
|
45
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC5D,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,OAA6B;IAE7B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACtC,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,8 @@
|
|
|
1
|
-
import type { AttributeValue } from "../../../types.js";
|
|
1
|
+
import type { AttributePath, AttributeValue } from "../../../types.js";
|
|
2
2
|
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
3
|
import type { IOperand } from "./type.js";
|
|
4
|
+
export type ImplicitValue = Exclude<AttributeValue, AttributePath>;
|
|
5
|
+
export type RawValue<T extends AttributeValue = AttributeValue> = T extends ImplicitValue ? T | Value<T> : Value<T>;
|
|
4
6
|
/**
|
|
5
7
|
* Represents a value operand in an expression.
|
|
6
8
|
*
|
|
@@ -10,10 +12,20 @@ import type { IOperand } from "./type.js";
|
|
|
10
12
|
*/
|
|
11
13
|
export declare class Value<T extends AttributeValue = AttributeValue> implements IOperand {
|
|
12
14
|
private readonly value;
|
|
13
|
-
constructor(
|
|
15
|
+
private constructor();
|
|
14
16
|
substitute(params: {
|
|
15
17
|
values: AttributeValues;
|
|
16
18
|
}): string;
|
|
19
|
+
/**
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
static from<T extends AttributeValue = AttributeValue>(value: T): Value<T>;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param value
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
static normalize<T extends AttributeValue = AttributeValue>(value: RawValue<T>): Value<T>;
|
|
17
29
|
}
|
|
18
30
|
/**
|
|
19
31
|
* Factory function to create a {@link Value}.
|
|
@@ -14,6 +14,24 @@ export class Value {
|
|
|
14
14
|
const { values } = params;
|
|
15
15
|
return values.substitute(this.value);
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
static from(value) {
|
|
21
|
+
return new Value(value);
|
|
22
|
+
}
|
|
23
|
+
// TODO: docs
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param value
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
static normalize(value) {
|
|
30
|
+
if (value instanceof Value) {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
return Value.from(value);
|
|
34
|
+
}
|
|
17
35
|
}
|
|
18
36
|
/**
|
|
19
37
|
* Factory function to create a {@link Value}.
|
|
@@ -23,6 +41,6 @@ export class Value {
|
|
|
23
41
|
* @returns A new {@link Value} instance for the provided value.
|
|
24
42
|
*/
|
|
25
43
|
export function value(value) {
|
|
26
|
-
return
|
|
44
|
+
return Value.from(value);
|
|
27
45
|
}
|
|
28
46
|
//# sourceMappingURL=value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/value.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/value.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,MAAM,OAAO,KAAK;IAGC,KAAK,CAAI;IAE1B,YAAoB,KAAQ;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,UAAU,CAAC,MAAmC;QAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAA4C,KAAQ;QAC7D,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,aAAa;IACb;;;;OAIG;IACH,MAAM,CAAC,SAAS,CACd,KAAkB;QAElB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,KAAiB,CAAC;QAC3B,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAa,CAAC;IACvC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CACnB,KAAQ;IAER,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -2,7 +2,7 @@ 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
4
|
import { Path, type RawPath } from "../operands/path.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type RawValue, Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
8
8
|
type NumberOrSet = NativeNumber | NativeSet;
|
|
@@ -30,11 +30,11 @@ export declare class AddAction implements IUpdateAction {
|
|
|
30
30
|
* This action only supports numbers and sets as values.
|
|
31
31
|
*
|
|
32
32
|
* @param rawPath - The attribute path to modify.
|
|
33
|
-
* @param
|
|
33
|
+
* @param rawVAlue - 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(rawPath: RawPath,
|
|
39
|
+
export declare function add(rawPath: RawPath, rawVAlue: RawValue<NumberOrSet>): UpdateAction;
|
|
40
40
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Path } from "../operands/path.js";
|
|
2
|
+
import { Value } from "../operands/value.js";
|
|
2
3
|
export class AddAction {
|
|
3
4
|
path;
|
|
4
5
|
value;
|
|
@@ -28,14 +29,15 @@ export class AddAction {
|
|
|
28
29
|
* This action only supports numbers and sets as values.
|
|
29
30
|
*
|
|
30
31
|
* @param rawPath - The attribute path to modify.
|
|
31
|
-
* @param
|
|
32
|
+
* @param rawVAlue - The value to add to the attribute.
|
|
32
33
|
*
|
|
33
34
|
* @returns An {@link AddAction} that will add the value to the attribute at the specified path.
|
|
34
35
|
*
|
|
35
36
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD
|
|
36
37
|
*/
|
|
37
|
-
export function add(rawPath,
|
|
38
|
+
export function add(rawPath, rawVAlue) {
|
|
38
39
|
const path = Path.normalize(rawPath);
|
|
40
|
+
const value = Value.normalize(rawVAlue);
|
|
39
41
|
return AddAction.from({ path, value });
|
|
40
42
|
}
|
|
41
43
|
//# sourceMappingURL=add.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/add.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAM5D,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,CACjB,OAAgB,EAChB,QAA+B;IAE/B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -2,7 +2,7 @@ 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
4
|
import { Path, type RawPath } from "../operands/path.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type RawValue, Value } from "../operands/value.js";
|
|
6
6
|
import type { IUpdateAction, UpdateAction } from "./action.js";
|
|
7
7
|
import type { UpdateExpressionClauses } from "./clauses.js";
|
|
8
8
|
export declare class DeleteAction implements IUpdateAction {
|
|
@@ -26,10 +26,10 @@ export declare class DeleteAction implements IUpdateAction {
|
|
|
26
26
|
* provided subset.
|
|
27
27
|
*
|
|
28
28
|
* @param rawPath - The attribute path to modify.
|
|
29
|
-
* @param
|
|
29
|
+
* @param rawValue - 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(rawPath: RawPath,
|
|
35
|
+
export declare function deleteFrom(rawPath: RawPath, rawValue: RawValue<NativeSet>): UpdateAction;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Path } from "../operands/path.js";
|
|
2
|
+
import { Value } from "../operands/value.js";
|
|
2
3
|
export class DeleteAction {
|
|
3
4
|
path;
|
|
4
5
|
value;
|
|
@@ -27,14 +28,15 @@ export class DeleteAction {
|
|
|
27
28
|
* provided subset.
|
|
28
29
|
*
|
|
29
30
|
* @param rawPath - The attribute path to modify.
|
|
30
|
-
* @param
|
|
31
|
+
* @param rawValue - The value to remove from the attribute.
|
|
31
32
|
*
|
|
32
33
|
* @returns A {@link DeleteAction} that will remove the subset from the attribute.
|
|
33
34
|
*
|
|
34
35
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
|
|
35
36
|
*/
|
|
36
|
-
export function deleteFrom(rawPath,
|
|
37
|
+
export function deleteFrom(rawPath, rawValue) {
|
|
37
38
|
const path = Path.normalize(rawPath);
|
|
39
|
+
const value = Value.normalize(rawValue);
|
|
38
40
|
return DeleteAction.from({ path, value });
|
|
39
41
|
}
|
|
40
42
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/delete.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/update/delete.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI5D,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,QAA6B;IAE7B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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,oCAAoC;AACpC,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-blocks/aws-dynamodb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0-alpha.0",
|
|
4
4
|
"description": "A convenience wrapper over @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"clean": "rm -rf lib && rm -f infra-blocks-*.tgz",
|
|
32
32
|
"compile": "tsc",
|
|
33
33
|
"fix": "biome check --write",
|
|
34
|
-
"lint": "biome ci",
|
|
34
|
+
"lint": "biome ci --error-on-warnings",
|
|
35
35
|
"prepack": "npm run build",
|
|
36
36
|
"test": "npm run test:unit && npm run test:integration",
|
|
37
37
|
"test:coverage": "c8 npm run test",
|