@infra-blocks/aws-dynamodb 0.67.0 → 0.68.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/lib/cjs/commands/expressions/comparisons/between.d.ts +22 -0
  2. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/between.js +14 -8
  3. package/lib/cjs/commands/expressions/comparisons/between.js.map +1 -0
  4. package/lib/cjs/commands/expressions/comparisons/binary.d.ts +4 -0
  5. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/binary.js +4 -4
  6. package/lib/cjs/commands/expressions/comparisons/binary.js.map +1 -0
  7. package/lib/cjs/commands/expressions/comparisons/comparable.d.ts +5 -0
  8. package/lib/cjs/commands/expressions/{condition/comparisons/operand.js → comparisons/comparable.js} +1 -1
  9. package/lib/cjs/commands/expressions/comparisons/comparable.js.map +1 -0
  10. package/lib/cjs/commands/expressions/comparisons/equals.d.ts +20 -0
  11. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/equals.js +8 -3
  12. package/lib/cjs/commands/expressions/comparisons/equals.js.map +1 -0
  13. package/lib/cjs/commands/expressions/comparisons/greater-than-or-equals.d.ts +20 -0
  14. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/greater-than-or-equals.js +8 -3
  15. package/lib/cjs/commands/expressions/comparisons/greater-than-or-equals.js.map +1 -0
  16. package/lib/cjs/commands/expressions/comparisons/greater-than.d.ts +20 -0
  17. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/greater-than.js +11 -6
  18. package/lib/cjs/commands/expressions/comparisons/greater-than.js.map +1 -0
  19. package/lib/cjs/commands/expressions/comparisons/in.d.ts +22 -0
  20. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/in.js +15 -12
  21. package/lib/cjs/commands/expressions/comparisons/in.js.map +1 -0
  22. package/lib/cjs/commands/expressions/comparisons/index.d.ts +29 -0
  23. package/lib/cjs/commands/expressions/comparisons/index.js +76 -0
  24. package/lib/cjs/commands/expressions/comparisons/index.js.map +1 -0
  25. package/lib/cjs/commands/expressions/comparisons/lower-than-or-equals.d.ts +20 -0
  26. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/lower-than-or-equals.js +10 -5
  27. package/lib/cjs/commands/expressions/comparisons/lower-than-or-equals.js.map +1 -0
  28. package/lib/cjs/commands/expressions/comparisons/lower-than.d.ts +20 -0
  29. package/lib/cjs/commands/expressions/{condition/comparisons → comparisons}/lower-than.js +11 -6
  30. package/lib/cjs/commands/expressions/comparisons/lower-than.js.map +1 -0
  31. package/lib/cjs/commands/expressions/comparisons/not-equals.d.ts +20 -0
  32. package/lib/cjs/commands/expressions/comparisons/not-equals.js +30 -0
  33. package/lib/cjs/commands/expressions/comparisons/not-equals.js.map +1 -0
  34. package/lib/cjs/commands/expressions/condition/comparison.d.ts +8 -0
  35. package/lib/cjs/commands/expressions/condition/comparison.js +14 -0
  36. package/lib/cjs/commands/expressions/condition/comparison.js.map +1 -0
  37. package/lib/cjs/commands/expressions/condition/condition.d.ts +5 -5
  38. package/lib/cjs/commands/expressions/condition/condition.js +3 -3
  39. package/lib/cjs/commands/expressions/condition/condition.js.map +1 -1
  40. package/lib/cjs/commands/expressions/condition/index.d.ts +1 -3
  41. package/lib/cjs/commands/expressions/condition/index.js +0 -1
  42. package/lib/cjs/commands/expressions/condition/index.js.map +1 -1
  43. package/lib/cjs/commands/expressions/condition/operand.d.ts +4 -5
  44. package/lib/cjs/commands/expressions/condition/operand.js +2 -9
  45. package/lib/cjs/commands/expressions/condition/operand.js.map +1 -1
  46. package/lib/cjs/commands/expressions/expression.d.ts +14 -0
  47. package/lib/cjs/commands/expressions/expression.js +13 -0
  48. package/lib/cjs/commands/expressions/expression.js.map +1 -0
  49. package/lib/cjs/commands/expressions/functions/index.d.ts +9 -0
  50. package/lib/cjs/commands/expressions/functions/index.js.map +1 -1
  51. package/lib/cjs/commands/expressions/index.d.ts +3 -1
  52. package/lib/cjs/commands/expressions/index.js +2 -1
  53. package/lib/cjs/commands/expressions/index.js.map +1 -1
  54. package/lib/cjs/commands/expressions/key-condition/comparison.d.ts +29 -0
  55. package/lib/cjs/commands/expressions/key-condition/comparison.js +45 -0
  56. package/lib/cjs/commands/expressions/key-condition/comparison.js.map +1 -0
  57. package/lib/cjs/commands/expressions/key-condition/index.d.ts +2 -0
  58. package/lib/cjs/commands/expressions/{condition/comparisons → key-condition}/index.js +4 -9
  59. package/lib/cjs/commands/expressions/key-condition/index.js.map +1 -0
  60. package/lib/cjs/commands/expressions/key-condition/key-condition.d.ts +37 -0
  61. package/lib/cjs/commands/expressions/key-condition/key-condition.js +20 -0
  62. package/lib/cjs/commands/expressions/key-condition/key-condition.js.map +1 -0
  63. package/lib/cjs/commands/expressions/logic/and.d.ts +16 -0
  64. package/lib/cjs/commands/expressions/logic/and.js +25 -0
  65. package/lib/cjs/commands/expressions/logic/and.js.map +1 -0
  66. package/lib/cjs/commands/expressions/logic/index.d.ts +10 -0
  67. package/lib/cjs/commands/expressions/logic/index.js +20 -0
  68. package/lib/cjs/commands/expressions/logic/index.js.map +1 -0
  69. package/lib/cjs/commands/expressions/logic/not.d.ts +15 -0
  70. package/lib/cjs/commands/expressions/logic/not.js +20 -0
  71. package/lib/cjs/commands/expressions/logic/not.js.map +1 -0
  72. package/lib/cjs/commands/expressions/logic/or.d.ts +16 -0
  73. package/lib/cjs/commands/expressions/logic/or.js +25 -0
  74. package/lib/cjs/commands/expressions/logic/or.js.map +1 -0
  75. package/lib/cjs/commands/expressions/operands/index.d.ts +3 -2
  76. package/lib/cjs/commands/expressions/operands/index.js +1 -0
  77. package/lib/cjs/commands/expressions/operands/index.js.map +1 -1
  78. package/lib/cjs/commands/expressions/operands/operand.d.ts +15 -0
  79. package/lib/cjs/commands/expressions/operands/operand.js +18 -0
  80. package/lib/cjs/commands/expressions/operands/operand.js.map +1 -0
  81. package/lib/cjs/commands/expressions/operands/path-or-value.d.ts +3 -3
  82. package/lib/cjs/commands/expressions/operands/path-or-value.js +4 -0
  83. package/lib/cjs/commands/expressions/operands/path-or-value.js.map +1 -1
  84. package/lib/cjs/commands/expressions/operands/size.js +0 -1
  85. package/lib/cjs/commands/expressions/operands/size.js.map +1 -1
  86. package/lib/cjs/commands/expressions/projection.d.ts +2 -2
  87. package/lib/cjs/commands/expressions/projection.js.map +1 -1
  88. package/lib/cjs/commands/index.d.ts +1 -1
  89. package/lib/cjs/commands/index.js.map +1 -1
  90. package/lib/cjs/commands/inputs/query.d.ts +1 -1
  91. package/lib/cjs/commands/inputs/query.js +1 -1
  92. package/lib/cjs/commands/inputs/query.js.map +1 -1
  93. package/lib/esm/commands/expressions/comparisons/between.d.ts +22 -0
  94. package/lib/esm/commands/expressions/{condition/comparisons → comparisons}/between.js +14 -8
  95. package/lib/esm/commands/expressions/comparisons/between.js.map +1 -0
  96. package/lib/esm/commands/expressions/comparisons/binary.d.ts +4 -0
  97. package/lib/esm/commands/expressions/comparisons/binary.js +8 -0
  98. package/lib/esm/commands/expressions/comparisons/binary.js.map +1 -0
  99. package/lib/esm/commands/expressions/comparisons/comparable.d.ts +5 -0
  100. package/lib/esm/commands/expressions/comparisons/comparable.js +2 -0
  101. package/lib/esm/commands/expressions/comparisons/comparable.js.map +1 -0
  102. package/lib/esm/commands/expressions/comparisons/equals.d.ts +20 -0
  103. package/lib/esm/commands/expressions/{condition/comparisons → comparisons}/equals.js +8 -3
  104. package/lib/esm/commands/expressions/comparisons/equals.js.map +1 -0
  105. package/lib/esm/commands/expressions/comparisons/greater-than-or-equals.d.ts +20 -0
  106. package/lib/esm/commands/expressions/{condition/comparisons → comparisons}/greater-than-or-equals.js +8 -3
  107. package/lib/esm/commands/expressions/comparisons/greater-than-or-equals.js.map +1 -0
  108. package/lib/esm/commands/expressions/comparisons/greater-than.d.ts +20 -0
  109. package/lib/esm/commands/expressions/{condition/comparisons → comparisons}/greater-than.js +10 -5
  110. package/lib/esm/commands/expressions/comparisons/greater-than.js.map +1 -0
  111. package/lib/esm/commands/expressions/comparisons/in.d.ts +22 -0
  112. package/lib/esm/commands/expressions/{condition/comparisons → comparisons}/in.js +15 -12
  113. package/lib/esm/commands/expressions/comparisons/in.js.map +1 -0
  114. package/lib/esm/commands/expressions/comparisons/index.d.ts +29 -0
  115. package/lib/esm/commands/expressions/comparisons/index.js +58 -0
  116. package/lib/esm/commands/expressions/comparisons/index.js.map +1 -0
  117. package/lib/esm/commands/expressions/comparisons/lower-than-or-equals.d.ts +20 -0
  118. package/lib/esm/commands/expressions/{condition/comparisons → comparisons}/lower-than-or-equals.js +10 -5
  119. package/lib/esm/commands/expressions/comparisons/lower-than-or-equals.js.map +1 -0
  120. package/lib/esm/commands/expressions/comparisons/lower-than.d.ts +20 -0
  121. package/lib/esm/commands/expressions/{condition/comparisons → comparisons}/lower-than.js +11 -6
  122. package/lib/esm/commands/expressions/comparisons/lower-than.js.map +1 -0
  123. package/lib/esm/commands/expressions/comparisons/not-equals.d.ts +20 -0
  124. package/lib/esm/commands/expressions/comparisons/not-equals.js +26 -0
  125. package/lib/esm/commands/expressions/comparisons/not-equals.js.map +1 -0
  126. package/lib/esm/commands/expressions/condition/comparison.d.ts +8 -0
  127. package/lib/esm/commands/expressions/condition/comparison.js +10 -0
  128. package/lib/esm/commands/expressions/condition/comparison.js.map +1 -0
  129. package/lib/esm/commands/expressions/condition/condition.d.ts +5 -5
  130. package/lib/esm/commands/expressions/condition/condition.js +1 -1
  131. package/lib/esm/commands/expressions/condition/condition.js.map +1 -1
  132. package/lib/esm/commands/expressions/condition/index.d.ts +1 -3
  133. package/lib/esm/commands/expressions/condition/index.js +0 -1
  134. package/lib/esm/commands/expressions/condition/index.js.map +1 -1
  135. package/lib/esm/commands/expressions/condition/operand.d.ts +4 -5
  136. package/lib/esm/commands/expressions/condition/operand.js +2 -9
  137. package/lib/esm/commands/expressions/condition/operand.js.map +1 -1
  138. package/lib/esm/commands/expressions/expression.d.ts +14 -0
  139. package/lib/esm/commands/expressions/expression.js +10 -0
  140. package/lib/esm/commands/expressions/expression.js.map +1 -0
  141. package/lib/esm/commands/expressions/functions/index.d.ts +9 -0
  142. package/lib/esm/commands/expressions/functions/index.js.map +1 -1
  143. package/lib/esm/commands/expressions/index.d.ts +3 -1
  144. package/lib/esm/commands/expressions/index.js +2 -1
  145. package/lib/esm/commands/expressions/index.js.map +1 -1
  146. package/lib/esm/commands/expressions/key-condition/comparison.d.ts +29 -0
  147. package/lib/esm/commands/expressions/key-condition/comparison.js +41 -0
  148. package/lib/esm/commands/expressions/key-condition/comparison.js.map +1 -0
  149. package/lib/esm/commands/expressions/key-condition/index.d.ts +2 -0
  150. package/lib/esm/commands/expressions/key-condition/index.js +3 -0
  151. package/lib/esm/commands/expressions/key-condition/index.js.map +1 -0
  152. package/lib/esm/commands/expressions/key-condition/key-condition.d.ts +37 -0
  153. package/lib/esm/commands/expressions/key-condition/key-condition.js +17 -0
  154. package/lib/esm/commands/expressions/key-condition/key-condition.js.map +1 -0
  155. package/lib/esm/commands/expressions/logic/and.d.ts +16 -0
  156. package/lib/esm/commands/expressions/logic/and.js +22 -0
  157. package/lib/esm/commands/expressions/logic/and.js.map +1 -0
  158. package/lib/esm/commands/expressions/logic/index.d.ts +10 -0
  159. package/lib/esm/commands/expressions/logic/index.js +4 -0
  160. package/lib/esm/commands/expressions/logic/index.js.map +1 -0
  161. package/lib/esm/commands/expressions/logic/not.d.ts +15 -0
  162. package/lib/esm/commands/expressions/logic/not.js +17 -0
  163. package/lib/esm/commands/expressions/logic/not.js.map +1 -0
  164. package/lib/esm/commands/expressions/logic/or.d.ts +16 -0
  165. package/lib/esm/commands/expressions/logic/or.js +22 -0
  166. package/lib/esm/commands/expressions/logic/or.js.map +1 -0
  167. package/lib/esm/commands/expressions/operands/index.d.ts +3 -2
  168. package/lib/esm/commands/expressions/operands/index.js +1 -0
  169. package/lib/esm/commands/expressions/operands/index.js.map +1 -1
  170. package/lib/esm/commands/expressions/operands/operand.d.ts +15 -0
  171. package/lib/esm/commands/expressions/operands/operand.js +14 -0
  172. package/lib/esm/commands/expressions/operands/operand.js.map +1 -0
  173. package/lib/esm/commands/expressions/operands/path-or-value.d.ts +3 -3
  174. package/lib/esm/commands/expressions/operands/path-or-value.js +5 -2
  175. package/lib/esm/commands/expressions/operands/path-or-value.js.map +1 -1
  176. package/lib/esm/commands/expressions/operands/size.js +0 -1
  177. package/lib/esm/commands/expressions/operands/size.js.map +1 -1
  178. package/lib/esm/commands/expressions/projection.d.ts +2 -2
  179. package/lib/esm/commands/expressions/projection.js.map +1 -1
  180. package/lib/esm/commands/index.d.ts +1 -1
  181. package/lib/esm/commands/index.js.map +1 -1
  182. package/lib/esm/commands/inputs/query.d.ts +1 -1
  183. package/lib/esm/commands/inputs/query.js +2 -2
  184. package/lib/esm/commands/inputs/query.js.map +1 -1
  185. package/package.json +2 -2
  186. package/lib/cjs/commands/expressions/condition/comparisons/between.d.ts +0 -28
  187. package/lib/cjs/commands/expressions/condition/comparisons/between.js.map +0 -1
  188. package/lib/cjs/commands/expressions/condition/comparisons/binary.d.ts +0 -4
  189. package/lib/cjs/commands/expressions/condition/comparisons/binary.js.map +0 -1
  190. package/lib/cjs/commands/expressions/condition/comparisons/equals.d.ts +0 -20
  191. package/lib/cjs/commands/expressions/condition/comparisons/equals.js.map +0 -1
  192. package/lib/cjs/commands/expressions/condition/comparisons/greater-than-or-equals.d.ts +0 -24
  193. package/lib/cjs/commands/expressions/condition/comparisons/greater-than-or-equals.js.map +0 -1
  194. package/lib/cjs/commands/expressions/condition/comparisons/greater-than.d.ts +0 -20
  195. package/lib/cjs/commands/expressions/condition/comparisons/greater-than.js.map +0 -1
  196. package/lib/cjs/commands/expressions/condition/comparisons/in.d.ts +0 -22
  197. package/lib/cjs/commands/expressions/condition/comparisons/in.js.map +0 -1
  198. package/lib/cjs/commands/expressions/condition/comparisons/index.d.ts +0 -9
  199. package/lib/cjs/commands/expressions/condition/comparisons/index.js.map +0 -1
  200. package/lib/cjs/commands/expressions/condition/comparisons/lower-than-or-equals.d.ts +0 -24
  201. package/lib/cjs/commands/expressions/condition/comparisons/lower-than-or-equals.js.map +0 -1
  202. package/lib/cjs/commands/expressions/condition/comparisons/lower-than.d.ts +0 -20
  203. package/lib/cjs/commands/expressions/condition/comparisons/lower-than.js.map +0 -1
  204. package/lib/cjs/commands/expressions/condition/comparisons/not-equals.d.ts +0 -24
  205. package/lib/cjs/commands/expressions/condition/comparisons/not-equals.js +0 -25
  206. package/lib/cjs/commands/expressions/condition/comparisons/not-equals.js.map +0 -1
  207. package/lib/cjs/commands/expressions/condition/comparisons/operand.d.ts +0 -4
  208. package/lib/cjs/commands/expressions/condition/comparisons/operand.js.map +0 -1
  209. package/lib/cjs/commands/expressions/condition/condition-comparison.d.ts +0 -15
  210. package/lib/cjs/commands/expressions/condition/condition-comparison.js +0 -54
  211. package/lib/cjs/commands/expressions/condition/condition-comparison.js.map +0 -1
  212. package/lib/cjs/commands/expressions/condition/logic.d.ts +0 -38
  213. package/lib/cjs/commands/expressions/condition/logic.js +0 -58
  214. package/lib/cjs/commands/expressions/condition/logic.js.map +0 -1
  215. package/lib/cjs/commands/expressions/key-condition.d.ts +0 -11
  216. package/lib/cjs/commands/expressions/key-condition.js +0 -14
  217. package/lib/cjs/commands/expressions/key-condition.js.map +0 -1
  218. package/lib/esm/commands/expressions/condition/comparisons/between.d.ts +0 -28
  219. package/lib/esm/commands/expressions/condition/comparisons/between.js.map +0 -1
  220. package/lib/esm/commands/expressions/condition/comparisons/binary.d.ts +0 -4
  221. package/lib/esm/commands/expressions/condition/comparisons/binary.js +0 -8
  222. package/lib/esm/commands/expressions/condition/comparisons/binary.js.map +0 -1
  223. package/lib/esm/commands/expressions/condition/comparisons/equals.d.ts +0 -20
  224. package/lib/esm/commands/expressions/condition/comparisons/equals.js.map +0 -1
  225. package/lib/esm/commands/expressions/condition/comparisons/greater-than-or-equals.d.ts +0 -24
  226. package/lib/esm/commands/expressions/condition/comparisons/greater-than-or-equals.js.map +0 -1
  227. package/lib/esm/commands/expressions/condition/comparisons/greater-than.d.ts +0 -20
  228. package/lib/esm/commands/expressions/condition/comparisons/greater-than.js.map +0 -1
  229. package/lib/esm/commands/expressions/condition/comparisons/in.d.ts +0 -22
  230. package/lib/esm/commands/expressions/condition/comparisons/in.js.map +0 -1
  231. package/lib/esm/commands/expressions/condition/comparisons/index.d.ts +0 -9
  232. package/lib/esm/commands/expressions/condition/comparisons/index.js +0 -10
  233. package/lib/esm/commands/expressions/condition/comparisons/index.js.map +0 -1
  234. package/lib/esm/commands/expressions/condition/comparisons/lower-than-or-equals.d.ts +0 -24
  235. package/lib/esm/commands/expressions/condition/comparisons/lower-than-or-equals.js.map +0 -1
  236. package/lib/esm/commands/expressions/condition/comparisons/lower-than.d.ts +0 -20
  237. package/lib/esm/commands/expressions/condition/comparisons/lower-than.js.map +0 -1
  238. package/lib/esm/commands/expressions/condition/comparisons/not-equals.d.ts +0 -24
  239. package/lib/esm/commands/expressions/condition/comparisons/not-equals.js +0 -21
  240. package/lib/esm/commands/expressions/condition/comparisons/not-equals.js.map +0 -1
  241. package/lib/esm/commands/expressions/condition/comparisons/operand.d.ts +0 -4
  242. package/lib/esm/commands/expressions/condition/comparisons/operand.js +0 -2
  243. package/lib/esm/commands/expressions/condition/comparisons/operand.js.map +0 -1
  244. package/lib/esm/commands/expressions/condition/condition-comparison.d.ts +0 -15
  245. package/lib/esm/commands/expressions/condition/condition-comparison.js +0 -50
  246. package/lib/esm/commands/expressions/condition/condition-comparison.js.map +0 -1
  247. package/lib/esm/commands/expressions/condition/logic.d.ts +0 -38
  248. package/lib/esm/commands/expressions/condition/logic.js +0 -53
  249. package/lib/esm/commands/expressions/condition/logic.js.map +0 -1
  250. package/lib/esm/commands/expressions/key-condition.d.ts +0 -11
  251. package/lib/esm/commands/expressions/key-condition.js +0 -11
  252. package/lib/esm/commands/expressions/key-condition.js.map +0 -1
