dynoquery 0.1.22 → 0.1.23
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/dist/index.js +2 -30
- package/dist/partition.js +17 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -181,21 +181,7 @@ class DynoQuery {
|
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
else {
|
|
184
|
-
const dataToSave =
|
|
185
|
-
for (const key in item) {
|
|
186
|
-
if (Object.prototype.hasOwnProperty.call(item, key) &&
|
|
187
|
-
![
|
|
188
|
-
"_indices",
|
|
189
|
-
"_partition",
|
|
190
|
-
"_skValue",
|
|
191
|
-
"_toBeDeleted",
|
|
192
|
-
"_filterBuilder",
|
|
193
|
-
"_conditionBuilder",
|
|
194
|
-
].includes(key) &&
|
|
195
|
-
typeof item[key] !== "function") {
|
|
196
|
-
dataToSave[key] = item[key];
|
|
197
|
-
}
|
|
198
|
-
}
|
|
184
|
+
const dataToSave = item.getData();
|
|
199
185
|
// Ensure PK and SK are in the data
|
|
200
186
|
dataToSave[this.pkName] = partition.getPkValue();
|
|
201
187
|
dataToSave[this.skName] = skValue;
|
|
@@ -314,21 +300,7 @@ class DynoQuery {
|
|
|
314
300
|
};
|
|
315
301
|
}
|
|
316
302
|
else {
|
|
317
|
-
const dataToSave =
|
|
318
|
-
for (const key in item) {
|
|
319
|
-
if (Object.prototype.hasOwnProperty.call(item, key) &&
|
|
320
|
-
![
|
|
321
|
-
"_indices",
|
|
322
|
-
"_partition",
|
|
323
|
-
"_skValue",
|
|
324
|
-
"_toBeDeleted",
|
|
325
|
-
"_filterBuilder",
|
|
326
|
-
"_conditionBuilder",
|
|
327
|
-
].includes(key) &&
|
|
328
|
-
typeof item[key] !== "function") {
|
|
329
|
-
dataToSave[key] = item[key];
|
|
330
|
-
}
|
|
331
|
-
}
|
|
303
|
+
const dataToSave = item.getData();
|
|
332
304
|
// Ensure PK and SK are in the data
|
|
333
305
|
dataToSave[this.pkName] = pkValue;
|
|
334
306
|
dataToSave[this.skName] = skValue;
|
package/dist/partition.js
CHANGED
|
@@ -20,17 +20,29 @@ class Item {
|
|
|
20
20
|
const self = this;
|
|
21
21
|
return new Proxy(this, {
|
|
22
22
|
get(target, prop, receiver) {
|
|
23
|
-
if (prop === "
|
|
23
|
+
if (prop === "getData") {
|
|
24
24
|
return () => {
|
|
25
|
-
const
|
|
25
|
+
const data = {};
|
|
26
26
|
for (const key in target) {
|
|
27
27
|
if (Object.prototype.hasOwnProperty.call(target, key) &&
|
|
28
|
-
![
|
|
28
|
+
![
|
|
29
|
+
"_indices",
|
|
30
|
+
"_partition",
|
|
31
|
+
"_skValue",
|
|
32
|
+
"_toBeDeleted",
|
|
33
|
+
"_filterBuilder",
|
|
34
|
+
"_conditionBuilder",
|
|
35
|
+
].includes(key) &&
|
|
29
36
|
typeof target[key] !== "function") {
|
|
30
|
-
|
|
37
|
+
data[key] = target[key];
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
|
-
return
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (prop === "save") {
|
|
44
|
+
return () => {
|
|
45
|
+
return partition.update(skValue, receiver.getData(), self._indices, {
|
|
34
46
|
conditionBuilder: self._conditionBuilder,
|
|
35
47
|
});
|
|
36
48
|
};
|