@nxtedition/lib 19.0.48 → 19.0.50
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 +19 -10
- package/errors.js +1 -2
- package/package.json +1 -1
package/deepstream.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import assert from 'node:assert'
|
|
1
|
+
// import assert from 'node:assert'
|
|
2
2
|
import qs from 'qs'
|
|
3
3
|
import cached from './util/cached.js'
|
|
4
4
|
import * as rxjs from 'rxjs'
|
|
@@ -138,39 +138,48 @@ function getRecord(ds, name, ...args) {
|
|
|
138
138
|
)
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
function query(
|
|
141
|
+
function query(
|
|
142
|
+
ds,
|
|
143
|
+
designId,
|
|
144
|
+
{ startkey, endkey, key, sorted, descending, limit },
|
|
145
|
+
state = ds.record.PROVIDER,
|
|
146
|
+
) {
|
|
142
147
|
const next = (startkey, prevRows, limit) =>
|
|
143
148
|
Number.isFinite(limit) && limit <= 0
|
|
144
149
|
? rxjs.of({ rows: prevRows })
|
|
145
|
-
: ds.
|
|
150
|
+
: ds.record
|
|
146
151
|
.observe(
|
|
147
152
|
`${designId}:design?${qs.stringify(
|
|
148
153
|
{
|
|
149
|
-
...options,
|
|
150
154
|
startkey,
|
|
155
|
+
endkey,
|
|
156
|
+
key,
|
|
157
|
+
sorted,
|
|
158
|
+
descending,
|
|
151
159
|
limit: Number.isFinite(limit) ? limit : null,
|
|
152
160
|
},
|
|
153
161
|
{ skipNulls: true },
|
|
154
162
|
)}`,
|
|
155
|
-
|
|
163
|
+
state,
|
|
156
164
|
)
|
|
157
165
|
.pipe(
|
|
166
|
+
rxjs.filter(({ rows }) => Array.isArray(rows)),
|
|
158
167
|
rxjs.switchMap(({ rows, finished }) => {
|
|
159
|
-
assert(Array.isArray(rows))
|
|
160
|
-
assert(typeof finished === 'boolean')
|
|
168
|
+
// assert(Array.isArray(rows))
|
|
169
|
+
// assert(typeof finished === 'boolean')
|
|
161
170
|
|
|
162
171
|
const nextRows = prevRows.length ? [...prevRows, ...rows] : rows
|
|
163
172
|
if (finished) {
|
|
164
173
|
return rxjs.of({ rows: nextRows })
|
|
165
174
|
} else {
|
|
166
175
|
const last = rows.pop()
|
|
167
|
-
assert(last.key)
|
|
168
|
-
assert(rows.length > 0)
|
|
176
|
+
// assert(last.key)
|
|
177
|
+
// assert(rows.length > 0)
|
|
169
178
|
return next(last.key, nextRows, limit - rows.length)
|
|
170
179
|
}
|
|
171
180
|
}),
|
|
172
181
|
)
|
|
173
|
-
return next(
|
|
182
|
+
return next(startkey, [], limit ?? Infinity)
|
|
174
183
|
}
|
|
175
184
|
|
|
176
185
|
export function makeDeepstream(ds) {
|
package/errors.js
CHANGED
|
@@ -55,8 +55,7 @@ export function serializeError(error) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (Array.isArray(error)) {
|
|
58
|
-
|
|
59
|
-
return errors
|
|
58
|
+
return error.map(serializeError).filter(Boolean)
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
if (Object.prototype.hasOwnProperty.call(error, kSeen)) {
|