@@ -0,0 +1,22 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import { ExpressionFormatter } from "../formatter.js";
3
+ import { Operand, type OperandInput } from "../operands/index.js";
4
+ import type { ComparableValue } from "./comparable.js";
5
+ export type BetweenInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>> = [OI, "BETWEEN", OI, "AND", OI];
6
+ export declare function isBetweenInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>>(value: unknown): value is BetweenInput<OI>;
7
+ export type Between<O extends Operand<ComparableValue> = Operand<ComparableValue>> = ExpressionFormatter & Brand<"Between"> & Phantom<O>;
8
+ export declare const Between: {
9
+ /**
10
+ * Returns a comparison that uses the `BETWEEN` operator.
11
+ *
12
+ * Both bounds are inclusive.
13
+ *
14
+ * @param input - The parameters of the `BETWEEN` comparison. The first element contains the left-hand side operand,
15
+ * the third element contains the lower inclusive bound, and the fifth element contains the upper inclusive bound.
16
+ *
17
+ * @returns A {@link Between} that evaluates to true if this operand is within the provided bounds.
18
+ *
19
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
20
+ */
21
+ from<O extends Operand<ComparableValue>, OI extends OperandInput<ComparableValue>>(input: BetweenInput<OI>): Between<O>;
22
+ };
@@ -3,16 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Between = void 0;
4
4
  exports.isBetweenInput = isBetweenInput;
