@infra-blocks/aws-dynamodb 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/commands/attributes/index.d.ts +2 -0
- package/lib/cjs/commands/attributes/index.js +19 -0
- package/lib/cjs/commands/attributes/index.js.map +1 -0
- package/lib/cjs/commands/attributes/names.d.ts +4 -4
- package/lib/cjs/commands/attributes/names.js.map +1 -1
- package/lib/cjs/commands/attributes/values.d.ts +6 -3
- package/lib/cjs/commands/attributes/values.js.map +1 -1
- package/lib/cjs/commands/expressions/condition/comparisons.d.ts +22 -0
- package/lib/cjs/commands/expressions/condition/comparisons.js +204 -0
- package/lib/cjs/commands/expressions/condition/comparisons.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/condition.d.ts +24 -0
- package/lib/cjs/commands/expressions/condition/condition.js +27 -0
- package/lib/cjs/commands/expressions/condition/condition.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/expression.d.ts +19 -0
- package/lib/cjs/commands/expressions/condition/expression.js +28 -0
- package/lib/cjs/commands/expressions/condition/expression.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/functions.d.ts +70 -0
- package/lib/cjs/commands/expressions/condition/functions.js +80 -0
- package/lib/cjs/commands/expressions/condition/functions.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/index.d.ts +5 -0
- package/lib/cjs/commands/expressions/condition/index.js +21 -0
- package/lib/cjs/commands/expressions/condition/index.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/logic.d.ts +34 -0
- package/lib/cjs/commands/expressions/condition/logic.js +68 -0
- package/lib/cjs/commands/expressions/condition/logic.js.map +1 -0
- package/lib/cjs/commands/expressions/condition/size.d.ts +37 -0
- package/lib/cjs/commands/expressions/condition/size.js +35 -0
- package/lib/cjs/commands/expressions/condition/size.js.map +1 -0
- package/lib/cjs/commands/expressions/expression.d.ts +4 -0
- package/lib/cjs/commands/expressions/index.d.ts +1 -1
- package/lib/cjs/commands/expressions/index.js +1 -1
- package/lib/cjs/commands/expressions/index.js.map +1 -1
- package/lib/cjs/commands/expressions/key-condition.d.ts +2 -2
- package/lib/cjs/commands/expressions/operands/index.d.ts +1 -1
- package/lib/cjs/commands/expressions/operands/index.js +1 -1
- package/lib/cjs/commands/expressions/operands/{name.js → path.js} +1 -1
- package/lib/cjs/commands/expressions/operands/{name.js.map → path.js.map} +1 -1
- package/lib/cjs/commands/expressions/operands/type.d.ts +1 -1
- package/lib/cjs/commands/expressions/operands/value.js +0 -1
- package/lib/cjs/commands/expressions/operands/value.js.map +1 -1
- package/lib/cjs/commands/expressions/update/add.d.ts +1 -1
- package/lib/cjs/commands/expressions/update/delete.d.ts +1 -1
- package/lib/cjs/commands/expressions/update/if-not-exists.d.ts +1 -1
- package/lib/cjs/commands/expressions/update/remove.d.ts +1 -1
- package/lib/cjs/commands/expressions/update/set.d.ts +1 -1
- package/lib/cjs/commands/put-item.d.ts +2 -2
- package/lib/cjs/commands/put-item.js +5 -1
- package/lib/cjs/commands/put-item.js.map +1 -1
- package/lib/cjs/commands/query.js +5 -1
- package/lib/cjs/commands/query.js.map +1 -1
- package/lib/cjs/commands/update-item.d.ts +2 -2
- package/lib/cjs/commands/update-item.js +5 -1
- package/lib/cjs/commands/update-item.js.map +1 -1
- package/lib/cjs/types.d.ts +3 -2
- package/lib/cjs/types.js +13 -0
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/commands/attributes/index.d.ts +2 -0
- package/lib/esm/commands/attributes/index.js +3 -0
- package/lib/esm/commands/attributes/index.js.map +1 -0
- package/lib/esm/commands/attributes/names.d.ts +4 -4
- package/lib/esm/commands/attributes/names.js.map +1 -1
- package/lib/esm/commands/attributes/values.d.ts +6 -3
- package/lib/esm/commands/attributes/values.js.map +1 -1
- package/lib/esm/commands/expressions/condition/comparisons.d.ts +22 -0
- package/lib/esm/commands/expressions/condition/comparisons.js +200 -0
- package/lib/esm/commands/expressions/condition/comparisons.js.map +1 -0
- package/lib/esm/commands/expressions/condition/condition.d.ts +24 -0
- package/lib/esm/commands/expressions/condition/condition.js +22 -0
- package/lib/esm/commands/expressions/condition/condition.js.map +1 -0
- package/lib/esm/commands/expressions/condition/expression.d.ts +19 -0
- package/lib/esm/commands/expressions/condition/expression.js +23 -0
- package/lib/esm/commands/expressions/condition/expression.js.map +1 -0
- package/lib/esm/commands/expressions/condition/functions.d.ts +70 -0
- package/lib/esm/commands/expressions/condition/functions.js +73 -0
- package/lib/esm/commands/expressions/condition/functions.js.map +1 -0
- package/lib/esm/commands/expressions/condition/index.d.ts +5 -0
- package/lib/esm/commands/expressions/condition/index.js +5 -0
- package/lib/esm/commands/expressions/condition/index.js.map +1 -0
- package/lib/esm/commands/expressions/condition/logic.d.ts +34 -0
- package/lib/esm/commands/expressions/condition/logic.js +63 -0
- package/lib/esm/commands/expressions/condition/logic.js.map +1 -0
- package/lib/esm/commands/expressions/condition/size.d.ts +37 -0
- package/lib/esm/commands/expressions/condition/size.js +30 -0
- package/lib/esm/commands/expressions/condition/size.js.map +1 -0
- package/lib/esm/commands/expressions/expression.d.ts +4 -0
- package/lib/esm/commands/expressions/index.d.ts +1 -1
- package/lib/esm/commands/expressions/index.js +1 -1
- package/lib/esm/commands/expressions/index.js.map +1 -1
- package/lib/esm/commands/expressions/key-condition.d.ts +2 -2
- package/lib/esm/commands/expressions/operands/index.d.ts +1 -1
- package/lib/esm/commands/expressions/operands/index.js +1 -1
- package/lib/esm/commands/expressions/operands/{name.js → path.js} +1 -1
- package/lib/esm/commands/expressions/operands/{name.js.map → path.js.map} +1 -1
- package/lib/esm/commands/expressions/operands/type.d.ts +1 -1
- package/lib/esm/commands/expressions/operands/value.js +0 -1
- package/lib/esm/commands/expressions/operands/value.js.map +1 -1
- package/lib/esm/commands/expressions/update/add.d.ts +1 -1
- package/lib/esm/commands/expressions/update/delete.d.ts +1 -1
- package/lib/esm/commands/expressions/update/if-not-exists.d.ts +1 -1
- package/lib/esm/commands/expressions/update/remove.d.ts +1 -1
- package/lib/esm/commands/expressions/update/set.d.ts +1 -1
- package/lib/esm/commands/put-item.d.ts +2 -2
- package/lib/esm/commands/put-item.js +5 -1
- package/lib/esm/commands/put-item.js.map +1 -1
- package/lib/esm/commands/query.js +5 -1
- package/lib/esm/commands/query.js.map +1 -1
- package/lib/esm/commands/update-item.d.ts +2 -2
- package/lib/esm/commands/update-item.js +5 -1
- package/lib/esm/commands/update-item.js.map +1 -1
- package/lib/esm/types.d.ts +3 -2
- package/lib/esm/types.js +12 -1
- package/lib/esm/types.js.map +1 -1
- package/package.json +2 -2
- package/lib/cjs/commands/expressions/condition.d.ts +0 -224
- package/lib/cjs/commands/expressions/condition.js +0 -360
- package/lib/cjs/commands/expressions/condition.js.map +0 -1
- package/lib/esm/commands/expressions/condition.d.ts +0 -224
- package/lib/esm/commands/expressions/condition.js +0 -350
- package/lib/esm/commands/expressions/condition.js.map +0 -1
- /package/lib/cjs/commands/expressions/operands/{name.d.ts → path.d.ts} +0 -0
- /package/lib/esm/commands/expressions/operands/{name.d.ts → path.d.ts} +0 -0
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SizeOperand = exports.AttributeConditionBuilder = exports.OperandConditionBuilder = exports.Condition = void 0;
|
|
4
|
-
exports.not = not;
|
|
5
|
-
exports.where = where;
|
|
6
|
-
exports.size = size;
|
|
7
|
-
const index_js_1 = require("./operands/index.js");
|
|
8
|
-
class Condition {
|
|
9
|
-
stringifier;
|
|
10
|
-
constructor(params) {
|
|
11
|
-
const { stringify } = params;
|
|
12
|
-
this.stringifier = stringify;
|
|
13
|
-
}
|
|
14
|
-
// TODO: exclude from exported type definitions if possible.
|
|
15
|
-
stringify(params) {
|
|
16
|
-
return this.stringifier(params);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Returns a condition that combines this one with the provided condition using the `AND` operator.
|
|
20
|
-
*
|
|
21
|
-
* @param other - The other condition to combine with this one.
|
|
22
|
-
*
|
|
23
|
-
* @returns A {@link Condition} that evaluates to true only if both conditions evaluate to true.
|
|
24
|
-
*
|
|
25
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.LogicalEvaluations
|
|
26
|
-
*/
|
|
27
|
-
and(other) {
|
|
28
|
-
return Condition.from({
|
|
29
|
-
stringify: ({ names, values }) => {
|
|
30
|
-
const left = this.stringify({ names, values });
|
|
31
|
-
const right = other.stringify({ names, values });
|
|
32
|
-
return `(${left} AND ${right})`;
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns a condition that combines this one with the provided condition using the `OR` operator.
|
|
38
|
-
*
|
|
39
|
-
* @param other - The other condition to combine with this one.
|
|
40
|
-
*
|
|
41
|
-
* @returns A {@link Condition} that evaluates to true if any conditions evaluate to true.
|
|
42
|
-
*
|
|
43
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.LogicalEvaluations
|
|
44
|
-
*/
|
|
45
|
-
or(other) {
|
|
46
|
-
return Condition.from({
|
|
47
|
-
stringify: ({ names, values }) => {
|
|
48
|
-
const left = this.stringify({ names, values });
|
|
49
|
-
const right = other.stringify({ names, values });
|
|
50
|
-
return `(${left} OR ${right})`;
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Factory method to create a new {@link Condition} instance.
|
|
56
|
-
*
|
|
57
|
-
* This is not meant to be called outside this package.
|
|
58
|
-
*
|
|
59
|
-
* @param params - The parameters to create the condition.
|
|
60
|
-
*
|
|
61
|
-
* @returns A new {@link Condition} instance.
|
|
62
|
-
*/
|
|
63
|
-
static from(params) {
|
|
64
|
-
return new Condition(params);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.Condition = Condition;
|
|
68
|
-
/**
|
|
69
|
-
* Negates the provided condition using the `NOT` operator.
|
|
70
|
-
*
|
|
71
|
-
* @param inner - The condition to negate.
|
|
72
|
-
*
|
|
73
|
-
* @returns A {@link Condition} that evaluates to the opposite of what the provided condition evaluates to.
|
|
74
|
-
*
|
|
75
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.LogicalEvaluations
|
|
76
|
-
*/
|
|
77
|
-
function not(inner) {
|
|
78
|
-
return Condition.from({
|
|
79
|
-
stringify: ({ names, values }) => {
|
|
80
|
-
return `NOT (${inner.stringify({ names, values })})`;
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
// NOTE: methods here means that both sides of the conditions can either be attribute names or attribute values.
|
|
85
|
-
class OperandConditionBuilder {
|
|
86
|
-
operand;
|
|
87
|
-
constructor(operand) {
|
|
88
|
-
this.operand = operand;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Returns a condition that uses the `begins_with` function.
|
|
92
|
-
*
|
|
93
|
-
* @param rhs - The right hand side operand.
|
|
94
|
-
*
|
|
95
|
-
* @returns A {@link Condition} that evaluates to true if this operand begins with the provided one.
|
|
96
|
-
*
|
|
97
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
98
|
-
*/
|
|
99
|
-
beginsWith(rhs) {
|
|
100
|
-
return Condition.from({
|
|
101
|
-
stringify: ({ names, values }) => {
|
|
102
|
-
return `begins_with(${this.substitute({ names, values })}, ${rhs.substitute({ names, values })})`;
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Returns a condition that uses the `BETWEEN` operator.
|
|
108
|
-
*
|
|
109
|
-
* Both bounds are inclusive, meaning that the returned condition corresponds to `lower <= this <= upper`.
|
|
110
|
-
*
|
|
111
|
-
* @param lower - The lower inclusive bound of the range.
|
|
112
|
-
* @param upper - The upper inclusive bound of the range.
|
|
113
|
-
*
|
|
114
|
-
* @returns A {@link Condition} that evaluates to true if this operand is within the provided bounds.
|
|
115
|
-
*
|
|
116
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
117
|
-
*/
|
|
118
|
-
// TODO: test with size operands.
|
|
119
|
-
between(lower, upper) {
|
|
120
|
-
return Condition.from({
|
|
121
|
-
stringify: ({ names, values }) => {
|
|
122
|
-
return `${this.substitute({ names, values })} BETWEEN ${lower.substitute({ names, values })} AND ${upper.substitute({ names, values })}`;
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Returns a condition that uses the `contains` function.
|
|
128
|
-
*
|
|
129
|
-
* @param rhs - The right hand side operand.
|
|
130
|
-
*
|
|
131
|
-
* @returns A {@link Condition} that evaluates to true if this operand contains the provided one.
|
|
132
|
-
*
|
|
133
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
134
|
-
*/
|
|
135
|
-
// TODO: test with size operands.
|
|
136
|
-
contains(rhs) {
|
|
137
|
-
return Condition.from({
|
|
138
|
-
stringify: ({ names, values }) => {
|
|
139
|
-
return `contains(${this.substitute({ names, values })}, ${rhs.substitute({ names, values })})`;
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Returns a condition that uses the `=` operator.
|
|
145
|
-
*
|
|
146
|
-
* @param rhs - The right hand side operand.
|
|
147
|
-
*
|
|
148
|
-
* @returns A {@link Condition} that evaluates to true if this operand is equal to the provided one.
|
|
149
|
-
*
|
|
150
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
151
|
-
*/
|
|
152
|
-
// TODO: this should be typed better once moved out. It accepts the interface only to make the tests compile.
|
|
153
|
-
equals(rhs) {
|
|
154
|
-
return Condition.from({
|
|
155
|
-
stringify: ({ names, values }) => {
|
|
156
|
-
return `${this.substitute({ names, values })} = ${rhs.substitute({ names, values })}`;
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* An alias for {@link equals}.
|
|
162
|
-
*/
|
|
163
|
-
eq = this.equals.bind(this);
|
|
164
|
-
/**
|
|
165
|
-
* Returns a condition that uses the `>` operator.
|
|
166
|
-
*
|
|
167
|
-
* @param rhs - The right hand side operand.
|
|
168
|
-
*
|
|
169
|
-
* @returns A {@link Condition} that evaluates to true if this operand is greater than the provided one.
|
|
170
|
-
*
|
|
171
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
172
|
-
*/
|
|
173
|
-
// TODO: test that both sides can be size manually, then add the unit tests if it makes sense.
|
|
174
|
-
greaterThan(rhs) {
|
|
175
|
-
return Condition.from({
|
|
176
|
-
stringify: ({ names, values }) => {
|
|
177
|
-
return `${this.substitute({ names, values })} > ${rhs.substitute({ names, values })}`;
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* An alias for {@link greaterThan}.
|
|
183
|
-
*/
|
|
184
|
-
gt = this.greaterThan.bind(this);
|
|
185
|
-
/**
|
|
186
|
-
* Returns a condition that uses the `>=` operator.
|
|
187
|
-
*
|
|
188
|
-
* @param rhs - The right hand side operand.
|
|
189
|
-
*
|
|
190
|
-
* @returns A {@link Condition} that evaluates to true if this operand is greater than or equal to the provided one.
|
|
191
|
-
*
|
|
192
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
193
|
-
*/
|
|
194
|
-
// TODO: test that both sides can be size manually, then add the unit tests if it makes sense.
|
|
195
|
-
greaterThanOrEquals(rhs) {
|
|
196
|
-
return Condition.from({
|
|
197
|
-
stringify: ({ names, values }) => {
|
|
198
|
-
return `${this.substitute({ names, values })} >= ${rhs.substitute({ names, values })}`;
|
|
199
|
-
},
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* An alias for {@link greaterThanOrEquals}
|
|
204
|
-
*/
|
|
205
|
-
gte = this.greaterThanOrEquals.bind(this);
|
|
206
|
-
/**
|
|
207
|
-
* Returns a condition that uses the `IN` operator.
|
|
208
|
-
*
|
|
209
|
-
* @param operands - The list of operands to check against. This function throws if the list is
|
|
210
|
-
* empty or contains more than 100 operands.
|
|
211
|
-
*
|
|
212
|
-
* @returns A {@link Condition} that evaluates to true if this operand is equal to any of the provided ones.
|
|
213
|
-
*
|
|
214
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
215
|
-
*/
|
|
216
|
-
// TODO: test that both sides can be size manually, then add the unit tests if it makes sense.
|
|
217
|
-
in(...operands) {
|
|
218
|
-
if (operands.length === 0) {
|
|
219
|
-
throw new Error("the IN operator requires at least one operand.");
|
|
220
|
-
}
|
|
221
|
-
if (operands.length > 100) {
|
|
222
|
-
throw new Error(`up to 100 operands are support for the IN operator, got ${operands.length}`);
|
|
223
|
-
}
|
|
224
|
-
return Condition.from({
|
|
225
|
-
stringify: ({ names, values }) => {
|
|
226
|
-
const operandsString = operands
|
|
227
|
-
.map((operand) => operand.substitute({ names, values }))
|
|
228
|
-
.join(",");
|
|
229
|
-
return `${this.substitute({ names, values })} IN (${operandsString})`;
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Returns a condition that uses the `<` operator
|
|
235
|
-
*
|
|
236
|
-
* @param rhs - The right hand side operand.
|
|
237
|
-
*
|
|
238
|
-
* @returns A {@link Condition} that evaluates to true if this operand is lower than the provided one.
|
|
239
|
-
*
|
|
240
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
241
|
-
*/
|
|
242
|
-
// TODO: test that both sides can be size manually, then add the unit tests if it makes sense.
|
|
243
|
-
lowerThan(rhs) {
|
|
244
|
-
return Condition.from({
|
|
245
|
-
stringify: ({ names, values }) => {
|
|
246
|
-
return `${this.substitute({ names, values })} < ${rhs.substitute({ names, values })}`;
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* An alias for {@link lowerThan}.
|
|
252
|
-
*/
|
|
253
|
-
lt = this.lowerThan.bind(this);
|
|
254
|
-
/**
|
|
255
|
-
* Returns a condition that uses the `<=` operator.
|
|
256
|
-
*
|
|
257
|
-
* @param rhs - The right hand side operand.
|
|
258
|
-
*
|
|
259
|
-
* @returns A {@link Condition} that evaluates to true if this operand is lower than or equal to the provided one.
|
|
260
|
-
*
|
|
261
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
262
|
-
*/
|
|
263
|
-
//TODO: test that both sides can be size manually, then add the unit tests if it makes sense.
|
|
264
|
-
lowerThanOrEquals(rhs) {
|
|
265
|
-
return Condition.from({
|
|
266
|
-
stringify: ({ names, values }) => {
|
|
267
|
-
return `${this.substitute({ names, values })} <= ${rhs.substitute({ names, values })}`;
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* An alias for {@link lowerThanOrEquals}
|
|
273
|
-
*/
|
|
274
|
-
lte = this.lowerThanOrEquals.bind(this);
|
|
275
|
-
/**
|
|
276
|
-
* Returns a condition that uses the `<>` operator.
|
|
277
|
-
*
|
|
278
|
-
* @param rhs - The right hand side operand.
|
|
279
|
-
*
|
|
280
|
-
* @returns A {@link Condition} that evaluates to true if this operand is not equal to the provided one.
|
|
281
|
-
*
|
|
282
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
283
|
-
*/
|
|
284
|
-
notEquals(rhs) {
|
|
285
|
-
return Condition.from({
|
|
286
|
-
stringify: ({ names, values }) => {
|
|
287
|
-
return `${this.substitute({ names, values })} <> ${rhs.substitute({ names, values })}`;
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* An alias for {@link notEquals}.
|
|
293
|
-
*/
|
|
294
|
-
ne = this.notEquals.bind(this);
|
|
295
|
-
substitute(params) {
|
|
296
|
-
return this.operand.substitute(params);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
exports.OperandConditionBuilder = OperandConditionBuilder;
|
|
300
|
-
// A specialized class with more capabilities.
|
|
301
|
-
class AttributeConditionBuilder extends OperandConditionBuilder {
|
|
302
|
-
/**
|
|
303
|
-
* @returns A {@link Condition} that evaluates to true if the provided attribute path exists.
|
|
304
|
-
*/
|
|
305
|
-
// NOTE: the left hand side of this condition can only be a literal value (tested)
|
|
306
|
-
exists() {
|
|
307
|
-
return Condition.from({
|
|
308
|
-
stringify: ({ names, values }) => {
|
|
309
|
-
return `attribute_exists(${this.substitute({ names, values })})`;
|
|
310
|
-
},
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* @returns A {@link Condition} that evaluates to true if the provided attribute path does not exist.
|
|
315
|
-
*/
|
|
316
|
-
// NOTE: the left hand side of this condition can only be a literal value (tested)
|
|
317
|
-
notExists() {
|
|
318
|
-
return Condition.from({
|
|
319
|
-
stringify: ({ names, values }) => {
|
|
320
|
-
return `attribute_not_exists(${this.substitute({ names, values })})`;
|
|
321
|
-
},
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* @param type - The type to check against.
|
|
326
|
-
* @returns A {@link Condition} that evaluates to true if there exists an attribute at
|
|
327
|
-
* the provided path of the given type.
|
|
328
|
-
*/
|
|
329
|
-
// NOTE: the left hand side of this condition *can be* an attribute value pointing to a valid path.
|
|
330
|
-
// NOTE: the right hand side of this condition *must be* an condition attribute (not a literal).
|
|
331
|
-
isType(type) {
|
|
332
|
-
return Condition.from({
|
|
333
|
-
stringify: ({ names, values }) => {
|
|
334
|
-
return `attribute_type(${this.substitute({ names, values })}, ${type.substitute({ values })})`;
|
|
335
|
-
},
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
exports.AttributeConditionBuilder = AttributeConditionBuilder;
|
|
340
|
-
function where(operand) {
|
|
341
|
-
if (operand instanceof index_js_1.PathOperand) {
|
|
342
|
-
return new AttributeConditionBuilder(operand);
|
|
343
|
-
}
|
|
344
|
-
return new OperandConditionBuilder(operand);
|
|
345
|
-
}
|
|
346
|
-
// TODO: type this as a "value operand" of type number if possiburu or useful?
|
|
347
|
-
class SizeOperand {
|
|
348
|
-
inner;
|
|
349
|
-
constructor(operand) {
|
|
350
|
-
this.inner = operand;
|
|
351
|
-
}
|
|
352
|
-
substitute(params) {
|
|
353
|
-
return `size(${this.inner.substitute(params)})`;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
exports.SizeOperand = SizeOperand;
|
|
357
|
-
function size(operand) {
|
|
358
|
-
return new SizeOperand(operand);
|
|
359
|
-
}
|
|
360
|
-
//# sourceMappingURL=condition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../../src/commands/expressions/condition.ts"],"names":[],"mappings":";;;AAyGA,kBAMC;AAgSD,sBAKC;AAkBD,oBAEC;AApaD,kDAK6B;AAmB7B,MAAa,SAAS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OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,8EAA8E;AAC9E,MAAa,WAAW;IACL,KAAK,CAAU;IAEhC,YAAY,OAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;IACvB,CAAC;IAED,UAAU,CAAC,MAGV;QACC,OAAO,QAAQ,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC;IAClD,CAAC;CACF;AAbD,kCAaC;AAED,SAAgB,IAAI,CAAC,OAAgB;IACnC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import type { AttributeType } from "../../types.js";
|
|
2
|
-
import type { AttributeNames } from "../attributes/names.js";
|
|
3
|
-
import type { AttributeValues } from "../attributes/values.js";
|
|
4
|
-
import type { IExpression } from "./expression.js";
|
|
5
|
-
import { type IOperand, type Operand, PathOperand, type ValueOperand } from "./operands/index.js";
|
|
6
|
-
export type ConditionOperand = Operand | SizeOperand;
|
|
7
|
-
export type Stringifier = (params: {
|
|
8
|
-
names: AttributeNames;
|
|
9
|
-
values: AttributeValues;
|
|
10
|
-
}) => string;
|
|
11
|
-
export interface ConditionParams {
|
|
12
|
-
stringify: Stringifier;
|
|
13
|
-
}
|
|
14
|
-
export declare class Condition implements IExpression {
|
|
15
|
-
private readonly stringifier;
|
|
16
|
-
private constructor();
|
|
17
|
-
stringify(params: {
|
|
18
|
-
names: AttributeNames;
|
|
19
|
-
values: AttributeValues;
|
|
20
|
-
}): string;
|
|
21
|
-
/**
|
|
22
|
-
* Returns a condition that combines this one with the provided condition using the `AND` operator.
|
|
23
|
-
*
|
|
24
|
-
* @param other - The other condition to combine with this one.
|
|
25
|
-
*
|
|
26
|
-
* @returns A {@link Condition} that evaluates to true only if both conditions evaluate to true.
|
|
27
|
-
*
|
|
28
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.LogicalEvaluations
|
|
29
|
-
*/
|
|
30
|
-
and(other: Condition): Condition;
|
|
31
|
-
/**
|
|
32
|
-
* Returns a condition that combines this one with the provided condition using the `OR` operator.
|
|
33
|
-
*
|
|
34
|
-
* @param other - The other condition to combine with this one.
|
|
35
|
-
*
|
|
36
|
-
* @returns A {@link Condition} that evaluates to true if any conditions evaluate to true.
|
|
37
|
-
*
|
|
38
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.LogicalEvaluations
|
|
39
|
-
*/
|
|
40
|
-
or(other: Condition): Condition;
|
|
41
|
-
/**
|
|
42
|
-
* Factory method to create a new {@link Condition} instance.
|
|
43
|
-
*
|
|
44
|
-
* This is not meant to be called outside this package.
|
|
45
|
-
*
|
|
46
|
-
* @param params - The parameters to create the condition.
|
|
47
|
-
*
|
|
48
|
-
* @returns A new {@link Condition} instance.
|
|
49
|
-
*/
|
|
50
|
-
static from(params: ConditionParams): Condition;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Negates the provided condition using the `NOT` operator.
|
|
54
|
-
*
|
|
55
|
-
* @param inner - The condition to negate.
|
|
56
|
-
*
|
|
57
|
-
* @returns A {@link Condition} that evaluates to the opposite of what the provided condition evaluates to.
|
|
58
|
-
*
|
|
59
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.LogicalEvaluations
|
|
60
|
-
*/
|
|
61
|
-
export declare function not(inner: Condition): Condition;
|
|
62
|
-
export declare class OperandConditionBuilder<T extends Operand> {
|
|
63
|
-
protected readonly operand: T;
|
|
64
|
-
constructor(operand: T);
|
|
65
|
-
/**
|
|
66
|
-
* Returns a condition that uses the `begins_with` function.
|
|
67
|
-
*
|
|
68
|
-
* @param rhs - The right hand side operand.
|
|
69
|
-
*
|
|
70
|
-
* @returns A {@link Condition} that evaluates to true if this operand begins with the provided one.
|
|
71
|
-
*
|
|
72
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
73
|
-
*/
|
|
74
|
-
beginsWith(rhs: Operand<string>): Condition;
|
|
75
|
-
/**
|
|
76
|
-
* Returns a condition that uses the `BETWEEN` operator.
|
|
77
|
-
*
|
|
78
|
-
* Both bounds are inclusive, meaning that the returned condition corresponds to `lower <= this <= upper`.
|
|
79
|
-
*
|
|
80
|
-
* @param lower - The lower inclusive bound of the range.
|
|
81
|
-
* @param upper - The upper inclusive bound of the range.
|
|
82
|
-
*
|
|
83
|
-
* @returns A {@link Condition} that evaluates to true if this operand is within the provided bounds.
|
|
84
|
-
*
|
|
85
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
86
|
-
*/
|
|
87
|
-
between(lower: ConditionOperand, upper: ConditionOperand): Condition;
|
|
88
|
-
/**
|
|
89
|
-
* Returns a condition that uses the `contains` function.
|
|
90
|
-
*
|
|
91
|
-
* @param rhs - The right hand side operand.
|
|
92
|
-
*
|
|
93
|
-
* @returns A {@link Condition} that evaluates to true if this operand contains the provided one.
|
|
94
|
-
*
|
|
95
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions
|
|
96
|
-
*/
|
|
97
|
-
contains(rhs: ConditionOperand): Condition;
|
|
98
|
-
/**
|
|
99
|
-
* Returns a condition that uses the `=` operator.
|
|
100
|
-
*
|
|
101
|
-
* @param rhs - The right hand side operand.
|
|
102
|
-
*
|
|
103
|
-
* @returns A {@link Condition} that evaluates to true if this operand is equal to the provided one.
|
|
104
|
-
*
|
|
105
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
106
|
-
*/
|
|
107
|
-
equals(rhs: ConditionOperand): Condition;
|
|
108
|
-
/**
|
|
109
|
-
* An alias for {@link equals}.
|
|
110
|
-
*/
|
|
111
|
-
eq: (rhs: ConditionOperand) => Condition;
|
|
112
|
-
/**
|
|
113
|
-
* Returns a condition that uses the `>` operator.
|
|
114
|
-
*
|
|
115
|
-
* @param rhs - The right hand side operand.
|
|
116
|
-
*
|
|
117
|
-
* @returns A {@link Condition} that evaluates to true if this operand is greater than the provided one.
|
|
118
|
-
*
|
|
119
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
120
|
-
*/
|
|
121
|
-
greaterThan(rhs: ConditionOperand): Condition;
|
|
122
|
-
/**
|
|
123
|
-
* An alias for {@link greaterThan}.
|
|
124
|
-
*/
|
|
125
|
-
gt: (rhs: ConditionOperand) => Condition;
|
|
126
|
-
/**
|
|
127
|
-
* Returns a condition that uses the `>=` operator.
|
|
128
|
-
*
|
|
129
|
-
* @param rhs - The right hand side operand.
|
|
130
|
-
*
|
|
131
|
-
* @returns A {@link Condition} that evaluates to true if this operand is greater than or equal to the provided one.
|
|
132
|
-
*
|
|
133
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
134
|
-
*/
|
|
135
|
-
greaterThanOrEquals(rhs: ConditionOperand): Condition;
|
|
136
|
-
/**
|
|
137
|
-
* An alias for {@link greaterThanOrEquals}
|
|
138
|
-
*/
|
|
139
|
-
gte: (rhs: ConditionOperand) => Condition;
|
|
140
|
-
/**
|
|
141
|
-
* Returns a condition that uses the `IN` operator.
|
|
142
|
-
*
|
|
143
|
-
* @param operands - The list of operands to check against. This function throws if the list is
|
|
144
|
-
* empty or contains more than 100 operands.
|
|
145
|
-
*
|
|
146
|
-
* @returns A {@link Condition} that evaluates to true if this operand is equal to any of the provided ones.
|
|
147
|
-
*
|
|
148
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
149
|
-
*/
|
|
150
|
-
in(...operands: ConditionOperand[]): Condition;
|
|
151
|
-
/**
|
|
152
|
-
* Returns a condition that uses the `<` operator
|
|
153
|
-
*
|
|
154
|
-
* @param rhs - The right hand side operand.
|
|
155
|
-
*
|
|
156
|
-
* @returns A {@link Condition} 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
|
-
lowerThan(rhs: ConditionOperand): Condition;
|
|
161
|
-
/**
|
|
162
|
-
* An alias for {@link lowerThan}.
|
|
163
|
-
*/
|
|
164
|
-
lt: (rhs: ConditionOperand) => Condition;
|
|
165
|
-
/**
|
|
166
|
-
* Returns a condition that uses the `<=` operator.
|
|
167
|
-
*
|
|
168
|
-
* @param rhs - The right hand side operand.
|
|
169
|
-
*
|
|
170
|
-
* @returns A {@link Condition} that evaluates to true if this operand is lower than or equal to the provided one.
|
|
171
|
-
*
|
|
172
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
173
|
-
*/
|
|
174
|
-
lowerThanOrEquals(rhs: ConditionOperand): Condition;
|
|
175
|
-
/**
|
|
176
|
-
* An alias for {@link lowerThanOrEquals}
|
|
177
|
-
*/
|
|
178
|
-
lte: (rhs: ConditionOperand) => Condition;
|
|
179
|
-
/**
|
|
180
|
-
* Returns a condition that uses the `<>` operator.
|
|
181
|
-
*
|
|
182
|
-
* @param rhs - The right hand side operand.
|
|
183
|
-
*
|
|
184
|
-
* @returns A {@link Condition} that evaluates to true if this operand is not equal to the provided one.
|
|
185
|
-
*
|
|
186
|
-
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators
|
|
187
|
-
*/
|
|
188
|
-
notEquals(rhs: ConditionOperand): Condition;
|
|
189
|
-
/**
|
|
190
|
-
* An alias for {@link notEquals}.
|
|
191
|
-
*/
|
|
192
|
-
ne: (rhs: ConditionOperand) => Condition;
|
|
193
|
-
protected substitute(params: {
|
|
194
|
-
names: AttributeNames;
|
|
195
|
-
values: AttributeValues;
|
|
196
|
-
}): string;
|
|
197
|
-
}
|
|
198
|
-
export declare class AttributeConditionBuilder extends OperandConditionBuilder<PathOperand> {
|
|
199
|
-
/**
|
|
200
|
-
* @returns A {@link Condition} that evaluates to true if the provided attribute path exists.
|
|
201
|
-
*/
|
|
202
|
-
exists(): Condition;
|
|
203
|
-
/**
|
|
204
|
-
* @returns A {@link Condition} that evaluates to true if the provided attribute path does not exist.
|
|
205
|
-
*/
|
|
206
|
-
notExists(): Condition;
|
|
207
|
-
/**
|
|
208
|
-
* @param type - The type to check against.
|
|
209
|
-
* @returns A {@link Condition} that evaluates to true if there exists an attribute at
|
|
210
|
-
* the provided path of the given type.
|
|
211
|
-
*/
|
|
212
|
-
isType(type: ValueOperand<AttributeType>): Condition;
|
|
213
|
-
}
|
|
214
|
-
export declare function where(attrribute: PathOperand): AttributeConditionBuilder;
|
|
215
|
-
export declare function where(operand: Exclude<Operand, PathOperand>): OperandConditionBuilder<Exclude<Operand, PathOperand>>;
|
|
216
|
-
export declare class SizeOperand implements IOperand {
|
|
217
|
-
private readonly inner;
|
|
218
|
-
constructor(operand: Operand);
|
|
219
|
-
substitute(params: {
|
|
220
|
-
names: AttributeNames;
|
|
221
|
-
values: AttributeValues;
|
|
222
|
-
}): string;
|
|
223
|
-
}
|
|
224
|
-
export declare function size(operand: Operand): SizeOperand;
|