@nxtedition/lib 19.0.22 → 19.0.24
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 +10 -7
- package/package.json +1 -1
package/deepstream.js
CHANGED
|
@@ -119,13 +119,13 @@ function get(ds, name, ...args) {
|
|
|
119
119
|
)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
function query(ds, designId, options
|
|
122
|
+
function query(ds, designId, options) {
|
|
123
123
|
const next = (startkey, prevRows, limit) =>
|
|
124
|
-
|
|
125
|
-
? rxjs.of({ rows: prevRows
|
|
124
|
+
Number.isFinite(limit) && limit <= 0
|
|
125
|
+
? rxjs.of({ rows: prevRows })
|
|
126
126
|
: ds.nxt.record
|
|
127
127
|
.observe(
|
|
128
|
-
`${designId}:
|
|
128
|
+
`${designId}:design?${qs.stringify(
|
|
129
129
|
{
|
|
130
130
|
...options,
|
|
131
131
|
startkey,
|
|
@@ -133,11 +133,14 @@ function query(ds, designId, options, state = options.state ?? ds.record.PROVIDE
|
|
|
133
133
|
},
|
|
134
134
|
{ skipNulls: true },
|
|
135
135
|
)}`,
|
|
136
|
-
|
|
136
|
+
ds.record.PROVIDER,
|
|
137
137
|
)
|
|
138
138
|
.pipe(
|
|
139
139
|
rxjs.switchMap(({ rows, finished }) => {
|
|
140
|
-
|
|
140
|
+
assert(Array.isArray(rows))
|
|
141
|
+
assert(typeof finished === 'boolean')
|
|
142
|
+
|
|
143
|
+
const nextRows = prevRows.length ? [...prevRows, ...rows] : rows
|
|
141
144
|
if (finished) {
|
|
142
145
|
return rxjs.of({ rows: nextRows })
|
|
143
146
|
} else {
|
|
@@ -148,7 +151,7 @@ function query(ds, designId, options, state = options.state ?? ds.record.PROVIDE
|
|
|
148
151
|
}
|
|
149
152
|
}),
|
|
150
153
|
)
|
|
151
|
-
return next(options.startkey,
|
|
154
|
+
return next(options.startkey, [], options.limit ?? Infinity)
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
export function makeDeepstream(ds) {
|