5
5
  const types_1 = require("@infra-blocks/types");
6
- const formatter_js_1 = require("../../formatter.js");
7
- const operand_js_1 = require("../operand.js");
6
+ const formatter_js_1 = require("../formatter.js");
7
+ const index_js_1 = require("../operands/index.js");
8
8
  function isBetweenInput(value) {
9
- return value[1] === "BETWEEN" && value[3] === "AND";
9
+ return (Array.isArray(value) &&
10
+ value.length === 5 &&
11
+ (0, index_js_1.isOperandInput)(value[0]) &&
12
+ value[1] === "BETWEEN" &&
13
+ (0, index_js_1.isOperandInput)(value[2]) &&
14
+ value[3] === "AND" &&
15
+ (0, index_js_1.isOperandInput)(value[4]));
10
16
  }
11
17
  exports.Between = {
12
18
  /**
13
- * Returns a condition that uses the `BETWEEN` operator.
19
+ * Returns a comparison that uses the `BETWEEN` operator.
14
20
  *
15
- * Both bounds are inclusive, meaning that the returned condition corresponds to `lower <= lhs <= upper`.
21
+ * Both bounds are inclusive.
16
22
  *
17
23
  * @param input - The parameters of the `BETWEEN` comparison. The first element contains the left-hand side operand,
18
24
  * the third element contains the lower inclusive bound, and the fifth element contains the upper inclusive bound.
@@ -22,9 +28,9 @@ exports.Between = {
22
28
  * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
23
29
  */
24
30
  from(input) {
25
- const lhs = operand_js_1.ConditionOperand.normalize(input[0]);
26
- const lower = operand_js_1.ConditionOperand.normalize(input[2]);
27
- const upper = operand_js_1.ConditionOperand.normalize(input[4]);
31
+ const lhs = index_js_1.Operand.normalize(input[0]);
32
+ const lower = index_js_1.Operand.normalize(input[2]);
33
+ const upper = index_js_1.Operand.normalize(input[4]);
28
34
  return (0, types_1.trusted)(formatter_js_1.ExpressionFormatter.from(({ names, values }) => `${lhs.format({ names, values })} BETWEEN ${lower.format({ names, values })} AND ${upper.format({ names, values })}`));
29
35
  },
30
36
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"between.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/between.ts"],"names":[],"mappings":";;;AAaA,wCAYC;AAzBD,+CAAwE;AACxE,kDAAsD;AACtD,mDAI8B;AAO9B,SAAgB,cAAc,CAE5B,KAAc;IACd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS;QACtB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK;QAClB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAMY,QAAA,OAAO,GAAG;IACrB;;;;;;;;;;;OAWG;IACH,IAAI,CAGF,KAAuB;QACvB,MAAM,GAAG,GAAG,kBAAO,CAAC,SAAS,CAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,kBAAO,CAAC,SAAS,CAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,kBAAO,CAAC,SAAS,CAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3D,OAAO,IAAA,eAAO,EACZ,kCAAmB,CAAC,IAAI,CACtB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CACpB,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,YAAY,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,QAAQ,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CACvH,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { AttributeValue } from "../../../types.js";
2
+ import { ExpressionFormatter } from "../formatter.js";
3
+ import { type OperandInput } from "../operands/index.js";
4
+ export declare function binaryOperation<OI extends OperandInput<AttributeValue>>(params: [OI, string, OI]): ExpressionFormatter;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.binaryOperation = binaryOperation;
4
- const formatter_js_1 = require("../../formatter.js");
5
- const operand_js_1 = require("../operand.js");
4
+ const formatter_js_1 = require("../formatter.js");
5
+ const index_js_1 = require("../operands/index.js");
6
6
  function binaryOperation(params) {
7
- const lhs = operand_js_1.ConditionOperand.normalize(params[0]);
8
- const rhs = operand_js_1.ConditionOperand.normalize(params[2]);
7
+ const lhs = index_js_1.Operand.normalize(params[0]);
8
+ const rhs = index_js_1.Operand.normalize(params[2]);
9
9
  return formatter_js_1.ExpressionFormatter.from(({ names, values }) => `${lhs.format({ names, values })} ${params[1]} ${rhs.format({ names, values })}`);
10
10
  }
