@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.
Files changed (2) hide show
  1. package/deepstream.js +10 -7
  2. 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, state = options.state ?? ds.record.PROVIDER) {
122
+ function query(ds, designId, options) {
123
123
  const next = (startkey, prevRows, limit) =>
124
- !limit
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}:query?${qs.stringify(
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
- state,
136
+ ds.record.PROVIDER,
137
137
  )
138
138
  .pipe(
139
139
  rxjs.switchMap(({ rows, finished }) => {
140
- const nextRows = prevRows ? [...prevRows, ...rows] : rows
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, null, options.limit ?? Infinity)
154
+ return next(options.startkey, [], options.limit ?? Infinity)
152
155
  }
153
156
 
154
157
  export function makeDeepstream(ds) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.0.22",
3
+ "version": "19.0.24",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",