@ikonintegration/ikapi 3.0.11 → 3.0.12
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/package.json
CHANGED
|
@@ -4,6 +4,8 @@ import Utils from './../../API/IKUtils';
|
|
|
4
4
|
export default class IKDBQueryScan extends IKDBBaseQuery {
|
|
5
5
|
constructor(optIndexName) {
|
|
6
6
|
super(optIndexName);
|
|
7
|
+
this.limit = -1;
|
|
8
|
+
this.lastEvaluatedKey = null;
|
|
7
9
|
}
|
|
8
10
|
async run(dbManager, appendingItems) {
|
|
9
11
|
const localConsole = (dbManager.transaction ? dbManager.transaction.logger : console);
|
|
@@ -16,15 +18,20 @@ export default class IKDBQueryScan extends IKDBBaseQuery {
|
|
|
16
18
|
unmarshalled = unmarshalled.concat(appendingItems);
|
|
17
19
|
}
|
|
18
20
|
//Check for continuation
|
|
19
|
-
|
|
21
|
+
this.lastEvaluatedKey = resp.LastEvaluatedKey;
|
|
22
|
+
if (resp.LastEvaluatedKey && !(this.limit > 0 && unmarshalled.length == this.limit)) {
|
|
23
|
+
localConsole.debug('Using continuation key:', resp.LastEvaluatedKey);
|
|
20
24
|
this.exclusiveStartKey = resp.LastEvaluatedKey;
|
|
21
25
|
return this.run(dbManager, unmarshalled);
|
|
22
26
|
} return unmarshalled;
|
|
23
27
|
} return null;
|
|
24
28
|
}
|
|
25
|
-
async rawRun(dbManager) {
|
|
29
|
+
async rawRun(dbManager, appendingItems) {
|
|
26
30
|
const localConsole = (dbManager.transaction ? dbManager.transaction.logger : console);
|
|
27
|
-
const query =
|
|
31
|
+
const query = {
|
|
32
|
+
...this._rawQuery(dbManager.tableName),
|
|
33
|
+
...(this.limit > 0 ? { Limit: this.limit - (appendingItems ? appendingItems.length : 0) } : {})
|
|
34
|
+
};
|
|
28
35
|
localConsole.log('Scanning: ', query);
|
|
29
36
|
const resp = await dbManager.connection.scan(query);
|
|
30
37
|
// localConsole.debug('Raw result: ', resp);
|