@nxtedition/lib 20.0.0 → 20.0.2

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/couch.js +11 -10
  2. package/package.json +1 -1
package/couch.js CHANGED
@@ -208,7 +208,6 @@ export function makeCouch(opts) {
208
208
  }
209
209
  }
210
210
 
211
- const batched = options.batched || false
212
211
  const live = options.live == null || !!options.live
213
212
  const retry = options.retry
214
213
  const limit = options.limit
@@ -220,7 +219,6 @@ export function makeCouch(opts) {
220
219
  while (remaining > 0) {
221
220
  let count = 0
222
221
  for await (const changes of _changes({
223
- batched,
224
222
  live,
225
223
  retry,
226
224
  limit: Math.min(remaining, socketCount),
@@ -253,7 +251,7 @@ export function makeCouch(opts) {
253
251
  }
254
252
  }
255
253
 
256
- async function* _changes({ batched, live, retry, limit, params, method, body, signal, client }) {
254
+ async function* _changes({ live, retry, limit, params, method, body, signal, client }) {
257
255
  let retryCount = 0
258
256
  let remaining = Number(limit) || Infinity
259
257
  while (true) {
@@ -333,7 +331,9 @@ export function makeCouch(opts) {
333
331
  for (const line of lines) {
334
332
  if (line === '') {
335
333
  // hearbeat
336
- yield batched ? [] : { seq: params.since }
334
+ const ret = []
335
+ ret.lastSeq = params.since
336
+ yield ret
337
337
  } else if (line === ',') {
338
338
  // Do nothing. Couch sometimes insert new line between
339
339
  // json body and comma.
@@ -378,11 +378,9 @@ export function makeCouch(opts) {
378
378
  remaining -= changes.length
379
379
  assert(remaining >= 0, 'invalid remaining: ' + remaining)
380
380
 
381
- if (batched) {
382
- yield changes.splice(0)
383
- } else {
384
- yield* changes.splice(0)
385
- }
381
+ const ret = changes.splice(0)
382
+ ret.lastSeq = params.since
383
+ yield ret
386
384
  } else if (error) {
387
385
  throw error
388
386
  } else if (!ended) {
@@ -390,7 +388,10 @@ export function makeCouch(opts) {
390
388
  resume = resolve
391
389
  })
392
390
  } else {
393
- yield { seq: params.since }
391
+ const ret = []
392
+ ret.lastSeq = params.since
393
+ yield ret
394
+
394
395
  return
395
396
  }
396
397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "20.0.0",
3
+ "version": "20.0.2",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",