@infra-blocks/aws-dynamodb 0.19.0 → 0.20.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/attributes/values.d.ts +13 -5
- package/lib/cjs/commands/attributes/values.js +13 -5
- package/lib/cjs/commands/attributes/values.js.map +1 -1
- package/lib/cjs/commands/expressions/condition.d.ts +1 -1
- package/lib/cjs/commands/expressions/condition.js +2 -2
- package/lib/cjs/commands/expressions/condition.js.map +1 -1
- package/lib/cjs/commands/expressions/index.d.ts +1 -1
- package/lib/cjs/commands/expressions/index.js +1 -1
- package/lib/cjs/commands/expressions/index.js.map +1 -1
- package/lib/cjs/commands/expressions/operands/index.d.ts +3 -0
- package/lib/cjs/commands/expressions/operands/index.js +20 -0
- package/lib/cjs/commands/expressions/operands/index.js.map +1 -0
- package/lib/cjs/commands/expressions/operands/name.d.ts +27 -0
- package/lib/cjs/commands/expressions/operands/name.js +33 -0
- package/lib/cjs/commands/expressions/operands/name.js.map +1 -0
- package/lib/cjs/commands/expressions/operands/type.d.ts +12 -0
- package/lib/cjs/commands/expressions/operands/type.js +3 -0
- package/lib/cjs/commands/expressions/operands/type.js.map +1 -0
- package/lib/cjs/commands/expressions/operands/value.d.ts +27 -0
- package/lib/cjs/commands/expressions/operands/value.js +33 -0
- package/lib/cjs/commands/expressions/operands/value.js.map +1 -0
- package/lib/cjs/commands/expressions/update.d.ts +35 -13
- package/lib/cjs/commands/expressions/update.js +54 -16
- package/lib/cjs/commands/expressions/update.js.map +1 -1
- package/lib/cjs/types.d.ts +11 -1
- package/lib/esm/commands/attributes/values.d.ts +13 -5
- package/lib/esm/commands/attributes/values.js +13 -5
- package/lib/esm/commands/attributes/values.js.map +1 -1
- package/lib/esm/commands/expressions/condition.d.ts +1 -1
- package/lib/esm/commands/expressions/condition.js +1 -1
- package/lib/esm/commands/expressions/condition.js.map +1 -1
- package/lib/esm/commands/expressions/index.d.ts +1 -1
- package/lib/esm/commands/expressions/index.js +1 -1
- package/lib/esm/commands/expressions/index.js.map +1 -1
- package/lib/esm/commands/expressions/operands/index.d.ts +3 -0
- package/lib/esm/commands/expressions/operands/index.js +4 -0
- package/lib/esm/commands/expressions/operands/index.js.map +1 -0
- package/lib/esm/commands/expressions/operands/name.d.ts +27 -0
- package/lib/esm/commands/expressions/operands/name.js +28 -0
- package/lib/esm/commands/expressions/operands/name.js.map +1 -0
- package/lib/esm/commands/expressions/operands/type.d.ts +12 -0
- package/lib/esm/commands/expressions/operands/type.js +2 -0
- package/lib/esm/commands/expressions/operands/type.js.map +1 -0
- package/lib/esm/commands/expressions/operands/value.d.ts +27 -0
- package/lib/esm/commands/expressions/operands/value.js +28 -0
- package/lib/esm/commands/expressions/operands/value.js.map +1 -0
- package/lib/esm/commands/expressions/update.d.ts +35 -13
- package/lib/esm/commands/expressions/update.js +48 -12
- package/lib/esm/commands/expressions/update.js.map +1 -1
- package/lib/esm/types.d.ts +11 -1
- package/package.json +1 -1
- package/lib/cjs/commands/expressions/operands.d.ts +0 -28
- package/lib/cjs/commands/expressions/operands.js +0 -34
- package/lib/cjs/commands/expressions/operands.js.map +0 -1
- package/lib/esm/commands/expressions/operands.d.ts +0 -28
- package/lib/esm/commands/expressions/operands.js +0 -27
- package/lib/esm/commands/expressions/operands.js.map +0 -1
|
@@ -3,15 +3,23 @@ export type ValueReference = `:${string}`;
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a set of attribute values used in an expression.
|
|
5
5
|
*
|
|
6
|
-
* This class provides an automated way to generate value reference variables
|
|
7
|
-
* so that every value in an expression can be treated
|
|
8
|
-
* with an automatically generated variable.
|
|
6
|
+
* This class provides an automated way to generate value reference variables,
|
|
7
|
+
* or substitutions, so that every value in an expression can be treated
|
|
8
|
+
* the same: systematically replaced with an automatically generated variable.
|
|
9
9
|
*
|
|
10
|
-
* The class keeps track of the
|
|
11
|
-
* the user requests a
|
|
10
|
+
* The class keeps track of the substitutions generated for each value, such that when
|
|
11
|
+
* the user requests a substitute for a known value, that previous one is returned.
|
|
12
|
+
*
|
|
13
|
+
* Values are compared using the SameValueZero algorithm(it uses a Map internally).
|
|
14
|
+
* This means that:
|
|
15
|
+
* ```ts
|
|
16
|
+
* assert(values.substitute(new Set([1,2,3])) !== values.substitute(new Set([1,2,3])));
|
|
17
|
+
* ```
|
|
12
18
|
*
|
|
13
19
|
* When the user requests a reference for an unknown value, then one is generated and
|
|
14
20
|
* stored for future use.
|
|
21
|
+
*
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Equality_comparisons_and_sameness#same-value-zero_equality
|
|
15
23
|
*/
|
|
16
24
|
export declare class AttributeValues {
|
|
17
25
|
private readonly values;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a set of attribute values used in an expression.
|
|
3
3
|
*
|
|
4
|
-
* This class provides an automated way to generate value reference variables
|
|
5
|
-
* so that every value in an expression can be treated
|
|
6
|
-
* with an automatically generated variable.
|
|
4
|
+
* This class provides an automated way to generate value reference variables,
|
|
5
|
+
* or substitutions, so that every value in an expression can be treated
|
|
6
|
+
* the same: systematically replaced with an automatically generated variable.
|
|
7
7
|
*
|
|
8
|
-
* The class keeps track of the
|
|
9
|
-
* the user requests a
|
|
8
|
+
* The class keeps track of the substitutions generated for each value, such that when
|
|
9
|
+
* the user requests a substitute for a known value, that previous one is returned.
|
|
10
|
+
*
|
|
11
|
+
* Values are compared using the SameValueZero algorithm(it uses a Map internally).
|
|
12
|
+
* This means that:
|
|
13
|
+
* ```ts
|
|
14
|
+
* assert(values.substitute(new Set([1,2,3])) !== values.substitute(new Set([1,2,3])));
|
|
15
|
+
* ```
|
|
10
16
|
*
|
|
11
17
|
* When the user requests a reference for an unknown value, then one is generated and
|
|
12
18
|
* stored for future use.
|
|
19
|
+
*
|
|
20
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Equality_comparisons_and_sameness#same-value-zero_equality
|
|
13
21
|
*/
|
|
14
22
|
export class AttributeValues {
|
|
15
23
|
values;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../../src/commands/attributes/values.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../../src/commands/attributes/values.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,eAAe;IACT,MAAM,CAAsC;IAE7D;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAkC,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,KAAqB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,gBAAgB;QACd,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,MAAM,GAA2C,EAAE,CAAC;QAC1D,KAAK,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YACvD,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,4BAA4B,CAAC,KAAqB;QACxD,MAAM,SAAS,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,EAAoB,CAAC;QACpE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,eAAe,EAAE,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -2,7 +2,7 @@ import type { AttributeType } from "../../types.js";
|
|
|
2
2
|
import type { AttributeNames } from "../attributes/names.js";
|
|
3
3
|
import type { AttributeValues } from "../attributes/values.js";
|
|
4
4
|
import type { IExpression } from "./expression.js";
|
|
5
|
-
import { AttributeOperand, type IOperand, type Operand, type ValueOperand } from "./operands.js";
|
|
5
|
+
import { AttributeOperand, type IOperand, type Operand, type ValueOperand } from "./operands/index.js";
|
|
6
6
|
export type ConditionOperand = Operand | SizeOperand;
|
|
7
7
|
export type Stringifier = (params: {
|
|
8
8
|
names: AttributeNames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../src/commands/expressions/condition.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,GAIjB,MAAM,
|
|
1
|
+
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../src/commands/expressions/condition.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,GAIjB,MAAM,qBAAqB,CAAC;AAmB7B,MAAM,OAAO,SAAS;IACH,WAAW,CAAc;IAE1C,YAAoB,MAAuB;QACzC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,4DAA4D;IAC5D,SAAS,CAAC,MAGT;QACC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,KAAgB;QAClB,OAAO,SAAS,CAAC,IAAI,CAAC;YACpB,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;gBAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAA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AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/expressions/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAE5B;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AttributePath } from "../../../types.js";
|
|
2
|
+
import type { AttributeNames } from "../../attributes/names.js";
|
|
3
|
+
import type { AttributeValues } from "../../attributes/values.js";
|
|
4
|
+
import type { IOperand } from "./type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Represents an attribute by name operand in an expression.
|
|
7
|
+
*
|
|
8
|
+
* When this operand is stringified, it first registers the
|
|
9
|
+
* attribute name in the {@link AttributeNames} registry and substitutes
|
|
10
|
+
* it with the returned value.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AttributeOperand implements IOperand {
|
|
13
|
+
private readonly path;
|
|
14
|
+
constructor(path: AttributePath);
|
|
15
|
+
substitute(params: {
|
|
16
|
+
names: AttributeNames;
|
|
17
|
+
values: AttributeValues;
|
|
18
|
+
}): string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Factory function to create an `AttributeOperand` with fewer characters.
|
|
22
|
+
*
|
|
23
|
+
* @param path - The path of the attribute this operand represents.
|
|
24
|
+
*
|
|
25
|
+
* @returns A new {@link AttributeOperand} instance for the provided path.
|
|
26
|
+
*/
|
|
27
|
+
export declare function attribute(path: AttributePath): AttributeOperand;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an attribute by name operand in an expression.
|
|
3
|
+
*
|
|
4
|
+
* When this operand is stringified, it first registers the
|
|
5
|
+
* attribute name in the {@link AttributeNames} registry and substitutes
|
|
6
|
+
* it with the returned value.
|
|
7
|
+
*/
|
|
8
|
+
export class AttributeOperand {
|
|
9
|
+
path;
|
|
10
|
+
constructor(path) {
|
|
11
|
+
this.path = path;
|
|
12
|
+
}
|
|
13
|
+
substitute(params) {
|
|
14
|
+
const { names } = params;
|
|
15
|
+
return names.substitute(this.path);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Factory function to create an `AttributeOperand` with fewer characters.
|
|
20
|
+
*
|
|
21
|
+
* @param path - The path of the attribute this operand represents.
|
|
22
|
+
*
|
|
23
|
+
* @returns A new {@link AttributeOperand} instance for the provided path.
|
|
24
|
+
*/
|
|
25
|
+
export function attribute(path) {
|
|
26
|
+
return new AttributeOperand(path);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/name.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IACV,IAAI,CAAgB;IAErC,YAAY,IAAmB;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,UAAU,CAAC,MAGV;QACC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QACzB,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAmB;IAC3C,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 { AttributeOperand } from "./name.js";
|
|
5
|
+
import type { ValueOperand } from "./value.js";
|
|
6
|
+
export type Operand<T extends AttributeValue = AttributeValue> = AttributeOperand | ValueOperand<T>;
|
|
7
|
+
export interface IOperand {
|
|
8
|
+
substitute(params: {
|
|
9
|
+
names: AttributeNames;
|
|
10
|
+
values: AttributeValues;
|
|
11
|
+
}): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { IOperand } from "./type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Represents a value operand in an expression.
|
|
7
|
+
*
|
|
8
|
+
* When this operand is stringified, it first registers the
|
|
9
|
+
* value in the {@link AttributeValues} registry and substitutes
|
|
10
|
+
* it with the returned value.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ValueOperand<T extends AttributeValue = AttributeValue> implements IOperand {
|
|
13
|
+
private readonly value;
|
|
14
|
+
constructor(value: T);
|
|
15
|
+
substitute(params: {
|
|
16
|
+
names: AttributeNames;
|
|
17
|
+
values: AttributeValues;
|
|
18
|
+
}): string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Factory function to create a `ValueOperand` with fewer characters.
|
|
22
|
+
*
|
|
23
|
+
* @param value - The value this operand represents.
|
|
24
|
+
*
|
|
25
|
+
* @returns A new {@link ValueOperand} instance for the provided value.
|
|
26
|
+
*/
|
|
27
|
+
export declare function value<T extends AttributeValue = AttributeValue>(value: T): ValueOperand<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a value operand in an expression.
|
|
3
|
+
*
|
|
4
|
+
* When this operand is stringified, it first registers the
|
|
5
|
+
* value in the {@link AttributeValues} registry and substitutes
|
|
6
|
+
* it with the returned value.
|
|
7
|
+
*/
|
|
8
|
+
export class ValueOperand {
|
|
9
|
+
value;
|
|
10
|
+
constructor(value) {
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
substitute(params) {
|
|
14
|
+
const { values } = params;
|
|
15
|
+
return values.substitute(this.value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Factory function to create a `ValueOperand` with fewer characters.
|
|
20
|
+
*
|
|
21
|
+
* @param value - The value this operand represents.
|
|
22
|
+
*
|
|
23
|
+
* @returns A new {@link ValueOperand} instance for the provided value.
|
|
24
|
+
*/
|
|
25
|
+
export function value(value) {
|
|
26
|
+
return new ValueOperand(value);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/operands/value.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,OAAO,YAAY;IAGN,KAAK,CAAI;IAE1B,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,UAAU,CAAC,MAGV;QACC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CACnB,KAAQ;IAER,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import type { AttributeValueNumber, AttributeValueSet } from "../../types.js";
|
|
1
2
|
import type { AttributeNames } from "../attributes/names.js";
|
|
2
3
|
import type { AttributeValues } from "../attributes/values.js";
|
|
3
4
|
import type { IExpression } from "./expression.js";
|
|
4
|
-
import type { AttributeOperand
|
|
5
|
+
import type { AttributeOperand } from "./operands/name.js";
|
|
6
|
+
import type { IOperand, Operand } from "./operands/type.js";
|
|
7
|
+
import type { ValueOperand } from "./operands/value.js";
|
|
5
8
|
export type UpdateExpressionParams = ReadonlyArray<UpdateAction>;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html
|
|
12
|
+
*/
|
|
6
13
|
export declare class UpdateExpression implements IExpression {
|
|
7
14
|
private readonly clauses;
|
|
8
15
|
private constructor();
|
|
@@ -18,28 +25,28 @@ export interface IUpdateAction {
|
|
|
18
25
|
values: AttributeValues;
|
|
19
26
|
}): string;
|
|
20
27
|
}
|
|
21
|
-
export type UpdateAction = SetAction | RemoveAction;
|
|
22
|
-
export type SetAction =
|
|
28
|
+
export type UpdateAction = SetAction | RemoveAction | AddAction;
|
|
29
|
+
export type SetAction = SetTo | SetToPlus | SetToMinus;
|
|
23
30
|
export type SetOperand = Operand | IfNotExistsOperand;
|
|
24
|
-
declare class
|
|
31
|
+
declare class SetTo implements IUpdateAction {
|
|
25
32
|
private readonly path;
|
|
26
33
|
private readonly operand;
|
|
27
34
|
constructor(params: {
|
|
28
35
|
path: AttributeOperand;
|
|
29
36
|
operand: SetOperand;
|
|
30
37
|
});
|
|
31
|
-
plus(operand: SetOperand):
|
|
32
|
-
minus(operand: SetOperand):
|
|
38
|
+
plus(operand: SetOperand): SetToPlus;
|
|
39
|
+
minus(operand: SetOperand): SetToMinus;
|
|
33
40
|
stringify(params: {
|
|
34
41
|
names: AttributeNames;
|
|
35
42
|
values: AttributeValues;
|
|
36
43
|
}): string;
|
|
37
44
|
}
|
|
38
|
-
export declare class
|
|
45
|
+
export declare class SetToPlus implements IUpdateAction {
|
|
39
46
|
private readonly inner;
|
|
40
47
|
private readonly operand;
|
|
41
48
|
constructor(params: {
|
|
42
|
-
inner:
|
|
49
|
+
inner: SetTo;
|
|
43
50
|
operand: SetOperand;
|
|
44
51
|
});
|
|
45
52
|
stringify(params: {
|
|
@@ -47,11 +54,11 @@ export declare class PlusAssignment implements IUpdateAction {
|
|
|
47
54
|
values: AttributeValues;
|
|
48
55
|
}): string;
|
|
49
56
|
}
|
|
50
|
-
export declare class
|
|
57
|
+
export declare class SetToMinus implements IUpdateAction {
|
|
51
58
|
private readonly inner;
|
|
52
59
|
private readonly operand;
|
|
53
60
|
constructor(params: {
|
|
54
|
-
inner:
|
|
61
|
+
inner: SetTo;
|
|
55
62
|
operand: SetOperand;
|
|
56
63
|
});
|
|
57
64
|
stringify(params: {
|
|
@@ -59,12 +66,12 @@ export declare class MinusAssignment implements IUpdateAction {
|
|
|
59
66
|
values: AttributeValues;
|
|
60
67
|
}): string;
|
|
61
68
|
}
|
|
62
|
-
declare class
|
|
69
|
+
declare class SetToBuilder {
|
|
63
70
|
private readonly path;
|
|
64
71
|
constructor(path: AttributeOperand);
|
|
65
|
-
to(operand: SetOperand):
|
|
72
|
+
to(operand: SetOperand): SetTo;
|
|
66
73
|
}
|
|
67
|
-
export declare function
|
|
74
|
+
export declare function set(path: AttributeOperand): SetToBuilder;
|
|
68
75
|
export declare class RemoveAction implements IUpdateAction {
|
|
69
76
|
private readonly path;
|
|
70
77
|
private constructor();
|
|
@@ -82,6 +89,21 @@ export declare class RemoveAction implements IUpdateAction {
|
|
|
82
89
|
* @returns A {@link RemoveAction} corresponding to the path provided.
|
|
83
90
|
*/
|
|
84
91
|
export declare function remove(path: AttributeOperand): RemoveAction;
|
|
92
|
+
type NumberOrSet = AttributeValueNumber | AttributeValueSet;
|
|
93
|
+
export declare class AddAction implements IUpdateAction {
|
|
94
|
+
private readonly path;
|
|
95
|
+
private readonly value;
|
|
96
|
+
private constructor();
|
|
97
|
+
stringify(params: {
|
|
98
|
+
names: AttributeNames;
|
|
99
|
+
values: AttributeValues;
|
|
100
|
+
}): string;
|
|
101
|
+
static from(params: {
|
|
102
|
+
path: AttributeOperand;
|
|
103
|
+
value: ValueOperand<NumberOrSet>;
|
|
104
|
+
}): AddAction;
|
|
105
|
+
}
|
|
106
|
+
export declare function add(path: AttributeOperand, value: ValueOperand<NumberOrSet>): AddAction;
|
|
85
107
|
export declare class IfNotExistsOperand implements IOperand {
|
|
86
108
|
private readonly path;
|
|
87
109
|
private readonly defaultValue;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html
|
|
4
|
+
*/
|
|
1
5
|
export class UpdateExpression {
|
|
2
6
|
clauses;
|
|
3
7
|
constructor(clauses) {
|
|
@@ -16,14 +20,19 @@ export class UpdateExpression {
|
|
|
16
20
|
.map((action) => action.stringify({ names, values }))
|
|
17
21
|
.join(",")}`);
|
|
18
22
|
}
|
|
23
|
+
if (this.clauses.add != null) {
|
|
24
|
+
parts.push(`ADD ${this.clauses.add
|
|
25
|
+
.map((action) => action.stringify({ names, values }))
|
|
26
|
+
.join(",")}`);
|
|
27
|
+
}
|
|
19
28
|
return parts.join("\n");
|
|
20
29
|
}
|
|
21
30
|
static from(params) {
|
|
22
31
|
const clauses = {};
|
|
23
32
|
for (const action of params) {
|
|
24
|
-
if (action instanceof
|
|
25
|
-
action instanceof
|
|
26
|
-
action instanceof
|
|
33
|
+
if (action instanceof SetTo ||
|
|
34
|
+
action instanceof SetToPlus ||
|
|
35
|
+
action instanceof SetToMinus) {
|
|
27
36
|
clauses.set ??= [];
|
|
28
37
|
clauses.set.push(action);
|
|
29
38
|
}
|
|
@@ -31,6 +40,10 @@ export class UpdateExpression {
|
|
|
31
40
|
clauses.remove ??= [];
|
|
32
41
|
clauses.remove.push(action);
|
|
33
42
|
}
|
|
43
|
+
else if (action instanceof AddAction) {
|
|
44
|
+
clauses.add ??= [];
|
|
45
|
+
clauses.add.push(action);
|
|
46
|
+
}
|
|
34
47
|
else {
|
|
35
48
|
throw new Error("unknown action type in update expression");
|
|
36
49
|
}
|
|
@@ -38,7 +51,7 @@ export class UpdateExpression {
|
|
|
38
51
|
return new UpdateExpression(clauses);
|
|
39
52
|
}
|
|
40
53
|
}
|
|
41
|
-
class
|
|
54
|
+
class SetTo {
|
|
42
55
|
path;
|
|
43
56
|
operand;
|
|
44
57
|
constructor(params) {
|
|
@@ -47,10 +60,10 @@ class Assignment {
|
|
|
47
60
|
this.operand = operand;
|
|
48
61
|
}
|
|
49
62
|
plus(operand) {
|
|
50
|
-
return new
|
|
63
|
+
return new SetToPlus({ inner: this, operand });
|
|
51
64
|
}
|
|
52
65
|
minus(operand) {
|
|
53
|
-
return new
|
|
66
|
+
return new SetToMinus({ inner: this, operand });
|
|
54
67
|
}
|
|
55
68
|
stringify(params) {
|
|
56
69
|
const { names, values } = params;
|
|
@@ -60,7 +73,7 @@ class Assignment {
|
|
|
60
73
|
})}`;
|
|
61
74
|
}
|
|
62
75
|
}
|
|
63
|
-
export class
|
|
76
|
+
export class SetToPlus {
|
|
64
77
|
inner;
|
|
65
78
|
operand;
|
|
66
79
|
constructor(params) {
|
|
@@ -76,7 +89,7 @@ export class PlusAssignment {
|
|
|
76
89
|
})}`;
|
|
77
90
|
}
|
|
78
91
|
}
|
|
79
|
-
export class
|
|
92
|
+
export class SetToMinus {
|
|
80
93
|
inner;
|
|
81
94
|
operand;
|
|
82
95
|
constructor(params) {
|
|
@@ -92,18 +105,20 @@ export class MinusAssignment {
|
|
|
92
105
|
})}`;
|
|
93
106
|
}
|
|
94
107
|
}
|
|
95
|
-
class
|
|
108
|
+
class SetToBuilder {
|
|
96
109
|
path;
|
|
97
110
|
constructor(path) {
|
|
98
111
|
this.path = path;
|
|
99
112
|
}
|
|
100
113
|
to(operand) {
|
|
101
|
-
return new
|
|
114
|
+
return new SetTo({ path: this.path, operand });
|
|
102
115
|
}
|
|
103
116
|
}
|
|
104
117
|
// TODO: increment/decrement utilities built on top of the assignments.
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
// TODO: review API for something more streamlined.... Imagine something like:
|
|
119
|
+
// set(attribute(<name>), value(<value>)) or set(attribute(<name>), value(<first>), "+", value(<second>))
|
|
120
|
+
export function set(path) {
|
|
121
|
+
return new SetToBuilder(path);
|
|
107
122
|
}
|
|
108
123
|
export class RemoveAction {
|
|
109
124
|
path;
|
|
@@ -128,6 +143,27 @@ export class RemoveAction {
|
|
|
128
143
|
export function remove(path) {
|
|
129
144
|
return RemoveAction.from(path);
|
|
130
145
|
}
|
|
146
|
+
// Note: the first operand *must* be an attribute name, and the second operand *must* be a value.
|
|
147
|
+
// This action only makes sense for sets and numbers.
|
|
148
|
+
export class AddAction {
|
|
149
|
+
path;
|
|
150
|
+
value;
|
|
151
|
+
constructor(params) {
|
|
152
|
+
const { path, value } = params;
|
|
153
|
+
this.path = path;
|
|
154
|
+
this.value = value;
|
|
155
|
+
}
|
|
156
|
+
stringify(params) {
|
|
157
|
+
const { names, values } = params;
|
|
158
|
+
return `${this.path.substitute({ names, values })} ${this.value.substitute({ names, values })}`;
|
|
159
|
+
}
|
|
160
|
+
static from(params) {
|
|
161
|
+
return new AddAction(params);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export function add(path, value) {
|
|
165
|
+
return AddAction.from({ path, value });
|
|
166
|
+
}
|
|
131
167
|
export class IfNotExistsOperand {
|
|
132
168
|
path;
|
|
133
169
|
defaultValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/expressions/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/expressions/update.ts"],"names":[],"mappings":"AAuCA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACV,OAAO,CAA0B;IAElD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{ ScalarAttributeType } from "@aws-sdk/client-dynamodb";
|
|
2
|
-
import type { NativeAttributeValue } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { NativeAttributeBinary, NativeAttributeValue, NumberValue } from "@aws-sdk/lib-dynamodb";
|
|
3
3
|
export type AttributeName = string;
|
|
4
4
|
export type AttributeValue = NativeAttributeValue;
|
|
5
|
+
/**
|
|
6
|
+
* A type regrouping all javascript native types that correspond to a valid DynamoDB
|
|
7
|
+
* number attribute.
|
|
8
|
+
*/
|
|
9
|
+
export type AttributeValueNumber = number | NumberValue | bigint;
|
|
10
|
+
/**
|
|
11
|
+
* A type regrouping all javascript native types that corerspond to a valid DynamoDB
|
|
12
|
+
* set attribute.
|
|
13
|
+
*/
|
|
14
|
+
export type AttributeValueSet = Set<AttributeValueNumber | string | NativeAttributeBinary | undefined>;
|
|
5
15
|
export type AttributePath = AttributeName;
|
|
6
16
|
export type AttributeType = "S" | "N" | "B" | "BOOL" | "NULL" | "M" | "L" | "SS" | "NS" | "BS";
|
|
7
17
|
export interface Attribute {
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { AttributePath, AttributeValue } from "../../types.js";
|
|
2
|
-
import type { AttributeNames } from "../attributes/names.js";
|
|
3
|
-
import type { AttributeValues } from "../attributes/values.js";
|
|
4
|
-
export type Operand<T extends AttributeValue = AttributeValue> = AttributeOperand | ValueOperand<T>;
|
|
5
|
-
export interface IOperand {
|
|
6
|
-
substitute(params: {
|
|
7
|
-
names: AttributeNames;
|
|
8
|
-
values: AttributeValues;
|
|
9
|
-
}): string;
|
|
10
|
-
}
|
|
11
|
-
export declare class ValueOperand<T extends AttributeValue> implements IOperand {
|
|
12
|
-
private readonly value;
|
|
13
|
-
constructor(value: T);
|
|
14
|
-
substitute(params: {
|
|
15
|
-
names: AttributeNames;
|
|
16
|
-
values: AttributeValues;
|
|
17
|
-
}): string;
|
|
18
|
-
}
|
|
19
|
-
export declare function value<T extends AttributeValue = AttributeValue>(value: AttributeValue): ValueOperand<T>;
|
|
20
|
-
export declare class AttributeOperand implements IOperand {
|
|
21
|
-
private readonly path;
|
|
22
|
-
constructor(path: AttributePath);
|
|
23
|
-
substitute(params: {
|
|
24
|
-
names: AttributeNames;
|
|
25
|
-
values: AttributeValues;
|
|
26
|
-
}): string;
|
|
27
|
-
}
|
|
28
|
-
export declare function attribute(path: AttributePath): AttributeOperand;
|