@nxtedition/lib 19.8.14 → 19.8.16

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 +16 -6
  2. package/package.json +7 -7
package/couch.js CHANGED
@@ -7,7 +7,13 @@ import tp from 'timers/promises'
7
7
  import { defaultDelay as delay } from './http.js'
8
8
  import urljoin from 'url-join'
9
9
  import { AbortError } from './errors.js'
10
- import { dispatch, Agent, Pool, parseHeaders } from '@nxtedition/nxt-undici'
10
+ import {
11
+ dispatch,
12
+ Agent,
13
+ Pool,
14
+ parseHeaders,
15
+ request as undiciRequest,
16
+ } from '@nxtedition/nxt-undici'
11
17
 
12
18
  // https://github.com/fastify/fastify/blob/main/lib/reqIdGenFactory.js
13
19
  // 2,147,483,647 (2^31 − 1) stands for max SMI value (an internal optimization of V8).
@@ -214,8 +220,8 @@ export function makeCouch(opts) {
214
220
  const limit = options.limit
215
221
 
216
222
  try {
217
- // Don't stay connected to the same socket to allow server to load balance.
218
- const socketCount = 128 * 1024
223
+ // Limit request duration to allow server to load balance.
224
+ const socketCount = 64 * 1024
219
225
  let remaining = Number(limit) || Infinity
220
226
  while (remaining > 0) {
221
227
  let count = 0
@@ -265,6 +271,7 @@ export function makeCouch(opts) {
265
271
 
266
272
  const ureq = {
267
273
  path: `${dbPathname}/_changes`,
274
+ origin: dbOrigin,
268
275
  query,
269
276
  idempotent: false,
270
277
  blocking: true,
@@ -278,9 +285,10 @@ export function makeCouch(opts) {
278
285
  },
279
286
  bodyTimeout: 2 * (params.heartbeat || 60e3),
280
287
  highWaterMark: 256 * 1024,
288
+ dispatcher: client,
281
289
  }
282
290
 
283
- const ures = await client.request(ureq)
291
+ const ures = await undiciRequest(ureq)
284
292
 
285
293
  if (ures.statusCode < 200 || ures.statusCode >= 300) {
286
294
  throw makeError(ureq, {
@@ -480,10 +488,11 @@ export function makeCouch(opts) {
480
488
  method,
481
489
  body: typeof body === 'object' && body ? JSON.stringify(body) : body,
482
490
  headers,
491
+ dispatcher: client,
483
492
  }
484
493
 
485
494
  return new Promise((resolve, reject) =>
486
- client.dispatch(req, {
495
+ dispatch(req, {
487
496
  resolve,
488
497
  reject,
489
498
  signal,
@@ -731,11 +740,12 @@ export function makeCouch(opts) {
731
740
  }
732
741
 
733
742
  async function up(params, body, { client = defaultClient, signal = null } = {}) {
734
- const res = await client.request({
743
+ const res = await request({
735
744
  path: '/_up',
736
745
  method: 'GET',
737
746
  signal,
738
747
  throwOnError: true,
748
+ dispatcher: client,
739
749
  })
740
750
  return await res.body.json()
741
751
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.8.14",
3
+ "version": "19.8.16",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -79,10 +79,10 @@
79
79
  "**/*.d.ts"
80
80
  ],
81
81
  "dependencies": {
82
- "@aws-sdk/client-s3": "^3.606.0",
82
+ "@aws-sdk/client-s3": "^3.614.0",
83
83
  "@elastic/elasticsearch": "^8.14.0",
84
- "@elastic/transport": "^8.6.1",
85
- "@nxtedition/nxt-undici": "^4.0.1",
84
+ "@elastic/transport": "^8.7.0",
85
+ "@nxtedition/nxt-undici": "^4.1.3",
86
86
  "content-type": "^1.0.5",
87
87
  "date-fns": "^3.6.0",
88
88
  "fast-querystring": "^1.1.1",
@@ -91,14 +91,14 @@
91
91
  "json5": "^2.2.3",
92
92
  "koa-compose": "^4.1.0",
93
93
  "lodash": "^4.17.21",
94
- "mime": "^4.0.1",
94
+ "mime": "^4.0.4",
95
95
  "moment-timezone": "^0.5.45",
96
96
  "nconf": "^0.12.1",
97
97
  "nested-error-stacks": "^2.1.1",
98
98
  "object-hash": "^3.0.0",
99
99
  "p-queue": "^8.0.1",
100
100
  "pino": "^9.2.0",
101
- "qs": "^6.12.1",
101
+ "qs": "^6.12.3",
102
102
  "request-target": "^1.0.2",
103
103
  "smpte-timecode": "^1.3.6",
104
104
  "split-string": "^6.0.0",
@@ -109,7 +109,7 @@
109
109
  "devDependencies": {
110
110
  "@nxtedition/deepstream.io-client-js": ">=24.2.4",
111
111
  "@types/lodash": "^4.17.6",
112
- "@types/node": "^20.14.9",
112
+ "@types/node": "^20.14.10",
113
113
  "eslint": "^8.0.0",
114
114
  "eslint-config-prettier": "^9.1.0",
115
115
  "eslint-config-standard": "^17.0.0",