11
11
  //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/binary.ts"],"names":[],"mappings":";;AAIA,0CAUC;AAbD,kDAAsD;AACtD,mDAAkE;AAElE,SAAgB,eAAe,CAC7B,MAAwB;IAExB,MAAM,GAAG,GAAG,kBAAO,CAAC,SAAS,CAAiB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,kBAAO,CAAC,SAAS,CAAiB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzD,OAAO,kCAAmB,CAAC,IAAI,CAC7B,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CACpB,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CACnF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { NativeBinary, NativeNumber, NativeString } from "../../../types.js";
2
+ import type { Operand, OperandInput } from "../operands/operand.js";
3
+ export type ComparableValue = NativeBinary | NativeNumber | NativeString;
4
+ export type ComparableOperandInput = OperandInput<ComparableValue>;
5
+ export type ComparableOperand = Operand<ComparableValue>;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=operand.js.map
3
+ //# sourceMappingURL=comparable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparable.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/comparable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import type { AttributeValue } from "../../../types.js";
3
+ import type { ExpressionFormatter } from "../formatter.js";
4
+ import { type Operand, type OperandInput } from "../operands/index.js";
5
+ export type EqualsInput<OI extends OperandInput<AttributeValue> = OperandInput<AttributeValue>> = [OI, "=", OI];
6
+ export declare function isEqualsInput<OI extends OperandInput<AttributeValue> = OperandInput<AttributeValue>>(value: unknown): value is EqualsInput<OI>;
7
+ export type Equals<O extends Operand<AttributeValue> = Operand<AttributeValue>> = ExpressionFormatter & Brand<"Equals"> & Phantom<O>;
8
+ export declare const Equals: {
9
+ /**
10
+ * Returns a condition that uses the `=` operator.
11
+ *
12
+ * @param input - The parameters of the `=` comparison. The first element contains the left-hand side operand,
13
+ * and the third element contains the right-hand side operand.
14
+ *
15
+ * @returns An {@link Equals} that evaluates to true if this operand is equal to the provided one.
16
+ *
17
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
18
+ */
19
+ from<O extends Operand<AttributeValue>, OI extends OperandInput<AttributeValue>>(input: EqualsInput<OI>): Equals<O>;
20
+ };
@@ -3,7 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Equals = void 0;
4
4
  exports.isEqualsInput = isEqualsInput;
