@infra-blocks/aws-dynamodb 0.64.0 → 0.65.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/comparisons/between.d.ts +28 -0
- package/lib/cjs/commands/expressions/condition/comparisons/between.js +31 -0
- package/lib/cjs/commands/expressions/condition/comparisons/between.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/binary.d.ts +4 -0
- package/lib/cjs/commands/expressions/condition/comparisons/binary.js +11 -0
- package/lib/cjs/commands/expressions/condition/comparisons/binary.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/equals.d.ts +20 -0
- package/lib/cjs/commands/expressions/condition/comparisons/equals.js +25 -0
- package/lib/cjs/commands/expressions/condition/comparisons/equals.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/greater-than-or-equals.d.ts +24 -0
- package/lib/cjs/commands/expressions/condition/comparisons/greater-than-or-equals.js +25 -0
- package/lib/cjs/commands/expressions/condition/comparisons/greater-than-or-equals.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/greater-than.d.ts +20 -0
- package/lib/cjs/commands/expressions/condition/comparisons/greater-than.js +25 -0
- package/lib/cjs/commands/expressions/condition/comparisons/greater-than.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/in.d.ts +22 -0
- package/lib/cjs/commands/expressions/condition/comparisons/in.js +42 -0
- package/lib/cjs/commands/expressions/condition/comparisons/in.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/index.d.ts +9 -0
- package/lib/cjs/commands/expressions/condition/comparisons/index.js +26 -0
- package/lib/cjs/commands/expressions/condition/comparisons/index.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/lower-than-or-equals.d.ts +24 -0
- package/lib/cjs/commands/expressions/condition/comparisons/lower-than-or-equals.js +25 -0
- package/lib/cjs/commands/expressions/condition/comparisons/lower-than-or-equals.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/lower-than.d.ts +20 -0
- package/lib/cjs/commands/expressions/condition/comparisons/lower-than.js +25 -0
- package/lib/cjs/commands/expressions/condition/comparisons/lower-than.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/not-equals.d.ts +20 -0
- package/lib/cjs/commands/expressions/condition/comparisons/not-equals.js +25 -0
- package/lib/cjs/commands/expressions/condition/comparisons/not-equals.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/comparisons/operand.d.ts +4 -0
- package/lib/cjs/commands/expressions/condition/comparisons/operand.js +3 -0
- package/lib/cjs/commands/expressions/condition/comparisons/operand.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/condition-comparison.d.ts +15 -0
- package/lib/cjs/commands/expressions/condition/condition-comparison.js +54 -0
- package/lib/cjs/commands/expressions/condition/condition-comparison.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/condition.d.ts +10 -9
- package/lib/cjs/commands/expressions/condition/condition.js +10 -9
- package/lib/cjs/commands/expressions/condition/condition.js.map +1 -1
- package/lib/cjs/commands/expressions/condition/index.d.ts +2 -3
- package/lib/cjs/commands/expressions/condition/index.js +0 -2
- package/lib/cjs/commands/expressions/condition/index.js.map +1 -1
- package/lib/cjs/commands/expressions/condition/logic.d.ts +12 -8
- package/lib/cjs/commands/expressions/condition/logic.js +20 -30
- package/lib/cjs/commands/expressions/condition/logic.js.map +1 -1
- package/lib/cjs/commands/expressions/condition/operand.d.ts +8 -0
- package/lib/cjs/commands/expressions/condition/operand.js +15 -0
- package/lib/cjs/commands/expressions/condition/operand.js.map +1 -0
- package/lib/cjs/commands/expressions/expression.d.ts +8 -6
- package/lib/cjs/commands/expressions/expression.js +8 -0
- package/lib/cjs/commands/expressions/expression.js.map +1 -1
- package/lib/cjs/commands/expressions/functions/attribute-exists.d.ts +13 -0
- package/lib/cjs/commands/expressions/functions/attribute-exists.js +19 -0
- package/lib/cjs/commands/expressions/functions/attribute-exists.js.map +1 -0
- package/lib/cjs/commands/expressions/functions/attribute-not-exists.d.ts +13 -0
- package/lib/cjs/commands/expressions/functions/attribute-not-exists.js +19 -0
- package/lib/cjs/commands/expressions/functions/attribute-not-exists.js.map +1 -0
- package/lib/cjs/commands/expressions/functions/attribute-type.d.ts +17 -0
- package/lib/cjs/commands/expressions/functions/attribute-type.js +23 -0
- package/lib/cjs/commands/expressions/functions/attribute-type.js.map +1 -0
- package/lib/cjs/commands/expressions/functions/begins-with.d.ts +24 -0
- package/lib/cjs/commands/expressions/functions/begins-with.js +22 -0
- package/lib/cjs/commands/expressions/functions/begins-with.js.map +1 -0
- package/lib/cjs/commands/expressions/functions/contains.d.ts +16 -0
- package/lib/cjs/commands/expressions/functions/contains.js +23 -0
- package/lib/cjs/commands/expressions/functions/contains.js.map +1 -0
- package/lib/cjs/commands/expressions/functions/index.d.ts +5 -0
- package/lib/cjs/commands/expressions/functions/index.js +22 -0
- package/lib/cjs/commands/expressions/functions/index.js.map +1 -0
- package/lib/cjs/commands/expressions/index.d.ts +1 -0
- package/lib/cjs/commands/expressions/index.js +1 -0
- package/lib/cjs/commands/expressions/index.js.map +1 -1
- package/lib/cjs/commands/expressions/key-condition.d.ts +1 -1
- package/lib/cjs/commands/expressions/operands/index.d.ts +1 -0
- package/lib/cjs/commands/expressions/operands/index.js +3 -1
- package/lib/cjs/commands/expressions/operands/index.js.map +1 -1
- package/lib/cjs/commands/expressions/operands/operand.js +1 -0
- package/lib/cjs/commands/expressions/operands/operand.js.map +1 -1
- package/lib/{esm/commands/expressions/condition → cjs/commands/expressions/operands}/size.d.ts +3 -2
- package/lib/cjs/commands/expressions/{condition → operands}/size.js +1 -1
- package/lib/cjs/commands/expressions/operands/size.js.map +1 -0
- package/lib/cjs/commands/expressions/projection.d.ts +9 -8
- package/lib/cjs/commands/expressions/projection.js +14 -14
- package/lib/cjs/commands/expressions/projection.js.map +1 -1
- package/lib/cjs/commands/expressions/update/expression.d.ts +5 -5
- package/lib/cjs/commands/expressions/update/expression.js +5 -5
- package/lib/cjs/commands/expressions/update/expression.js.map +1 -1
- package/lib/cjs/commands/index.d.ts +1 -1
- package/lib/cjs/commands/index.js +19 -16
- package/lib/cjs/commands/index.js.map +1 -1
- package/lib/cjs/commands/inputs/condition-check.d.ts +1 -1
- package/lib/cjs/commands/inputs/condition-check.js +7 -7
- package/lib/cjs/commands/inputs/condition-check.js.map +1 -1
- package/lib/cjs/commands/inputs/delete-item.d.ts +2 -2
- package/lib/cjs/commands/inputs/delete-item.js +5 -4
- package/lib/cjs/commands/inputs/delete-item.js.map +1 -1
- package/lib/cjs/commands/inputs/get-item.d.ts +2 -2
- package/lib/cjs/commands/inputs/get-item.js +9 -10
- package/lib/cjs/commands/inputs/get-item.js.map +1 -1
- package/lib/cjs/commands/inputs/index.d.ts +0 -1
- package/lib/cjs/commands/inputs/index.js.map +1 -1
- package/lib/cjs/commands/inputs/lib.d.ts +13 -7
- package/lib/cjs/commands/inputs/lib.js +13 -16
- package/lib/cjs/commands/inputs/lib.js.map +1 -1
- package/lib/cjs/commands/inputs/put-item.d.ts +2 -2
- package/lib/cjs/commands/inputs/put-item.js +5 -4
- package/lib/cjs/commands/inputs/put-item.js.map +1 -1
- package/lib/cjs/commands/inputs/query.d.ts +4 -3
- package/lib/cjs/commands/inputs/query.js +16 -12
- package/lib/cjs/commands/inputs/query.js.map +1 -1
- package/lib/cjs/commands/inputs/update-item.d.ts +2 -2
- package/lib/cjs/commands/inputs/update-item.js +9 -17
- package/lib/cjs/commands/inputs/update-item.js.map +1 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/commands/expressions/condition/comparisons/between.d.ts +28 -0
- package/lib/esm/commands/expressions/condition/comparisons/between.js +27 -0
- package/lib/esm/commands/expressions/condition/comparisons/between.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/binary.d.ts +4 -0
- package/lib/esm/commands/expressions/condition/comparisons/binary.js +8 -0
- package/lib/esm/commands/expressions/condition/comparisons/binary.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/equals.d.ts +20 -0
- package/lib/esm/commands/expressions/condition/comparisons/equals.js +21 -0
- package/lib/esm/commands/expressions/condition/comparisons/equals.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/greater-than-or-equals.d.ts +24 -0
- package/lib/esm/commands/expressions/condition/comparisons/greater-than-or-equals.js +21 -0
- package/lib/esm/commands/expressions/condition/comparisons/greater-than-or-equals.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/greater-than.d.ts +20 -0
- package/lib/esm/commands/expressions/condition/comparisons/greater-than.js +21 -0
- package/lib/esm/commands/expressions/condition/comparisons/greater-than.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/in.d.ts +22 -0
- package/lib/esm/commands/expressions/condition/comparisons/in.js +38 -0
- package/lib/esm/commands/expressions/condition/comparisons/in.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/index.d.ts +9 -0
- package/lib/esm/commands/expressions/condition/comparisons/index.js +10 -0
- package/lib/esm/commands/expressions/condition/comparisons/index.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/lower-than-or-equals.d.ts +24 -0
- package/lib/esm/commands/expressions/condition/comparisons/lower-than-or-equals.js +21 -0
- package/lib/esm/commands/expressions/condition/comparisons/lower-than-or-equals.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/lower-than.d.ts +20 -0
- package/lib/esm/commands/expressions/condition/comparisons/lower-than.js +21 -0
- package/lib/esm/commands/expressions/condition/comparisons/lower-than.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/not-equals.d.ts +20 -0
- package/lib/esm/commands/expressions/condition/comparisons/not-equals.js +21 -0
- package/lib/esm/commands/expressions/condition/comparisons/not-equals.js.map +1 -0
- package/lib/esm/commands/expressions/condition/comparisons/operand.d.ts +4 -0
- package/lib/esm/commands/expressions/condition/comparisons/operand.js +2 -0
- package/lib/esm/commands/expressions/condition/comparisons/operand.js.map +1 -0
- package/lib/esm/commands/expressions/condition/condition-comparison.d.ts +15 -0
- package/lib/esm/commands/expressions/condition/condition-comparison.js +50 -0
- package/lib/esm/commands/expressions/condition/condition-comparison.js.map +1 -0
- package/lib/esm/commands/expressions/condition/condition.d.ts +10 -9
- package/lib/esm/commands/expressions/condition/condition.js +9 -8
- package/lib/esm/commands/expressions/condition/condition.js.map +1 -1
- package/lib/esm/commands/expressions/condition/index.d.ts +2 -3
- package/lib/esm/commands/expressions/condition/index.js +0 -2
- package/lib/esm/commands/expressions/condition/index.js.map +1 -1
- package/lib/esm/commands/expressions/condition/logic.d.ts +12 -8
- package/lib/esm/commands/expressions/condition/logic.js +20 -30
- package/lib/esm/commands/expressions/condition/logic.js.map +1 -1
- package/lib/esm/commands/expressions/condition/operand.d.ts +8 -0
- package/lib/esm/commands/expressions/condition/operand.js +12 -0
- package/lib/esm/commands/expressions/condition/operand.js.map +1 -0
- package/lib/esm/commands/expressions/expression.d.ts +8 -6
- package/lib/esm/commands/expressions/expression.js +7 -1
- package/lib/esm/commands/expressions/expression.js.map +1 -1
- package/lib/esm/commands/expressions/functions/attribute-exists.d.ts +13 -0
- package/lib/esm/commands/expressions/functions/attribute-exists.js +16 -0
- package/lib/esm/commands/expressions/functions/attribute-exists.js.map +1 -0
- package/lib/esm/commands/expressions/functions/attribute-not-exists.d.ts +13 -0
- package/lib/esm/commands/expressions/functions/attribute-not-exists.js +16 -0
- package/lib/esm/commands/expressions/functions/attribute-not-exists.js.map +1 -0
- package/lib/esm/commands/expressions/functions/attribute-type.d.ts +17 -0
- package/lib/esm/commands/expressions/functions/attribute-type.js +20 -0
- package/lib/esm/commands/expressions/functions/attribute-type.js.map +1 -0
- package/lib/esm/commands/expressions/functions/begins-with.d.ts +24 -0
- package/lib/esm/commands/expressions/functions/begins-with.js +19 -0
- package/lib/esm/commands/expressions/functions/begins-with.js.map +1 -0
- package/lib/esm/commands/expressions/functions/contains.d.ts +16 -0
- package/lib/esm/commands/expressions/functions/contains.js +20 -0
- package/lib/esm/commands/expressions/functions/contains.js.map +1 -0
- package/lib/esm/commands/expressions/functions/index.d.ts +5 -0
- package/lib/esm/commands/expressions/functions/index.js +6 -0
- package/lib/esm/commands/expressions/functions/index.js.map +1 -0
- package/lib/esm/commands/expressions/index.d.ts +1 -0
- package/lib/esm/commands/expressions/index.js +1 -0
- package/lib/esm/commands/expressions/index.js.map +1 -1
- package/lib/esm/commands/expressions/key-condition.d.ts +1 -1
- package/lib/esm/commands/expressions/operands/index.d.ts +1 -0
- package/lib/esm/commands/expressions/operands/index.js +1 -0
- package/lib/esm/commands/expressions/operands/index.js.map +1 -1
- package/lib/esm/commands/expressions/operands/operand.js +1 -0
- package/lib/esm/commands/expressions/operands/operand.js.map +1 -1
- package/lib/{cjs/commands/expressions/condition → esm/commands/expressions/operands}/size.d.ts +3 -2
- package/lib/esm/commands/expressions/{condition → operands}/size.js +1 -1
- package/lib/esm/commands/expressions/operands/size.js.map +1 -0
- package/lib/esm/commands/expressions/projection.d.ts +9 -8
- package/lib/esm/commands/expressions/projection.js +13 -13
- package/lib/esm/commands/expressions/projection.js.map +1 -1
- package/lib/esm/commands/expressions/update/expression.d.ts +5 -5
- package/lib/esm/commands/expressions/update/expression.js +3 -3
- package/lib/esm/commands/expressions/update/expression.js.map +1 -1
- package/lib/esm/commands/index.d.ts +1 -1
- package/lib/esm/commands/index.js +1 -1
- package/lib/esm/commands/index.js.map +1 -1
- package/lib/esm/commands/inputs/condition-check.d.ts +1 -1
- package/lib/esm/commands/inputs/condition-check.js +8 -8
- package/lib/esm/commands/inputs/condition-check.js.map +1 -1
- package/lib/esm/commands/inputs/delete-item.d.ts +2 -2
- package/lib/esm/commands/inputs/delete-item.js +6 -5
- package/lib/esm/commands/inputs/delete-item.js.map +1 -1
- package/lib/esm/commands/inputs/get-item.d.ts +2 -2
- package/lib/esm/commands/inputs/get-item.js +10 -11
- package/lib/esm/commands/inputs/get-item.js.map +1 -1
- package/lib/esm/commands/inputs/index.d.ts +0 -1
- package/lib/esm/commands/inputs/index.js.map +1 -1
- package/lib/esm/commands/inputs/lib.d.ts +13 -7
- package/lib/esm/commands/inputs/lib.js +12 -15
- package/lib/esm/commands/inputs/lib.js.map +1 -1
- package/lib/esm/commands/inputs/put-item.d.ts +2 -2
- package/lib/esm/commands/inputs/put-item.js +6 -5
- package/lib/esm/commands/inputs/put-item.js.map +1 -1
- package/lib/esm/commands/inputs/query.d.ts +4 -3
- package/lib/esm/commands/inputs/query.js +17 -13
- package/lib/esm/commands/inputs/query.js.map +1 -1
- package/lib/esm/commands/inputs/update-item.d.ts +2 -2
- package/lib/esm/commands/inputs/update-item.js +9 -17
- package/lib/esm/commands/inputs/update-item.js.map +1 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/commands/expressions/condition/comparisons.d.ts +0 -22
- package/lib/cjs/commands/expressions/condition/comparisons.js +0 -211
- package/lib/cjs/commands/expressions/condition/comparisons.js.map +0 -1
- package/lib/cjs/commands/expressions/condition/expression.d.ts +0 -19
- package/lib/cjs/commands/expressions/condition/expression.js +0 -28
- package/lib/cjs/commands/expressions/condition/expression.js.map +0 -1
- package/lib/cjs/commands/expressions/condition/functions.d.ts +0 -71
- package/lib/cjs/commands/expressions/condition/functions.js +0 -92
- package/lib/cjs/commands/expressions/condition/functions.js.map +0 -1
- package/lib/cjs/commands/expressions/condition/size.js.map +0 -1
- package/lib/esm/commands/expressions/condition/comparisons.d.ts +0 -22
- package/lib/esm/commands/expressions/condition/comparisons.js +0 -207
- package/lib/esm/commands/expressions/condition/comparisons.js.map +0 -1
- package/lib/esm/commands/expressions/condition/expression.d.ts +0 -19
- package/lib/esm/commands/expressions/condition/expression.js +0 -23
- package/lib/esm/commands/expressions/condition/expression.js.map +0 -1
- package/lib/esm/commands/expressions/condition/functions.d.ts +0 -71
- package/lib/esm/commands/expressions/condition/functions.js +0 -85
- package/lib/esm/commands/expressions/condition/functions.js.map +0 -1
- package/lib/esm/commands/expressions/condition/size.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/inputs/query.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/inputs/query.ts"],"names":[],"mappings":";;;AAEA,sDAKiC;AACjC,qCAAgD;AAanC,QAAA,UAAU,GAAG;IACxB,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAoB;IAEpB,MAAM,SAAS,GAAG,6BAAoB,CAAC,MAAM,EAAE,CAAC;IAChD,MAAM,MAAM,GAAsB;QAChC,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,sBAAsB,EAAE,SAAS,CAAC,MAAM,CAAC,oBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzE,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;KACzC,CAAC;IAEF,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,oBAAoB,GAAG,SAAS,CAAC,MAAM,CAC5C,qBAAU,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAClC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,wBAAwB,GAAG,SAAS,CAAC,2BAA2B,EAAE,CAAC;IAC1E,MAAM,CAAC,yBAAyB,GAAG,SAAS,CAAC,4BAA4B,EAAE,CAAC;IAE5E,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { UpdateCommandInput as NativeUpdateCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { WithRequired } from "@infra-blocks/types";
|
|
3
3
|
import type { KeyAttributes } from "../../types.js";
|
|
4
|
-
import { type ConditionParams, type
|
|
4
|
+
import { type ConditionParams, type UpdateParams } from "../expressions/index.js";
|
|
5
5
|
import type { ConditionCheckFailureReturnValue } from "./lib.js";
|
|
6
6
|
export type UpdateItemReturnValue = "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW";
|
|
7
7
|
export interface UpdateItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
8
8
|
table: string;
|
|
9
9
|
key: K;
|
|
10
|
-
update:
|
|
10
|
+
update: UpdateParams;
|
|
11
11
|
condition?: ConditionParams;
|
|
12
12
|
returnValues?: UpdateItemReturnValue;
|
|
13
13
|
returnValuesOnConditionCheckFailure?: ConditionCheckFailureReturnValue;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateItemInput = void 0;
|
|
4
|
-
const index_js_1 = require("../
|
|
5
|
-
const
|
|
6
|
-
const index_js_2 = require("../expressions/index.js");
|
|
4
|
+
const index_js_1 = require("../expressions/index.js");
|
|
5
|
+
const lib_js_1 = require("./lib.js");
|
|
7
6
|
exports.UpdateItemInput = {
|
|
8
7
|
encode,
|
|
9
8
|
};
|
|
10
9
|
function encode(input) {
|
|
11
|
-
const
|
|
12
|
-
const values = index_js_1.AttributeValues.create();
|
|
10
|
+
const formatter = lib_js_1.ExpressionsFormatter.create();
|
|
13
11
|
const result = {
|
|
14
12
|
TableName: input.table,
|
|
15
13
|
Key: input.key,
|
|
16
|
-
UpdateExpression:
|
|
17
|
-
names,
|
|
18
|
-
values,
|
|
19
|
-
}),
|
|
14
|
+
UpdateExpression: formatter.format(index_js_1.Update.from(input.update)),
|
|
20
15
|
};
|
|
21
16
|
if (input.returnValues != null) {
|
|
22
17
|
result.ReturnValues = input.returnValues;
|
|
@@ -28,18 +23,15 @@ function encode(input) {
|
|
|
28
23
|
// If there is no condition, we know that the names and values are finalized and
|
|
29
24
|
// we are ready to return the payload.
|
|
30
25
|
if (input.condition == null) {
|
|
31
|
-
result.ExpressionAttributeNames =
|
|
32
|
-
result.ExpressionAttributeValues =
|
|
26
|
+
result.ExpressionAttributeNames = formatter.getExpressionAttributeNames();
|
|
27
|
+
result.ExpressionAttributeValues = formatter.getExpressionAttributeValues();
|
|
33
28
|
return result;
|
|
34
29
|
}
|
|
35
30
|
// Otherwise, we need to stringify the condition, reusing the same names and values
|
|
36
31
|
// as before.
|
|
37
|
-
result.ConditionExpression = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
result.ExpressionAttributeNames = names.getSubstitutions();
|
|
42
|
-
result.ExpressionAttributeValues = values.getSubstitutions();
|
|
32
|
+
result.ConditionExpression = formatter.format(index_js_1.Condition.from(input.condition));
|
|
33
|
+
result.ExpressionAttributeNames = formatter.getExpressionAttributeNames();
|
|
34
|
+
result.ExpressionAttributeValues = formatter.getExpressionAttributeValues();
|
|
43
35
|
return result;
|
|
44
36
|
}
|
|
45
37
|
//# sourceMappingURL=update-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/update-item.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"update-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/update-item.ts"],"names":[],"mappings":";;;AAGA,sDAKiC;AAEjC,qCAAgD;AAmBnC,QAAA,eAAe,GAAG;IAC7B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAyB;IAEzB,MAAM,SAAS,GAAG,6BAAoB,CAAC,MAAM,EAAE,CAAC;IAChD,MAAM,MAAM,GAAuB;QACjC,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,gBAAgB,EAAE,SAAS,CAAC,MAAM,CAAC,iBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC9D,CAAC;IAEF,IAAI,KAAK,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED,IAAI,KAAK,CAAC,mCAAmC,IAAI,IAAI,EAAE,CAAC;QACtD,MAAM,CAAC,mCAAmC;YACxC,KAAK,CAAC,mCAAmC,CAAC;IAC9C,CAAC;IAED,gFAAgF;IAChF,sCAAsC;IACtC,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QAC5B,MAAM,CAAC,wBAAwB,GAAG,SAAS,CAAC,2BAA2B,EAAE,CAAC;QAC1E,MAAM,CAAC,yBAAyB,GAAG,SAAS,CAAC,4BAA4B,EAAE,CAAC;QAC5E,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mFAAmF;IACnF,aAAa;IACb,MAAM,CAAC,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAC3C,oBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAChC,CAAC;IACF,MAAM,CAAC,wBAAwB,GAAG,SAAS,CAAC,2BAA2B,EAAE,CAAC;IAC1E,MAAM,CAAC,yBAAyB,GAAG,SAAS,CAAC,4BAA4B,EAAE,CAAC;IAC5E,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// TODO: export new style commands, input and output types.
|
|
18
17
|
__exportStar(require("./client.js"), exports);
|
|
19
18
|
__exportStar(require("./commands/index.js"), exports);
|
|
20
19
|
__exportStar(require("./error.js"), exports);
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,sDAAoC;AACpC,6CAA2B;AAC3B,2CAAyB;AACzB,4DAA0C;AAC1C,6CAA2B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { ComparableOperand } from "./operand.js";
|
|
5
|
+
export type BetweenParams = [
|
|
6
|
+
ComparableOperand,
|
|
7
|
+
"BETWEEN",
|
|
8
|
+
ComparableOperand,
|
|
9
|
+
"AND",
|
|
10
|
+
ComparableOperand
|
|
11
|
+
];
|
|
12
|
+
export declare function isBetweenParams(value: ConditionComparisonParams): value is BetweenParams;
|
|
13
|
+
export type Between = ExpressionFormatter & Brand<"Between">;
|
|
14
|
+
export declare const Between: {
|
|
15
|
+
/**
|
|
16
|
+
* Returns a condition that uses the `BETWEEN` operator.
|
|
17
|
+
*
|
|
18
|
+
* Both bounds are inclusive, meaning that the returned condition corresponds to `lower <= lhs <= upper`.
|
|
19
|
+
*
|
|
20
|
+
* @param params - The parameters of the `BETWEEN` comparison. The first element contains the left-hand side operand,
|
|
21
|
+
* the third element contains the lower inclusive bound, and the fifth element contains the upper inclusive bound.
|
|
22
|
+
*
|
|
23
|
+
* @returns A {@link Between} that evaluates to true if this operand is within the provided bounds.
|
|
24
|
+
*
|
|
25
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
26
|
+
*/
|
|
27
|
+
from(params: BetweenParams): Between;
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import { ConditionOperand } from "../operand.js";
|
|
4
|
+
export function isBetweenParams(value) {
|
|
5
|
+
return value[1] === "BETWEEN" && value[3] === "AND";
|
|
6
|
+
}
|
|
7
|
+
export const Between = {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a condition that uses the `BETWEEN` operator.
|
|
10
|
+
*
|
|
11
|
+
* Both bounds are inclusive, meaning that the returned condition corresponds to `lower <= lhs <= upper`.
|
|
12
|
+
*
|
|
13
|
+
* @param params - The parameters of the `BETWEEN` comparison. The first element contains the left-hand side operand,
|
|
14
|
+
* the third element contains the lower inclusive bound, and the fifth element contains the upper inclusive bound.
|
|
15
|
+
*
|
|
16
|
+
* @returns A {@link Between} that evaluates to true if this operand is within the provided bounds.
|
|
17
|
+
*
|
|
18
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
19
|
+
*/
|
|
20
|
+
from(params) {
|
|
21
|
+
const lhs = ConditionOperand.normalize(params[0]);
|
|
22
|
+
const lower = ConditionOperand.normalize(params[2]);
|
|
23
|
+
const upper = ConditionOperand.normalize(params[4]);
|
|
24
|
+
return trusted(ExpressionFormatter.from(({ names, values }) => `${lhs.substitute({ names, values })} BETWEEN ${lower.substitute({ names, values })} AND ${upper.substitute({ names, values })}`));
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=between.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"between.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/between.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAWjD,MAAM,UAAU,eAAe,CAC7B,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC;AACtD,CAAC;AAID,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,MAAqB;QACxB,MAAM,GAAG,GAAG,gBAAgB,CAAC,SAAS,CAAkB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,MAAM,KAAK,GAAG,gBAAgB,CAAC,SAAS,CAAkB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,KAAK,GAAG,gBAAgB,CAAC,SAAS,CAAkB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAErE,OAAO,OAAO,CACZ,mBAAmB,CAAC,IAAI,CACtB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CACpB,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,YAAY,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,QAAQ,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CACnI,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AttributeValue } from "../../../../types.js";
|
|
2
|
+
import { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import { type RawConditionOperand } from "../operand.js";
|
|
4
|
+
export declare function binaryOperation<T extends AttributeValue = AttributeValue>(params: [RawConditionOperand<T>, string, RawConditionOperand<T>]): ExpressionFormatter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExpressionFormatter } from "../../expression.js";
|
|
2
|
+
import { ConditionOperand } from "../operand.js";
|
|
3
|
+
export function binaryOperation(params) {
|
|
4
|
+
const lhs = ConditionOperand.normalize(params[0]);
|
|
5
|
+
const rhs = ConditionOperand.normalize(params[2]);
|
|
6
|
+
return ExpressionFormatter.from(({ names, values }) => `${lhs.substitute({ names, values })} ${params[1]} ${rhs.substitute({ names, values })}`);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/binary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAA4B,MAAM,eAAe,CAAC;AAE3E,MAAM,UAAU,eAAe,CAC7B,MAAgE;IAEhE,MAAM,GAAG,GAAG,gBAAgB,CAAC,SAAS,CAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,SAAS,CAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,OAAO,mBAAmB,CAAC,IAAI,CAC7B,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CACpB,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAC3F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import type { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { RawConditionOperand } from "../operand.js";
|
|
5
|
+
export type EqualsParams = [RawConditionOperand, "=", RawConditionOperand];
|
|
6
|
+
export type Equals = ExpressionFormatter & Brand<"Equals">;
|
|
7
|
+
export declare const Equals: {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a condition that uses the `=` operator.
|
|
10
|
+
*
|
|
11
|
+
* @param params - The parameters of the `=` comparison. The first element contains the left-hand side operand,
|
|
12
|
+
* and the third element contains the right-hand side operand.
|
|
13
|
+
*
|
|
14
|
+
* @returns An {@link Equals} that evaluates to true if this operand is equal to the provided one.
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
17
|
+
*/
|
|
18
|
+
from(params: EqualsParams): Equals;
|
|
19
|
+
};
|
|
20
|
+
export declare function isEqualsParams(value: ConditionComparisonParams): value is EqualsParams;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { binaryOperation } from "./binary.js";
|
|
3
|
+
export const Equals = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a condition that uses the `=` operator.
|
|
6
|
+
*
|
|
7
|
+
* @param params - The parameters of the `=` comparison. The first element contains the left-hand side operand,
|
|
8
|
+
* and the third element contains the right-hand side operand.
|
|
9
|
+
*
|
|
10
|
+
* @returns An {@link Equals} that evaluates to true if this operand is equal to the provided one.
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
13
|
+
*/
|
|
14
|
+
from(params) {
|
|
15
|
+
return trusted(binaryOperation(params));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export function isEqualsParams(value) {
|
|
19
|
+
return value[1] === "=";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=equals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equals.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/equals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAM9C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB;;;;;;;;;OASG;IACH,IAAI,CAAC,MAAoB;QACvB,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,cAAc,CAC5B,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import type { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { ComparableOperand } from "./operand.js";
|
|
5
|
+
export type GreaterThanOrEqualsParams = [
|
|
6
|
+
ComparableOperand,
|
|
7
|
+
">=",
|
|
8
|
+
ComparableOperand
|
|
9
|
+
];
|
|
10
|
+
export type GreaterThanOrEquals = ExpressionFormatter & Brand<"GreaterThanOrEquals">;
|
|
11
|
+
export declare const GreaterThanOrEquals: {
|
|
12
|
+
/**
|
|
13
|
+
* Returns a condition that uses the `>=` operator.
|
|
14
|
+
*
|
|
15
|
+
* @param params - The parameters of the `>=` comparison. The first element contains the left-hand side operand,
|
|
16
|
+
* the third element contains the right-hand side operand.
|
|
17
|
+
*
|
|
18
|
+
* @returns A {@link GreaterThanOrEquals} that evaluates to true if this operand is greater than or equal to the provided one.
|
|
19
|
+
*
|
|
20
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
21
|
+
*/
|
|
22
|
+
from(params: GreaterThanOrEqualsParams): GreaterThanOrEquals;
|
|
23
|
+
};
|
|
24
|
+
export declare function isGreaterThanOrEqualsParams(value: ConditionComparisonParams): value is GreaterThanOrEqualsParams;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { binaryOperation } from "./binary.js";
|
|
3
|
+
export const GreaterThanOrEquals = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a condition that uses the `>=` operator.
|
|
6
|
+
*
|
|
7
|
+
* @param params - The parameters of the `>=` comparison. The first element contains the left-hand side operand,
|
|
8
|
+
* the third element contains the right-hand side operand.
|
|
9
|
+
*
|
|
10
|
+
* @returns A {@link GreaterThanOrEquals} that evaluates to true if this operand is greater than or equal to the provided one.
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
13
|
+
*/
|
|
14
|
+
from(params) {
|
|
15
|
+
return trusted(binaryOperation(params));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export function isGreaterThanOrEqualsParams(value) {
|
|
19
|
+
return value[1] === ">=";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=greater-than-or-equals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greater-than-or-equals.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/greater-than-or-equals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAY9C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC;;;;;;;;;OASG;IACH,IAAI,CAAC,MAAiC;QACpC,OAAO,OAAO,CAAC,eAAe,CAAkB,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,2BAA2B,CACzC,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import type { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { ComparableOperand } from "./operand.js";
|
|
5
|
+
export type GreaterThanParams = [ComparableOperand, ">", ComparableOperand];
|
|
6
|
+
export type GreaterThan = ExpressionFormatter & Brand<"GreaterThan">;
|
|
7
|
+
export declare const GreatThan: {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a condition that uses the `>` operator.
|
|
10
|
+
*
|
|
11
|
+
* @param params - The parameters of the `>` comparison. The first element contains the left-hand side operand,
|
|
12
|
+
* the third element contains the right-hand side operand.
|
|
13
|
+
*
|
|
14
|
+
* @returns A {@link GreaterThan} that evaluates to true if this operand is greater than the provided one.
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
17
|
+
*/
|
|
18
|
+
from(params: GreaterThanParams): GreaterThan;
|
|
19
|
+
};
|
|
20
|
+
export declare function isGreaterThanParams(value: ConditionComparisonParams): value is GreaterThanParams;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { binaryOperation } from "./binary.js";
|
|
3
|
+
export const GreatThan = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a condition that uses the `>` operator.
|
|
6
|
+
*
|
|
7
|
+
* @param params - The parameters of the `>` comparison. The first element contains the left-hand side operand,
|
|
8
|
+
* the third element contains the right-hand side operand.
|
|
9
|
+
*
|
|
10
|
+
* @returns A {@link GreaterThan} that evaluates to true if this operand is greater than the provided one.
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
13
|
+
*/
|
|
14
|
+
from(params) {
|
|
15
|
+
return trusted(binaryOperation(params));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export function isGreaterThanParams(value) {
|
|
19
|
+
return value[1] === ">";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=greater-than.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greater-than.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/greater-than.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAO9C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;;;;;;;;OASG;IACH,IAAI,CAAC,MAAyB;QAC5B,OAAO,OAAO,CAAC,eAAe,CAAkB,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,mBAAmB,CACjC,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { ComparableOperand } from "./operand.js";
|
|
5
|
+
export type InParams = [ComparableOperand, "IN", ComparableOperand[]];
|
|
6
|
+
export type In = ExpressionFormatter & Brand<"In">;
|
|
7
|
+
export declare const In: {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a condition that uses the `IN` operator.
|
|
10
|
+
*
|
|
11
|
+
* This function throws if the list of elements to compared against is empty or exceeds 100 elements.
|
|
12
|
+
*
|
|
13
|
+
* @param params - The parameters of the `IN` comparison. The first element contains the left-hand side operand,
|
|
14
|
+
* the third element contains the list of elements to compare against.
|
|
15
|
+
*
|
|
16
|
+
* @returns An {@link In} that evaluates to true if this operand is equal to any of the provided ones.
|
|
17
|
+
*
|
|
18
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
19
|
+
*/
|
|
20
|
+
from(params: InParams): In;
|
|
21
|
+
};
|
|
22
|
+
export declare function isInParams(value: ConditionComparisonParams): value is InParams;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import { ConditionOperand } from "../operand.js";
|
|
4
|
+
export const In = {
|
|
5
|
+
/**
|
|
6
|
+
* Returns a condition that uses the `IN` operator.
|
|
7
|
+
*
|
|
8
|
+
* This function throws if the list of elements to compared against is empty or exceeds 100 elements.
|
|
9
|
+
*
|
|
10
|
+
* @param params - The parameters of the `IN` comparison. The first element contains the left-hand side operand,
|
|
11
|
+
* the third element contains the list of elements to compare against.
|
|
12
|
+
*
|
|
13
|
+
* @returns An {@link In} that evaluates to true if this operand is equal to any of the provided ones.
|
|
14
|
+
*
|
|
15
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
16
|
+
*/
|
|
17
|
+
from(params) {
|
|
18
|
+
// TODO: unit test those limits
|
|
19
|
+
if (params[2].length === 0) {
|
|
20
|
+
throw new Error("the IN operator requires at least one operand.");
|
|
21
|
+
}
|
|
22
|
+
if (params[2].length > 100) {
|
|
23
|
+
throw new Error(`up to 100 operands are support for the IN operator, got ${params[2].length}`);
|
|
24
|
+
}
|
|
25
|
+
const element = ConditionOperand.normalize(params[0]);
|
|
26
|
+
const elements = params[2].map((ConditionOperand.normalize));
|
|
27
|
+
return trusted(ExpressionFormatter.from(({ names, values }) => {
|
|
28
|
+
const elementsString = elements
|
|
29
|
+
.map((operand) => operand.substitute({ names, values }))
|
|
30
|
+
.join(",");
|
|
31
|
+
return `${element.substitute({ names, values })} IN (${elementsString})`;
|
|
32
|
+
}));
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export function isInParams(value) {
|
|
36
|
+
return value[1] === "IN";
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=in.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAOjD,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,MAAgB;QACnB,+BAA+B;QAC/B,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,2DAA2D,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAC9E,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAkB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA,gBAAgB,CAAC,SAA0B,CAAA,CAAC,CAAC;QAC5E,OAAO,OAAO,CACZ,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,QAAQ;iBAC5B,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAE,OAAmB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;iBACpE,IAAI,CAAC,GAAG,CAAC,CAAC;YACb,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,QAAQ,cAAc,GAAG,CAAC;QAC3E,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,UAAU,CACxB,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./between.js";
|
|
2
|
+
export * from "./equals.js";
|
|
3
|
+
export * from "./greater-than.js";
|
|
4
|
+
export * from "./greater-than-or-equals.js";
|
|
5
|
+
export * from "./in.js";
|
|
6
|
+
export * from "./lower-than.js";
|
|
7
|
+
export * from "./lower-than-or-equals.js";
|
|
8
|
+
export * from "./not-equals.js";
|
|
9
|
+
export * from "./operand.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./between.js";
|
|
2
|
+
export * from "./equals.js";
|
|
3
|
+
export * from "./greater-than.js";
|
|
4
|
+
export * from "./greater-than-or-equals.js";
|
|
5
|
+
export * from "./in.js";
|
|
6
|
+
export * from "./lower-than.js";
|
|
7
|
+
export * from "./lower-than-or-equals.js";
|
|
8
|
+
export * from "./not-equals.js";
|
|
9
|
+
export * from "./operand.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import type { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { ComparableOperand } from "./operand.js";
|
|
5
|
+
export type LowerThanOrEqualsParams = [
|
|
6
|
+
ComparableOperand,
|
|
7
|
+
"<=",
|
|
8
|
+
ComparableOperand
|
|
9
|
+
];
|
|
10
|
+
export type LowerThanOrEquals = ExpressionFormatter & Brand<"LowerThanOrEquals">;
|
|
11
|
+
export declare const LowerThanOrEquals: {
|
|
12
|
+
/**
|
|
13
|
+
* Returns a condition that uses the `<=` operator.
|
|
14
|
+
*
|
|
15
|
+
* @param params - The parameters of the `<=` comparison. The first element contains the left-hand side operand,
|
|
16
|
+
* the third element contains the right-hand side operand.
|
|
17
|
+
*
|
|
18
|
+
* @returns A {@link LowerThanOrEquals} that evaluates to true if this operand is lower than or equal to the provided one.
|
|
19
|
+
*
|
|
20
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
21
|
+
*/
|
|
22
|
+
from(params: LowerThanOrEqualsParams): LowerThanOrEquals;
|
|
23
|
+
};
|
|
24
|
+
export declare function isLowerThanOrEqualsParams(value: ConditionComparisonParams): value is LowerThanOrEqualsParams;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { binaryOperation } from "./binary.js";
|
|
3
|
+
export const LowerThanOrEquals = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a condition that uses the `<=` operator.
|
|
6
|
+
*
|
|
7
|
+
* @param params - The parameters of the `<=` comparison. The first element contains the left-hand side operand,
|
|
8
|
+
* the third element contains the right-hand side operand.
|
|
9
|
+
*
|
|
10
|
+
* @returns A {@link LowerThanOrEquals} that evaluates to true if this operand is lower than or equal to the provided one.
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
13
|
+
*/
|
|
14
|
+
from(params) {
|
|
15
|
+
return trusted(binaryOperation(params));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export function isLowerThanOrEqualsParams(value) {
|
|
19
|
+
return value[1] === "<=";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=lower-than-or-equals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lower-than-or-equals.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/lower-than-or-equals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAY9C,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;;;;;;;OASG;IACH,IAAI,CAAC,MAA+B;QAClC,OAAO,OAAO,CAAC,eAAe,CAAkB,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,yBAAyB,CACvC,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import type { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { ComparableOperand } from "./operand.js";
|
|
5
|
+
export type LowerThanParams = [ComparableOperand, "<", ComparableOperand];
|
|
6
|
+
export type LowerThan = ExpressionFormatter & Brand<"LowerThan">;
|
|
7
|
+
export declare const LowerThan: {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a condition that uses the `<` operator
|
|
10
|
+
*
|
|
11
|
+
* @param params - The parameters of the `<` comparison. The first element contains the left-hand side operand,
|
|
12
|
+
* the third element contains the right-hand side operand.
|
|
13
|
+
*
|
|
14
|
+
* @returns A {@link LowerThan} that evaluates to true if this operand is lower than the provided one.
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
17
|
+
*/
|
|
18
|
+
from(params: LowerThanParams): LowerThan;
|
|
19
|
+
};
|
|
20
|
+
export declare function isLowerThanParams(value: ConditionComparisonParams): value is LowerThanParams;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { binaryOperation } from "./binary.js";
|
|
3
|
+
export const LowerThan = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a condition that uses the `<` operator
|
|
6
|
+
*
|
|
7
|
+
* @param params - The parameters of the `<` comparison. The first element contains the left-hand side operand,
|
|
8
|
+
* the third element contains the right-hand side operand.
|
|
9
|
+
*
|
|
10
|
+
* @returns A {@link LowerThan} that evaluates to true if this operand is lower than the provided one.
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
13
|
+
*/
|
|
14
|
+
from(params) {
|
|
15
|
+
return trusted(binaryOperation(params));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export function isLowerThanParams(value) {
|
|
19
|
+
return value[1] === "<";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=lower-than.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lower-than.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/lower-than.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAO9C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;;;;;;;;OASG;IACH,IAAI,CAAC,MAAuB;QAC1B,OAAO,OAAO,CAAC,eAAe,CAAkB,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAC/B,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Brand } from "@infra-blocks/types";
|
|
2
|
+
import type { ExpressionFormatter } from "../../expression.js";
|
|
3
|
+
import type { ConditionComparisonParams } from "../condition-comparison.js";
|
|
4
|
+
import type { RawConditionOperand } from "../operand.js";
|
|
5
|
+
export type NotEqualsParams = [RawConditionOperand, "<>", RawConditionOperand];
|
|
6
|
+
export type NotEquals = ExpressionFormatter & Brand<"NotEquals">;
|
|
7
|
+
export declare const NotEquals: {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a condition that uses the `<>` operator.
|
|
10
|
+
*
|
|
11
|
+
* @param params - The parameters of the `<>` comparison. The first element contains the left-hand side operand,
|
|
12
|
+
* the third element contains the right-hand side operand.
|
|
13
|
+
*
|
|
14
|
+
* @returns A {@link NotEquals} that evaluates to true if this operand is not equal to the provided one.
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
17
|
+
*/
|
|
18
|
+
from(params: NotEqualsParams): NotEquals;
|
|
19
|
+
};
|
|
20
|
+
export declare function isNotEqualsParams(value: ConditionComparisonParams): value is NotEqualsParams;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
import { binaryOperation } from "./binary.js";
|
|
3
|
+
export const NotEquals = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a condition that uses the `<>` operator.
|
|
6
|
+
*
|
|
7
|
+
* @param params - The parameters of the `<>` comparison. The first element contains the left-hand side operand,
|
|
8
|
+
* the third element contains the right-hand side operand.
|
|
9
|
+
*
|
|
10
|
+
* @returns A {@link NotEquals} that evaluates to true if this operand is not equal to the provided one.
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
13
|
+
*/
|
|
14
|
+
from(params) {
|
|
15
|
+
return trusted(binaryOperation(params));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export function isNotEqualsParams(value) {
|
|
19
|
+
return value[1] === "<>";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=not-equals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-equals.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/not-equals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAM9C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;;;;;;;;OASG;IACH,IAAI,CAAC,MAAuB;QAC1B,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAC/B,KAAgC;IAEhC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NativeBinary, NativeNumber, NativeString } from "../../../../types.js";
|
|
2
|
+
import type { RawConditionOperand } from "../operand.js";
|
|
3
|
+
export type ComparableValue = NativeBinary | NativeNumber | NativeString;
|
|
4
|
+
export type ComparableOperand = RawConditionOperand<ComparableValue>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operand.js","sourceRoot":"","sources":["../../../../../../src/commands/expressions/condition/comparisons/operand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Between, type BetweenParams } from "./comparisons/between.js";
|
|
2
|
+
import { Equals, type EqualsParams } from "./comparisons/equals.js";
|
|
3
|
+
import { type GreaterThan, type GreaterThanParams } from "./comparisons/greater-than.js";
|
|
4
|
+
import { GreaterThanOrEquals, type GreaterThanOrEqualsParams } from "./comparisons/greater-than-or-equals.js";
|
|
5
|
+
import { In, type InParams } from "./comparisons/in.js";
|
|
6
|
+
import { LowerThan, type LowerThanParams } from "./comparisons/lower-than.js";
|
|
7
|
+
import { LowerThanOrEquals, type LowerThanOrEqualsParams } from "./comparisons/lower-than-or-equals.js";
|
|
8
|
+
import { NotEquals, type NotEqualsParams } from "./comparisons/not-equals.js";
|
|
9
|
+
import type { ConditionParams } from "./condition.js";
|
|
10
|
+
export type ConditionComparisonParams = BetweenParams | EqualsParams | GreaterThanParams | GreaterThanOrEqualsParams | InParams | LowerThanParams | LowerThanOrEqualsParams | NotEqualsParams;
|
|
11
|
+
export type ConditionComparison = Between | Equals | GreaterThan | GreaterThanOrEquals | In | LowerThan | LowerThanOrEquals | NotEquals;
|
|
12
|
+
export declare const ConditionComparison: {
|
|
13
|
+
from(params: ConditionComparisonParams): ConditionComparison;
|
|
14
|
+
};
|
|
15
|
+
export declare function isConditionComparisonParams(params: ConditionParams): params is ConditionComparisonParams;
|