@nxtedition/lib 19.5.2 → 19.5.3
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/deepstream.js +5 -16
- package/package.json +1 -1
package/deepstream.js
CHANGED
|
@@ -161,24 +161,13 @@ function query(ds, designId, params, state = ds.record.PROVIDER) {
|
|
|
161
161
|
)
|
|
162
162
|
.pipe(
|
|
163
163
|
rxjs.filter(({ rows }) => Array.isArray(rows)),
|
|
164
|
-
rxjs.switchMap(({ rows, finished }) => {
|
|
164
|
+
rxjs.switchMap(({ rows: currRows, finished }) => {
|
|
165
165
|
// assert(Array.isArray(rows))
|
|
166
166
|
// assert(typeof finished === 'boolean')
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
} else {
|
|
172
|
-
let nextKey = rows.pop().key
|
|
173
|
-
// assert(last.key)
|
|
174
|
-
// assert(rows.length > 0)
|
|
175
|
-
if (nextKey === startkey) {
|
|
176
|
-
// TODO (fix): We need to use startkey_docid to properly handle this...
|
|
177
|
-
// See, https://docs.couchdb.org/en/stable/ddocs/views/pagination.html#paging-alternate-method
|
|
178
|
-
nextKey += '\u0000'
|
|
179
|
-
}
|
|
180
|
-
return next(nextKey, nextRows, limit - rows.length)
|
|
181
|
-
}
|
|
167
|
+
const rows = prevRows.length ? [...prevRows, ...currRows] : currRows
|
|
168
|
+
return finished
|
|
169
|
+
? rxjs.of({ rows })
|
|
170
|
+
: next(currRows.at(-1).key + '\u0000', rows, limit - currRows.length)
|
|
182
171
|
}),
|
|
183
172
|
)
|
|
184
173
|
return next(params.startkey, [], params.limit ?? Infinity)
|