5
5
  const types_1 = require("@infra-blocks/types");
6
+ const index_js_1 = require("../operands/index.js");
6
7
  const binary_js_1 = require("./binary.js");
8
+ function isEqualsInput(value) {
9
+ return (Array.isArray(value) &&
10
+ value.length === 3 &&
11
+ (0, index_js_1.isOperandInput)(value[0]) &&
12
+ value[1] === "=" &&
13
+ (0, index_js_1.isOperandInput)(value[1]));
14
+ }
7
15
  exports.Equals = {
8
16
  /**
9
17
  * Returns a condition that uses the `=` operator.
@@ -19,7 +27,4 @@ exports.Equals = {
19
27
  return (0, types_1.trusted)((0, binary_js_1.binaryOperation)(input));
20
28
  },
21
29
  };
22
- function isEqualsInput(value) {
23
- return value[1] === "=";
24
- }
25
30
  //# sourceMappingURL=equals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equals.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/equals.ts"],"names":[],"mappings":";;;AAcA,sCAUC;AAxBD,+CAAwE;AAGxE,mDAI8B;AAC9B,2CAA8C;AAM9C,SAAgB,aAAa,CAE3B,KAAc;IACd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG;QAChB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAMY,QAAA,MAAM,GAAG;IACpB;;;;;;;;;OASG;IACH,IAAI,CAGF,KAAsB;QACtB,OAAO,IAAA,eAAO,EAAC,IAAA,2BAAe,EAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import type { ExpressionFormatter } from "../formatter.js";
3
+ import { type Operand, type OperandInput } from "../operands/index.js";
4
+ import type { ComparableValue } from "./comparable.js";
5
+ export type GreaterThanOrEqualsInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>> = [OI, ">=", OI];
6
+ export declare function isGreaterThanOrEqualsInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>>(value: unknown): value is GreaterThanOrEqualsInput<OI>;
7
+ export type GreaterThanOrEquals<O extends Operand<ComparableValue> = Operand<ComparableValue>> = ExpressionFormatter & Brand<"GreaterThanOrEquals"> & Phantom<O>;
8
+ export declare const GreaterThanOrEquals: {
9
+ /**
10
+ * Returns a condition that uses the `>=` operator.
11
+ *
12
+ * @param input - The parameters of the `>=` comparison. The first element contains the left-hand side operand,
13
+ * the third element contains the right-hand side operand.
14
+ *
15
+ * @returns A {@link GreaterThanOrEquals} that evaluates to true if this operand is greater than or equal to the provided one.
16
+ *
17
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
18
+ */
19
+ from<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>, O extends Operand<ComparableValue> = Operand<ComparableValue>>(input: GreaterThanOrEqualsInput<OI>): GreaterThanOrEquals<O>;
20
+ };
@@ -3,7 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GreaterThanOrEquals = void 0;
4
4
  exports.isGreaterThanOrEqualsInput = isGreaterThanOrEqualsInput;
5
5
  const types_1 = require("@infra-blocks/types");
6
+ const index_js_1 = require("../operands/index.js");
6
7
  const binary_js_1 = require("./binary.js");
8
+ function isGreaterThanOrEqualsInput(value) {
9
+ return (Array.isArray(value) &&
10
+ value.length === 3 &&
11
+ (0, index_js_1.isOperandInput)(value[0]) &&
12
+ value[1] === ">=" &&
13
+ (0, index_js_1.isOperandInput)(value[1]));
14
+ }
7
15
  exports.GreaterThanOrEquals = {
8
16
  /**
9
17
  * Returns a condition that uses the `>=` operator.
@@ -19,7 +27,4 @@ exports.GreaterThanOrEquals = {
19
27
  return (0, types_1.trusted)((0, binary_js_1.binaryOperation)(input));
20
28
  },
21
29
  };
22
- function isGreaterThanOrEqualsInput(value) {
23
- return value[1] === ">=";
24
- }
25
30
  //# sourceMappingURL=greater-than-or-equals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"greater-than-or-equals.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/greater-than-or-equals.ts"],"names":[],"mappings":";;;AAcA,gEAUC;AAxBD,+CAAwE;AAExE,mDAI8B;AAC9B,2CAA8C;AAO9C,SAAgB,0BAA0B,CAExC,KAAc;IACd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;QACjB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAMY,QAAA,mBAAmB,GAAG;IACjC;;;;;;;;;OASG;IACH,IAAI,CAGF,KAAmC;QACnC,OAAO,IAAA,eAAO,EAAC,IAAA,2BAAe,EAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import type { ExpressionFormatter } from "../formatter.js";
3
+ import { type Operand, type OperandInput } from "../operands/index.js";
4
+ import type { ComparableValue } from "./comparable.js";
5
+ export type GreaterThanInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>> = [OI, ">", OI];
6
+ export declare function isGreaterThanInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>>(value: unknown): value is GreaterThanInput<OI>;
7
+ export type GreaterThan<O extends Operand<ComparableValue> = Operand<ComparableValue>> = ExpressionFormatter & Brand<"GreaterThan"> & Phantom<O>;
8
+ export declare const GreaterThan: {
9
+ /**
10
+ * Returns a condition that uses the `>` operator.
11
+ *
12
+ * @param input - The parameters of the `>` comparison. The first element contains the left-hand side operand,
13
+ * the third element contains the right-hand side operand.
14
+ *
15
+ * @returns A {@link GreaterThan} that evaluates to true if this operand is greater than or equal to the provided one.
16
+ *
17
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
18
+ */
19
+ from<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>, O extends Operand<ComparableValue> = Operand<ComparableValue>>(input: GreaterThanInput<OI>): GreaterThan<O>;
20
+ };
@@ -1,17 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GreatThan = void 0;
3
+ exports.GreaterThan = void 0;
4
4
  exports.isGreaterThanInput = isGreaterThanInput;
5
5
  const types_1 = require("@infra-blocks/types");
