@nxtedition/lib 19.0.49 → 19.0.51

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 CHANGED
@@ -138,23 +138,29 @@ function getRecord(ds, name, ...args) {
138
138
  )
139
139
  }
140
140
 
141
- function query(ds, designId, options) {
141
+ function query(ds, designId, params, state = ds.record.PROVIDER) {
142
+ if (params.key) {
143
+ // TODO (fix): params.key?
144
+ throw new Error('params.key is not supported')
145
+ }
146
+
142
147
  const next = (startkey, prevRows, limit) =>
143
148
  Number.isFinite(limit) && limit <= 0
144
149
  ? rxjs.of({ rows: prevRows })
145
- : ds.nxt.record
150
+ : ds.record
146
151
  .observe(
147
152
  `${designId}:design?${qs.stringify(
148
153
  {
149
- ...options,
154
+ ...params,
150
155
  startkey,
151
156
  limit: Number.isFinite(limit) ? limit : null,
152
157
  },
153
158
  { skipNulls: true },
154
159
  )}`,
155
- ds.record.PROVIDER,
160
+ state,
156
161
  )
157
162
  .pipe(
163
+ rxjs.filter(({ rows }) => Array.isArray(rows)),
158
164
  rxjs.switchMap(({ rows, finished }) => {
159
165
  // assert(Array.isArray(rows))
160
166
  // assert(typeof finished === 'boolean')
@@ -170,7 +176,7 @@ function query(ds, designId, options) {
170
176
  }
171
177
  }),
172
178
  )
173
- return next(options.startkey, [], options.limit ?? Infinity)
179
+ return next(params.startkey, [], params.limit ?? Infinity)
174
180
  }
175
181
 
176
182
  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
- const errors = error.map(serializeError).filter(Boolean)
59
- return errors
58
+ return error.map(serializeError).filter(Boolean)
60
59
  }
61
60
 
62
61
  if (Object.prototype.hasOwnProperty.call(error, kSeen)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.0.49",
3
+ "version": "19.0.51",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",