@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,207 +0,0 @@
|
|
|
1
|
-
import { unreachable } from "@infra-blocks/types";
|
|
2
|
-
import { conditionOperand, } from "./condition.js";
|
|
3
|
-
import { ConditionExpression } from "./expression.js";
|
|
4
|
-
// TODO: don't export publicly through index.
|
|
5
|
-
export function comparison(params) {
|
|
6
|
-
if (isBetween(params)) {
|
|
7
|
-
return between(params);
|
|
8
|
-
}
|
|
9
|
-
if (isEquals(params)) {
|
|
10
|
-
return equals(params);
|
|
11
|
-
}
|
|
12
|
-
if (isGreaterThan(params)) {
|
|
13
|
-
return greaterThan(params);
|
|
14
|
-
}
|
|
15
|
-
if (isGreaterThanOrEquals(params)) {
|
|
16
|
-
return greaterThanOrEquals(params);
|
|
17
|
-
}
|
|
18
|
-
if (isIn(params)) {
|
|
19
|
-
return inComparison(params);
|
|
20
|
-
}
|
|
21
|
-
if (isLowerThan(params)) {
|
|
22
|
-
return lowerThan(params);
|
|
23
|
-
}
|
|
24
|
-
if (isLowerThanOrEquals(params)) {
|
|
25
|
-
return lowerThanOrEquals(params);
|
|
26
|
-
}
|
|
27
|
-
if (isNotEquals(params)) {
|
|
28
|
-
return notEquals(params);
|
|
29
|
-
}
|
|
30
|
-
unreachable(params);
|
|
31
|
-
}
|
|
32
|
-
export function isComparison(params) {
|
|
33
|
-
const casted = params;
|
|
34
|
-
return (isBetween(casted) ||
|
|
35
|
-
isEquals(casted) ||
|
|
36
|
-
isGreaterThan(casted) ||
|
|
37
|
-
isGreaterThanOrEquals(casted) ||
|
|
38
|
-
isIn(casted) ||
|
|
39
|
-
isLowerThan(casted) ||
|
|
40
|
-
isLowerThanOrEquals(casted) ||
|
|
41
|
-
isNotEquals(casted));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Returns a condition that uses the `BETWEEN` operator.
|
|
45
|
-
*
|
|
46
|
-
* Both bounds are inclusive, meaning that the returned condition corresponds to `lower <= lhs <= upper`.
|
|
47
|
-
*
|
|
48
|
-
* @param params - The parameters of the `BETWEEN` comparison. The first element contains the left-hand side operand,
|
|
49
|
-
* the third element contains the lower inclusive bound, and the fifth element contains the upper inclusive bound.
|
|
50
|
-
*
|
|
51
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is within the provided bounds.
|
|
52
|
-
*
|
|
53
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
54
|
-
*/
|
|
55
|
-
function between(params) {
|
|
56
|
-
const lhs = conditionOperand(params[0]);
|
|
57
|
-
const lower = conditionOperand(params[2]);
|
|
58
|
-
const upper = conditionOperand(params[4]);
|
|
59
|
-
return ConditionExpression.from({
|
|
60
|
-
stringify: ({ names, values }) => {
|
|
61
|
-
return `${lhs.substitute({ names, values })} BETWEEN ${lower.substitute({ names, values })} AND ${upper.substitute({ names, values })}`;
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function isBetween(value) {
|
|
66
|
-
return value[1] === "BETWEEN" && value[3] === "AND";
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Returns a condition that uses the `=` operator.
|
|
70
|
-
*
|
|
71
|
-
* @param params - The parameters of the `=` comparison. The first element contains the left-hand side operand,
|
|
72
|
-
* and the third element contains the right-hand side operand.
|
|
73
|
-
*
|
|
74
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is equal to the provided one.
|
|
75
|
-
*
|
|
76
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
77
|
-
*/
|
|
78
|
-
function equals(params) {
|
|
79
|
-
return binaryOperation(params);
|
|
80
|
-
}
|
|
81
|
-
function isEquals(value) {
|
|
82
|
-
return value[1] === "=";
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Returns a condition that uses the `>` operator.
|
|
86
|
-
*
|
|
87
|
-
* @param params - The parameters of the `>` comparison. The first element contains the left-hand side operand,
|
|
88
|
-
* the third element contains the right-hand side operand.
|
|
89
|
-
*
|
|
90
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is greater than the provided one.
|
|
91
|
-
*
|
|
92
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
93
|
-
*/
|
|
94
|
-
function greaterThan(params) {
|
|
95
|
-
return binaryOperation(params);
|
|
96
|
-
}
|
|
97
|
-
function isGreaterThan(value) {
|
|
98
|
-
return value[1] === ">";
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Returns a condition that uses the `>=` operator.
|
|
102
|
-
*
|
|
103
|
-
* @param params - The parameters of the `>=` comparison. The first element contains the left-hand side operand,
|
|
104
|
-
* the third element contains the right-hand side operand.
|
|
105
|
-
*
|
|
106
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is greater than or equal to the provided one.
|
|
107
|
-
*
|
|
108
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
109
|
-
*/
|
|
110
|
-
function greaterThanOrEquals(params) {
|
|
111
|
-
return binaryOperation(params);
|
|
112
|
-
}
|
|
113
|
-
function isGreaterThanOrEquals(value) {
|
|
114
|
-
return value[1] === ">=";
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Returns a condition that uses the `IN` operator.
|
|
118
|
-
*
|
|
119
|
-
* This function throws if the list of elements to compared against is empty or exceeds 100 elements.
|
|
120
|
-
*
|
|
121
|
-
* @param params - The parameters of the `IN` comparison. The first element contains the left-hand side operand,
|
|
122
|
-
* the third element contains the list of elements to compare against.
|
|
123
|
-
*
|
|
124
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is equal to any of the provided ones.
|
|
125
|
-
*
|
|
126
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
127
|
-
*/
|
|
128
|
-
function inComparison(params) {
|
|
129
|
-
// TODO: unit test those limits
|
|
130
|
-
if (params[2].length === 0) {
|
|
131
|
-
throw new Error("the IN operator requires at least one operand.");
|
|
132
|
-
}
|
|
133
|
-
if (params[2].length > 100) {
|
|
134
|
-
throw new Error(`up to 100 operands are support for the IN operator, got ${params[2].length}`);
|
|
135
|
-
}
|
|
136
|
-
const element = conditionOperand(params[0]);
|
|
137
|
-
const elements = params[2].map((conditionOperand));
|
|
138
|
-
return ConditionExpression.from({
|
|
139
|
-
stringify: ({ names, values }) => {
|
|
140
|
-
const elementsString = elements
|
|
141
|
-
.map((operand) => operand.substitute({ names, values }))
|
|
142
|
-
.join(",");
|
|
143
|
-
return `${element.substitute({ names, values })} IN (${elementsString})`;
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function isIn(value) {
|
|
148
|
-
return value[1] === "IN";
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Returns a condition that uses the `<` operator
|
|
152
|
-
*
|
|
153
|
-
* @param params - The parameters of the `<` comparison. The first element contains the left-hand side operand,
|
|
154
|
-
* the third element contains the right-hand side operand.
|
|
155
|
-
*
|
|
156
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is lower than the provided one.
|
|
157
|
-
*
|
|
158
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
159
|
-
*/
|
|
160
|
-
function lowerThan(params) {
|
|
161
|
-
return binaryOperation(params);
|
|
162
|
-
}
|
|
163
|
-
function isLowerThan(value) {
|
|
164
|
-
return value[1] === "<";
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Returns a condition that uses the `<=` operator.
|
|
168
|
-
*
|
|
169
|
-
* @param params - The parameters of the `<=` comparison. The first element contains the left-hand side operand,
|
|
170
|
-
* the third element contains the right-hand side operand.
|
|
171
|
-
*
|
|
172
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is lower than or equal to the provided one.
|
|
173
|
-
*
|
|
174
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
175
|
-
*/
|
|
176
|
-
function lowerThanOrEquals(params) {
|
|
177
|
-
return binaryOperation(params);
|
|
178
|
-
}
|
|
179
|
-
function isLowerThanOrEquals(value) {
|
|
180
|
-
return value[1] === "<=";
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Returns a condition that uses the `<>` operator.
|
|
184
|
-
*
|
|
185
|
-
* @param params - The parameters of the `<>` comparison. The first element contains the left-hand side operand,
|
|
186
|
-
* the third element contains the right-hand side operand.
|
|
187
|
-
*
|
|
188
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand is not equal to the provided one.
|
|
189
|
-
*
|
|
190
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
191
|
-
*/
|
|
192
|
-
function notEquals(params) {
|
|
193
|
-
return binaryOperation(params);
|
|
194
|
-
}
|
|
195
|
-
function isNotEquals(value) {
|
|
196
|
-
return value[1] === "<>";
|
|
197
|
-
}
|
|
198
|
-
function binaryOperation(params) {
|
|
199
|
-
const lhs = conditionOperand(params[0]);
|
|
200
|
-
const rhs = conditionOperand(params[2]);
|
|
201
|
-
return ConditionExpression.from({
|
|
202
|
-
stringify: ({ names, values }) => {
|
|
203
|
-
return `${lhs.substitute({ names, values })} ${params[1]} ${rhs.substitute({ names, values })}`;
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
//# sourceMappingURL=comparisons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comparisons.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/comparisons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAQlD,OAAO,EAEL,gBAAgB,GAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAgCtD,6CAA6C;AAC7C,MAAM,UAAU,UAAU,CACxB,MAAiC;IAEjC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,MAAuB;IAEvB,MAAM,MAAM,GAAG,M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C/B,OAAO,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,CAAC;QAClG,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AttributeNames } from "../../attributes/names.js";
|
|
2
|
-
import type { AttributeValues } from "../../attributes/values.js";
|
|
3
|
-
import type { IExpression, Stringifier } from "../expression.js";
|
|
4
|
-
import type { ConditionParams } from "./condition.js";
|
|
5
|
-
export declare class ConditionExpression implements IExpression {
|
|
6
|
-
private readonly stringifier;
|
|
7
|
-
private constructor();
|
|
8
|
-
stringify(params: {
|
|
9
|
-
names: AttributeNames;
|
|
10
|
-
values: AttributeValues;
|
|
11
|
-
}): string;
|
|
12
|
-
/**
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
static from(params: {
|
|
16
|
-
stringify: Stringifier;
|
|
17
|
-
}): ConditionExpression;
|
|
18
|
-
}
|
|
19
|
-
export declare function conditionExpression(params: ConditionParams): ConditionExpression;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { comparison, isComparison } from "./comparisons.js";
|
|
2
|
-
export class ConditionExpression {
|
|
3
|
-
stringifier;
|
|
4
|
-
constructor(stringifier) {
|
|
5
|
-
this.stringifier = stringifier;
|
|
6
|
-
}
|
|
7
|
-
stringify(params) {
|
|
8
|
-
const { names, values } = params;
|
|
9
|
-
return this.stringifier({ names, values });
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
static from(params) {
|
|
15
|
-
const { stringify } = params;
|
|
16
|
-
return new ConditionExpression(stringify);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
// TODO: module visibility.
|
|
20
|
-
export function conditionExpression(params) {
|
|
21
|
-
return isComparison(params) ? comparison(params) : params;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=expression.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/expression.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG5D,MAAM,OAAO,mBAAmB;IACb,WAAW,CAAc;IAE1C,YAAoB,WAAwB;QAC1C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,SAAS,CAAC,MAGT;QACC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,MAAkC;QAC5C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,2BAA2B;AAC3B,MAAM,UAAU,mBAAmB,CACjC,MAAuB;IAEvB,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { AttributeType, NativeBinary, NativeString } from "../../../types.js";
|
|
2
|
-
import { type RawOperand } from "../operands/operand.js";
|
|
3
|
-
import { type RawPath } from "../operands/path.js";
|
|
4
|
-
import { type RawValue } from "../operands/value.js";
|
|
5
|
-
import { type RawConditionOperand } from "./condition.js";
|
|
6
|
-
import { ConditionExpression } from "./expression.js";
|
|
7
|
-
/**
|
|
8
|
-
* Returns a condition that uses the `attribute_exists` function.
|
|
9
|
-
*
|
|
10
|
-
* @param rawPath - The attribute path to check for existence.
|
|
11
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path exists.
|
|
12
|
-
*
|
|
13
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
14
|
-
*/
|
|
15
|
-
export declare function attributeExists(rawPath: RawPath): ConditionExpression;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a condition that uses the `attribute_not_exists` function.
|
|
18
|
-
*
|
|
19
|
-
* @param rawPath - The attribute path to check for non-existence.
|
|
20
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path does not exist.
|
|
21
|
-
*
|
|
22
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
23
|
-
*/
|
|
24
|
-
export declare function attributeNotExists(rawPath: RawPath): ConditionExpression;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a condition that uses the `attribute_type` function.
|
|
27
|
-
*
|
|
28
|
-
* @param attribute - The attribute path to check.
|
|
29
|
-
* @param rawType - The expected type of the attribute.
|
|
30
|
-
*
|
|
31
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the attribute is of the expected type.
|
|
32
|
-
*
|
|
33
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
34
|
-
*/
|
|
35
|
-
export declare function attributeType(attribute: RawPath, rawType: RawValue<AttributeType>): ConditionExpression;
|
|
36
|
-
/**
|
|
37
|
-
* This type aggregates the types of operands that can be used with the {@link beginsWith} function.
|
|
38
|
-
*
|
|
39
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
40
|
-
*/
|
|
41
|
-
export type BeginsWithOperand = RawOperand<NativeString | NativeBinary>;
|
|
42
|
-
/**
|
|
43
|
-
* Returns a condition that uses the `begins_with` function.
|
|
44
|
-
*
|
|
45
|
-
* @param first - The first function operand, which is the path or value to check.
|
|
46
|
-
* @param second - The second function operand, which is the prefix to validate against.
|
|
47
|
-
*
|
|
48
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the first operand begins with the second.
|
|
49
|
-
*
|
|
50
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
51
|
-
*/
|
|
52
|
-
export declare function beginsWith(first: BeginsWithOperand, second: BeginsWithOperand): ConditionExpression;
|
|
53
|
-
/**
|
|
54
|
-
* This type aggregates the types of operands that can be used as the first operand of the {@link contains} function.
|
|
55
|
-
*/
|
|
56
|
-
export type ContainsFirstOperand = RawOperand;
|
|
57
|
-
/**
|
|
58
|
-
* This type aggregates the types of operands that can be used as the second operand of the {@link contains} function.
|
|
59
|
-
*/
|
|
60
|
-
export type ContainsSecondOperand = RawConditionOperand;
|
|
61
|
-
/**
|
|
62
|
-
* Returns a condition that uses the `contains` function.
|
|
63
|
-
*
|
|
64
|
-
* @param first - The first function operand, which is the path or value to check.
|
|
65
|
-
* @param second - The second function operand, which is the value to check for containment.
|
|
66
|
-
*
|
|
67
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand contains the provided one.
|
|
68
|
-
*
|
|
69
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
70
|
-
*/
|
|
71
|
-
export declare function contains(first: ContainsFirstOperand, second: ContainsSecondOperand): ConditionExpression;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { operand } from "../operands/operand.js";
|
|
2
|
-
import { Path } from "../operands/path.js";
|
|
3
|
-
import { Value } from "../operands/value.js";
|
|
4
|
-
import { conditionOperand } from "./condition.js";
|
|
5
|
-
import { ConditionExpression } from "./expression.js";
|
|
6
|
-
/**
|
|
7
|
-
* Returns a condition that uses the `attribute_exists` function.
|
|
8
|
-
*
|
|
9
|
-
* @param rawPath - The attribute path to check for existence.
|
|
10
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path exists.
|
|
11
|
-
*
|
|
12
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
13
|
-
*/
|
|
14
|
-
export function attributeExists(rawPath) {
|
|
15
|
-
const path = Path.normalize(rawPath);
|
|
16
|
-
return ConditionExpression.from({
|
|
17
|
-
stringify: ({ names }) => `attribute_exists(${path.substitute({ names })})`,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns a condition that uses the `attribute_not_exists` function.
|
|
22
|
-
*
|
|
23
|
-
* @param rawPath - The attribute path to check for non-existence.
|
|
24
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the provided attribute path does not exist.
|
|
25
|
-
*
|
|
26
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
27
|
-
*/
|
|
28
|
-
export function attributeNotExists(rawPath) {
|
|
29
|
-
const path = Path.normalize(rawPath);
|
|
30
|
-
return ConditionExpression.from({
|
|
31
|
-
stringify: ({ names }) => `attribute_not_exists(${path.substitute({ names })})`,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Returns a condition that uses the `attribute_type` function.
|
|
36
|
-
*
|
|
37
|
-
* @param attribute - The attribute path to check.
|
|
38
|
-
* @param rawType - The expected type of the attribute.
|
|
39
|
-
*
|
|
40
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the attribute is of the expected type.
|
|
41
|
-
*
|
|
42
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
43
|
-
*/
|
|
44
|
-
export function attributeType(attribute, rawType) {
|
|
45
|
-
const path = Path.normalize(attribute);
|
|
46
|
-
const type = Value.normalize(rawType);
|
|
47
|
-
return ConditionExpression.from({
|
|
48
|
-
stringify: ({ names, values }) => `attribute_type(${path.substitute({ names })}, ${type.substitute({ values })})`,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns a condition that uses the `begins_with` function.
|
|
53
|
-
*
|
|
54
|
-
* @param first - The first function operand, which is the path or value to check.
|
|
55
|
-
* @param second - The second function operand, which is the prefix to validate against.
|
|
56
|
-
*
|
|
57
|
-
* @returns A {@link ConditionExpression} that evaluates to true if the first operand begins with the second.
|
|
58
|
-
*
|
|
59
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
60
|
-
*/
|
|
61
|
-
export function beginsWith(first, second) {
|
|
62
|
-
const firstOperand = operand(first);
|
|
63
|
-
const secondOperand = operand(second);
|
|
64
|
-
return ConditionExpression.from({
|
|
65
|
-
stringify: ({ names, values }) => `begins_with(${firstOperand.substitute({ names, values })}, ${secondOperand.substitute({ names, values })})`,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Returns a condition that uses the `contains` function.
|
|
70
|
-
*
|
|
71
|
-
* @param first - The first function operand, which is the path or value to check.
|
|
72
|
-
* @param second - The second function operand, which is the value to check for containment.
|
|
73
|
-
*
|
|
74
|
-
* @returns A {@link ConditionExpression} that evaluates to true if this operand contains the provided one.
|
|
75
|
-
*
|
|
76
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
77
|
-
*/
|
|
78
|
-
export function contains(first, second) {
|
|
79
|
-
const firstOperand = operand(first);
|
|
80
|
-
const secondOperand = conditionOperand(second);
|
|
81
|
-
return ConditionExpression.from({
|
|
82
|
-
stringify: ({ names, values }) => `contains(${firstOperand.substitute({ names, values })}, ${secondOperand.substitute({ names, values })})`,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/condition/functions.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAmB,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAA4B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;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,S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