6
+ const index_js_1 = require("../operands/index.js");
6
7
  const binary_js_1 = require("./binary.js");
7
- exports.GreatThan = {
8
+ function isGreaterThanInput(value) {
9
+ return (Array.isArray(value) &&
10
+ value.length === 3 &&
11
+ (0, index_js_1.isOperandInput)(value[0]) &&
12
+ value[1] === ">" &&
13
+ (0, index_js_1.isOperandInput)(value[1]));
14
+ }
15
+ exports.GreaterThan = {
8
16
  /**
9
17
  * Returns a condition that uses the `>` operator.
10
18
  *
11
19
  * @param input - The parameters of the `>` comparison. The first element contains the left-hand side operand,
12
20
  * the third element contains the right-hand side operand.
13
21
  *
14
- * @returns A {@link GreaterThan} that evaluates to true if this operand is greater than the provided one.
22
+ * @returns A {@link GreaterThan} that evaluates to true if this operand is greater than or equal to the provided one.
15
23
  *
16
24
  * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
17
25
  */
@@ -19,7 +27,4 @@ exports.GreatThan = {
19
27
  return (0, types_1.trusted)((0, binary_js_1.binaryOperation)(input));
20
28
  },
21
29
  };
22
- function isGreaterThanInput(value) {
23
- return value[1] === ">";
24
- }
25
30
  //# sourceMappingURL=greater-than.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"greater-than.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/greater-than.ts"],"names":[],"mappings":";;;AAcA,gDAUC;AAxBD,+CAAwE;AAExE,mDAI8B;AAC9B,2CAA8C;AAO9C,SAAgB,kBAAkB,CAEhC,KAAc;IACd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG;QAChB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAMY,QAAA,WAAW,GAAG;IACzB;;;;;;;;;OASG;IACH,IAAI,CAGF,KAA2B;QAC3B,OAAO,IAAA,eAAO,EAAC,IAAA,2BAAe,EAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import { ExpressionFormatter } from "../formatter.js";
3
+ import { Operand, type OperandInput } from "../operands/operand.js";
4
+ import type { ComparableValue } from "./comparable.js";
5
+ export type InInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>> = [OI, "IN", OI[]];
6
+ export declare function isInInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>>(value: unknown): value is InInput<OI>;
7
+ export type In<O extends Operand<ComparableValue> = Operand<ComparableValue>> = ExpressionFormatter & Brand<"In"> & Phantom<O>;
8
+ export declare const In: {
9
+ /**
10
+ * Returns a condition that uses the `IN` operator.
11
+ *
12
+ * This function throws if the list of elements to compared against is empty or exceeds 100 elements.
13
+ *
14
+ * @param input - The parameters of the `IN` comparison. The first element contains the left-hand side operand,
15
+ * the third element contains the list of elements to compare against.
16
+ *
17
+ * @returns An {@link In} that evaluates to true if this operand is equal to any of the provided ones.
18
+ *
19
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
20
+ */
21
+ from<O extends Operand<ComparableValue> = Operand<ComparableValue>, OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>>(input: InInput<OI>): In<O>;
22
+ };
@@ -3,8 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.In = void 0;
4
4
  exports.isInInput = isInInput;
5
5
  const types_1 = require("@infra-blocks/types");
6
- const formatter_js_1 = require("../../formatter.js");
7
- const operand_js_1 = require("../operand.js");
6
+ const formatter_js_1 = require("../formatter.js");
7
+ const operand_js_1 = require("../operands/operand.js");
8
+ function isInInput(value) {
9
+ return (Array.isArray(value) &&
10
+ value.length === 3 &&
11
+ (0, operand_js_1.isOperandInput)(value[0]) &&
12
+ value[1] === "IN" &&
13
+ (0, operand_js_1.isOperandInput)(value[1]));
14
+ }
8
15
  exports.In = {
9
16
  /**
10
17
  * Returns a condition that uses the `IN` operator.
@@ -21,22 +28,18 @@ exports.In = {
21
28
  from(input) {
22
29
  // TODO: unit test those limits
23
30
  if (input[2].length === 0) {
24
- throw new Error("the IN operator requires at least one operand.");
31
+ throw new Error("the IN operator requires at least one value in rhs operand.");
25
32
  }
26
33
  if (input[2].length > 100) {
27
- throw new Error(`up to 100 operands are support for the IN operator, got ${input[2].length}`);
34
+ throw new Error(`up to 100 values are support for the rhs operand of the IN operator, got ${input[2].length}`);
28
35
  }
29
- const element = operand_js_1.ConditionOperand.normalize(input[0]);
30
- const elements = input[2].map((operand_js_1.ConditionOperand.normalize));
36
+ const element = operand_js_1.Operand.normalize(input[0]);
37
+ const elements = input[2].map((operand_js_1.Operand.normalize));
31
38
  return (0, types_1.trusted)(formatter_js_1.ExpressionFormatter.from(({ names, values }) => {
32
- const elementsString = elements
39
+ return `${element.format({ names, values })} IN (${elements
33
40
  .map((operand) => operand.format({ names, values }))
34
- .join(",");
35
- return `${element.format({ names, values })} IN (${elementsString})`;
41
+ .join(",")})`;
36
42
  }));
37
43
  },
38
44
  };
39
- function isInInput(value) {
40
- return value[1] === "IN";
41
- }
42
45
  //# sourceMappingURL=in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/in.ts"],"names":[],"mappings":";;;AAaA,8BAUC;AAvBD,+CAAwE;AACxE,kDAAsD;AACtD,uDAIgC;AAOhC,SAAgB,SAAS,CAEvB,KAAc;IACd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,IAAA,2BAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;QACjB,IAAA,2BAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAKY,QAAA,EAAE,GAAG;IAChB;;;;;;;;;;;OAWG;IACH,IAAI,CAGF,KAAkB;QAClB,+BAA+B;QAC/B,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,4EAA4E,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAC9F,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,oBAAO,CAAC,SAAS,CAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA,oBAAO,CAAC,SAA0B,CAAA,CAAC,CAAC;QAClE,OAAO,IAAA,eAAO,EACZ,kCAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;YAC7C,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,QAAQ,QAAQ;iBACxD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;iBACnD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAClB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { Between, type BetweenInput } from "./between.js";
2
+ import { Equals, type EqualsInput } from "./equals.js";
3
+ import { GreaterThan, type GreaterThanInput } from "./greater-than.js";
4
+ import { GreaterThanOrEquals, type GreaterThanOrEqualsInput } from "./greater-than-or-equals.js";
5
+ import { In, type InInput } from "./in.js";
6
+ import { LowerThan, type LowerThanInput } from "./lower-than.js";
7
+ import { LowerThanOrEquals, type LowerThanOrEqualsInput } from "./lower-than-or-equals.js";
8
+ import { NotEquals, type NotEqualsInput } from "./not-equals.js";
9
+ export * from "./between.js";
10
+ export * from "./comparable.js";
11
+ export * from "./equals.js";
12
+ export * from "./greater-than.js";
13
+ export * from "./greater-than-or-equals.js";
14
+ export * from "./in.js";
15
+ export * from "./lower-than.js";
16
+ export * from "./lower-than-or-equals.js";
17
+ export * from "./not-equals.js";
18
+ /**
19
+ * A type aggregating anything that can be turned into a comparison.
20
+ */
21
+ export type ComparisonInput = BetweenInput | EqualsInput | GreaterThanInput | GreaterThanOrEqualsInput | InInput | LowerThanInput | LowerThanOrEqualsInput | NotEqualsInput;
22
+ export declare function isComparisonInput(value: unknown): value is ComparisonInput;
23
+ /**
24
+ * A type aggregating all comparisons.
25
+ */
26
+ export type Comparison = Between | Equals | GreaterThan | GreaterThanOrEquals | In | LowerThan | LowerThanOrEquals | NotEquals;
27
+ export declare const Comparison: {
28
+ from(input: ComparisonInput): Comparison;
29
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Comparison = void 0;
18
+ exports.isComparisonInput = isComparisonInput;
19
+ const types_1 = require("@infra-blocks/types");
20
+ const between_js_1 = require("./between.js");
21
+ const equals_js_1 = require("./equals.js");
22
+ const greater_than_js_1 = require("./greater-than.js");
23
+ const greater_than_or_equals_js_1 = require("./greater-than-or-equals.js");
24
+ const in_js_1 = require("./in.js");
25
+ const lower_than_js_1 = require("./lower-than.js");
26
+ const lower_than_or_equals_js_1 = require("./lower-than-or-equals.js");
27
+ const not_equals_js_1 = require("./not-equals.js");
28
+ __exportStar(require("./between.js"), exports);
29
+ __exportStar(require("./comparable.js"), exports);
30
+ __exportStar(require("./equals.js"), exports);
31
+ __exportStar(require("./greater-than.js"), exports);
32
+ __exportStar(require("./greater-than-or-equals.js"), exports);
33
+ __exportStar(require("./in.js"), exports);
34
+ __exportStar(require("./lower-than.js"), exports);
35
+ __exportStar(require("./lower-than-or-equals.js"), exports);
36
+ __exportStar(require("./not-equals.js"), exports);
37
+ function isComparisonInput(value) {
38
+ return ((0, between_js_1.isBetweenInput)(value) ||
39
+ (0, equals_js_1.isEqualsInput)(value) ||
40
+ (0, greater_than_js_1.isGreaterThanInput)(value) ||
41
+ (0, greater_than_or_equals_js_1.isGreaterThanOrEqualsInput)(value) ||
42
+ (0, in_js_1.isInInput)(value) ||
43
+ (0, lower_than_js_1.isLowerThanInput)(value) ||
44
+ (0, lower_than_or_equals_js_1.isLowerThanOrEqualsInput)(value) ||
45
+ (0, not_equals_js_1.isNotEqualsInput)(value));
46
+ }
47
+ exports.Comparison = {
48
+ from(input) {
49
+ if ((0, between_js_1.isBetweenInput)(input)) {
50
+ return between_js_1.Between.from(input);
51
+ }
52
+ if ((0, equals_js_1.isEqualsInput)(input)) {
53
+ return equals_js_1.Equals.from(input);
54
+ }
55
+ if ((0, greater_than_js_1.isGreaterThanInput)(input)) {
56
+ return greater_than_js_1.GreaterThan.from(input);
57
+ }
58
+ if ((0, greater_than_or_equals_js_1.isGreaterThanOrEqualsInput)(input)) {
59
+ return greater_than_or_equals_js_1.GreaterThanOrEquals.from(input);
60
+ }
61
+ if ((0, in_js_1.isInInput)(input)) {
62
+ return in_js_1.In.from(input);
63
+ }
64
+ if ((0, lower_than_js_1.isLowerThanInput)(input)) {
65
+ return lower_than_js_1.LowerThan.from(input);
66
+ }
67
+ if ((0, lower_than_or_equals_js_1.isLowerThanOrEqualsInput)(input)) {
68
+ return lower_than_or_equals_js_1.LowerThanOrEquals.from(input);
69
+ }
70
+ if ((0, not_equals_js_1.isNotEqualsInput)(input)) {
71
+ return not_equals_js_1.NotEquals.from(input);
72
+ }
73
+ (0, types_1.unreachable)(input);
74
+ },
75
+ };
76
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAsDA,8CAWC;AAjED,+CAAkD;AAClD,6CAA0E;AAC1E,2CAAsE;AACtE,uDAI2B;AAC3B,2EAIqC;AACrC,mCAAsD;AACtD,mDAIyB;AACzB,uEAImC;AACnC,mDAIyB;AAEzB,+CAA6B;AAC7B,kDAAgC;AAChC,8CAA4B;AAC5B,oDAAkC;AAClC,8DAA4C;AAC5C,0CAAwB;AACxB,kDAAgC;AAChC,4DAA0C;AAC1C,kDAAgC;AAgBhC,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,IAAA,2BAAc,EAAC,KAAK,CAAC;QACrB,IAAA,yBAAa,EAAC,KAAK,CAAC;QACpB,IAAA,oCAAkB,EAAC,KAAK,CAAC;QACzB,IAAA,sDAA0B,EAAC,KAAK,CAAC;QACjC,IAAA,iBAAS,EAAC,KAAK,CAAC;QAChB,IAAA,gCAAgB,EAAC,KAAK,CAAC;QACvB,IAAA,kDAAwB,EAAC,KAAK,CAAC;QAC/B,IAAA,gCAAgB,EAAC,KAAK,CAAC,CACxB,CAAC;AACJ,CAAC;AAeY,QAAA,UAAU,GAAG;IACxB,IAAI,CAAC,KAAsB;QACzB,IAAI,IAAA,2BAAc,EAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,oBAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,IAAA,yBAAa,EAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,kBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;QACD,IAAI,IAAA,oCAAkB,EAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,6BAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,IAAA,sDAA0B,EAAC,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,+CAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,IAAA,iBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,UAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,yBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,IAAA,kDAAwB,EAAC,KAAK,CAAC,EAAE,CAAC;YACpC,OAAO,2CAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,yBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC;IACrB,CAAC;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import type { ExpressionFormatter } from "../formatter.js";
3
+ import { type Operand, type OperandInput } from "../operands/index.js";
4
+ import type { ComparableValue } from "./comparable.js";
5
+ export type LowerThanOrEqualsInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>> = [OI, "<=", OI];
6
+ export declare function isLowerThanOrEqualsInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>>(value: unknown): value is LowerThanOrEqualsInput<OI>;
7
+ export type LowerThanOrEquals<O extends Operand<ComparableValue> = Operand<ComparableValue>> = ExpressionFormatter & Brand<"LowerThanOrEquals"> & Phantom<O>;
8
+ export declare const LowerThanOrEquals: {
9
+ /**
10
+ * Returns a condition that uses the `>` operator.
11
+ *
12
+ * @param input - The parameters of the `>` comparison. The first element contains the left-hand side operand,
13
+ * the third element contains the right-hand side operand.
14
+ *
15
+ * @returns A {@link LowerThanOrEquals} that evaluates to true if this operand is lower than or equal to the provided one.
16
+ *
17
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
18
+ */
19
+ from<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>, O extends Operand<ComparableValue> = Operand<ComparableValue>>(input: LowerThanOrEqualsInput<OI>): LowerThanOrEquals<O>;
20
+ };
@@ -3,12 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LowerThanOrEquals = void 0;
4
4
  exports.isLowerThanOrEqualsInput = isLowerThanOrEqualsInput;
5
5
  const types_1 = require("@infra-blocks/types");
6
+ const index_js_1 = require("../operands/index.js");
6
7
  const binary_js_1 = require("./binary.js");
8
+ function isLowerThanOrEqualsInput(value) {
9
+ return (Array.isArray(value) &&
10
+ value.length === 3 &&
11
+ (0, index_js_1.isOperandInput)(value[0]) &&
12
+ value[1] === "<=" &&
13
+ (0, index_js_1.isOperandInput)(value[1]));
14
+ }
7
15
  exports.LowerThanOrEquals = {
8
16
  /**
9
- * Returns a condition that uses the `<=` operator.
17
+ * Returns a condition that uses the `>` operator.
10
18
  *
11
- * @param input - The parameters of the `<=` comparison. The first element contains the left-hand side operand,
19
+ * @param input - The parameters of the `>` comparison. The first element contains the left-hand side operand,
12
20
  * the third element contains the right-hand side operand.
13
21
  *
14
22
  * @returns A {@link LowerThanOrEquals} that evaluates to true if this operand is lower than or equal to the provided one.
@@ -19,7 +27,4 @@ exports.LowerThanOrEquals = {
19
27
  return (0, types_1.trusted)((0, binary_js_1.binaryOperation)(input));
20
28
  },
21
29
  };
22
- function isLowerThanOrEqualsInput(value) {
23
- return value[1] === "<=";
24
- }
25
30
  //# sourceMappingURL=lower-than-or-equals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lower-than-or-equals.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/lower-than-or-equals.ts"],"names":[],"mappings":";;;AAcA,4DAUC;AAxBD,+CAAwE;AAExE,mDAI8B;AAC9B,2CAA8C;AAO9C,SAAgB,wBAAwB,CAEtC,KAAc;IACd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;QACjB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAMY,QAAA,iBAAiB,GAAG;IAC/B;;;;;;;;;OASG;IACH,IAAI,CAGF,KAAiC;QACjC,OAAO,IAAA,eAAO,EAAC,IAAA,2BAAe,EAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import type { ExpressionFormatter } from "../formatter.js";
3
+ import { type Operand, type OperandInput } from "../operands/index.js";
4
+ import type { ComparableValue } from "./comparable.js";
5
+ export type LowerThanInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>> = [OI, "<", OI];
6
+ export declare function isLowerThanInput<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>>(value: unknown): value is LowerThanInput<OI>;
7
+ export type LowerThan<O extends Operand<ComparableValue> = Operand<ComparableValue>> = ExpressionFormatter & Brand<"LowerThan"> & Phantom<O>;
8
+ export declare const LowerThan: {
9
+ /**
10
+ * Returns a condition that uses the `>` operator.
11
+ *
12
+ * @param input - The parameters of the `>` comparison. The first element contains the left-hand side operand,
13
+ * the third element contains the right-hand side operand.
14
+ *
15
+ * @returns A {@link LowerThan} that evaluates to true if this operand is lower than or equal to the provided one.
16
+ *
17
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
18
+ */
19
+ from<OI extends OperandInput<ComparableValue> = OperandInput<ComparableValue>, O extends Operand<ComparableValue> = Operand<ComparableValue>>(input: LowerThanInput<OI>): LowerThan<O>;
20
+ };
@@ -3,15 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LowerThan = void 0;
4
4
  exports.isLowerThanInput = isLowerThanInput;
5
5
  const types_1 = require("@infra-blocks/types");
6
+ const index_js_1 = require("../operands/index.js");
6
7
  const binary_js_1 = require("./binary.js");
8
+ function isLowerThanInput(value) {
9
+ return (Array.isArray(value) &&
10
+ value.length === 3 &&
11
+ (0, index_js_1.isOperandInput)(value[0]) &&
12
+ value[1] === "<" &&
13
+ (0, index_js_1.isOperandInput)(value[1]));
14
+ }
7
15
  exports.LowerThan = {
8
16
  /**
9
- * Returns a condition that uses the `<` operator
17
+ * Returns a condition that uses the `>` operator.
10
18
  *
11
- * @param input - The parameters of the `<` comparison. The first element contains the left-hand side operand,
19
+ * @param input - The parameters of the `>` comparison. The first element contains the left-hand side operand,
12
20
  * the third element contains the right-hand side operand.
13
21
  *
14
- * @returns A {@link LowerThan} that evaluates to true if this operand is lower than the provided one.
22
+ * @returns A {@link LowerThan} that evaluates to true if this operand is lower than or equal to the provided one.
15
23
  *
16
24
  * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
17
25
  */
@@ -19,7 +27,4 @@ exports.LowerThan = {
19
27
  return (0, types_1.trusted)((0, binary_js_1.binaryOperation)(input));
20
28
  },
21
29
  };
22
- function isLowerThanInput(value) {
23
- return value[1] === "<";
24
- }
25
30
  //# sourceMappingURL=lower-than.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lower-than.js","sourceRoot":"","sources":["../../../../../src/commands/expressions/comparisons/lower-than.ts"],"names":[],"mappings":";;;AAcA,4CAUC;AAxBD,+CAAwE;AAExE,mDAI8B;AAC9B,2CAA8C;AAO9C,SAAgB,gBAAgB,CAE9B,KAAc;IACd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG;QAChB,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAMY,QAAA,SAAS,GAAG;IACvB;;;;;;;;;OASG;IACH,IAAI,CAGF,KAAyB;QACzB,OAAO,IAAA,eAAO,EAAC,IAAA,2BAAe,EAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type Brand, type Phantom } from "@infra-blocks/types";
2
+ import type { AttributeValue } from "../../../types.js";
3
+ import type { ExpressionFormatter } from "../formatter.js";
4
+ import { type Operand, type OperandInput } from "../operands/index.js";
5
+ export type NotEqualsInput<OI extends OperandInput<AttributeValue> = OperandInput<AttributeValue>> = [OI, "<>", OI];
6
+ export declare function isNotEqualsInput<OI extends OperandInput<AttributeValue> = OperandInput<AttributeValue>>(value: unknown): value is NotEqualsInput<OI>;
7
+ export type NotEquals<O extends Operand<AttributeValue> = Operand<AttributeValue>> = ExpressionFormatter & Brand<"NotEquals"> & Phantom<O>;
8
+ export declare const NotEquals: {
9
+ /**
10
+ * Returns a condition that uses the `=` operator.
11
+ *
12
+ * @param input - The parameters of the `=` comparison. The first element contains the left-hand side operand,
13
+ * and the third element contains the right-hand side operand.
14
+ *
15
+ * @returns An {@link NotEquals} that evaluates to true if this operand is equal to the provided one.
16
+ *
17
+ * @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
18
+ */
19
+ from<O extends Operand<AttributeValue>, OI extends OperandInput<AttributeValue>>(input: NotEqualsInput<OI>): NotEquals<O>;
20
+ };