@nxtedition/lib 19.10.4 → 19.11.0

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/app.js CHANGED
@@ -438,7 +438,24 @@ export function makeApp(appConfig, onTerminate) {
438
438
  timestamp: Date.now(),
439
439
  })),
440
440
  rx.auditTime(1e3),
441
- rx.filter(Boolean),
441
+ rx.withLatestFrom(
442
+ rxjs.timer(0, 1e3).pipe(
443
+ rx.map(() => performance.eventLoopUtilization?.()),
444
+ rx.pairwise(),
445
+ rx.map(([elu1, elu2]) => ({
446
+ ds: ds?.stats,
447
+ couch: couch?.stats,
448
+ lag: toobusy?.lag(),
449
+ memory: process.memoryUsage(),
450
+ utilization: performance.eventLoopUtilization?.(elu2, elu1),
451
+ heap: v8.getHeapStatistics(),
452
+ })),
453
+ ),
454
+ ),
455
+ rx.map(([serviceStats, appStats]) => ({
456
+ ...appStats,
457
+ [serviceName]: serviceStats,
458
+ })),
442
459
  rx.retryWhen((err$) =>
443
460
  err$.pipe(
444
461
  rx.tap((err) => logger.error({ err }, 'monitor.stats')),
@@ -452,27 +469,13 @@ export function makeApp(appConfig, onTerminate) {
452
469
 
453
470
  monitorProviders.stats$ = stats$
454
471
 
455
- let elu1 = performance.eventLoopUtilization?.()
456
- const subscription = stats$.pipe(rx.auditTime(10e3)).subscribe((stats) => {
457
- if (process.env.NODE_ENV === 'production') {
458
- const elu2 = performance.eventLoopUtilization?.()
459
- logger.debug(
460
- {
461
- ds: ds?.stats,
462
- couch: couch?.stats,
463
- lag: toobusy?.lag(),
464
- memory: process.memoryUsage(),
465
- utilization: performance.eventLoopUtilization?.(elu2, elu1),
466
- heap: v8.getHeapStatistics(),
467
- [serviceName]: stats,
468
- },
469
- 'STATS',
470
- )
471
- elu1 = elu2
472
- }
473
- })
474
-
475
- appDestroyers.unshift(subscription)
472
+ if (process.env.NODE_ENV === 'production') {
473
+ appDestroyers.unshift(
474
+ stats$.pipe(rx.auditTime(10e3)).subscribe((stats) => {
475
+ logger.debug(stats, 'STATS')
476
+ }),
477
+ )
478
+ }
476
479
  }
477
480
 
478
481
  let status$
package/couch.js CHANGED
@@ -783,7 +783,6 @@ export function makeCouch(opts) {
783
783
  })
784
784
  }
785
785
 
786
- /* eslint-disable camelcase */
787
786
  function _normalizeAllDocsOptions({
788
787
  conflicts,
789
788
  update_seq,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.10.4",
3
+ "version": "19.11.0",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -36,10 +36,10 @@
36
36
  "docker-secrets.js"
37
37
  ],
38
38
  "scripts": {
39
- "prepare": "husky install",
40
39
  "prepublishOnly": "pinst --disable",
41
40
  "postpublish": "pinst --enable",
42
- "test": "node --test"
41
+ "test": "node --test",
42
+ "prepare": "husky"
43
43
  },
44
44
  "lint-staged": {
45
45
  "*.{js,jsx,md,ts}": [
@@ -52,37 +52,11 @@
52
52
  "semi": false,
53
53
  "singleQuote": true
54
54
  },
55
- "eslintConfig": {
56
- "parserOptions": {
57
- "ecmaFeatures": {
58
- "ecmaVersion": 15
59
- }
60
- },
61
- "extends": [
62
- "standard",
63
- "prettier",
64
- "prettier/prettier"
65
- ],
66
- "rules": {
67
- "quotes": [
68
- "error",
69
- "single",
70
- {
71
- "avoidEscape": true,
72
- "allowTemplateLiterals": true
73
- }
74
- ]
75
- }
76
- },
77
- "eslintIgnore": [
78
- "/__tests__",
79
- "**/*.d.ts"
80
- ],
81
55
  "dependencies": {
82
- "@aws-sdk/client-s3": "^3.614.0",
56
+ "@aws-sdk/client-s3": "^3.627.0",
83
57
  "@elastic/elasticsearch": "^8.14.0",
84
58
  "@elastic/transport": "^8.7.0",
85
- "@nxtedition/nxt-undici": "^4.2.1",
59
+ "@nxtedition/nxt-undici": "^4.2.5",
86
60
  "content-type": "^1.0.5",
87
61
  "date-fns": "^3.6.0",
88
62
  "fast-querystring": "^1.1.1",
@@ -97,32 +71,33 @@
97
71
  "nested-error-stacks": "^2.1.1",
98
72
  "object-hash": "^3.0.0",
99
73
  "p-queue": "^8.0.1",
100
- "pino": "^9.3.1",
101
- "qs": "^6.12.3",
74
+ "pino": "^9.3.2",
75
+ "qs": "^6.13.0",
102
76
  "request-target": "^1.0.2",
103
77
  "smpte-timecode": "^1.3.6",
104
78
  "split-string": "^6.0.0",
105
- "undici": "^6.19.2",
79
+ "undici": "^6.19.7",
106
80
  "url-join": "^5.0.0"
107
81
  },
108
82
  "devDependencies": {
109
- "@nxtedition/deepstream.io-client-js": ">=24.2.4",
83
+ "@nxtedition/deepstream.io-client-js": ">=25.6.3",
110
84
  "@types/lodash": "^4.17.7",
111
- "@types/node": "^20.14.11",
112
- "eslint": "^8.0.0",
85
+ "@types/node": "^22.2.0",
86
+ "eslint": "^9.9.0",
113
87
  "eslint-config-prettier": "^9.1.0",
114
88
  "eslint-config-standard": "^17.0.0",
115
89
  "eslint-plugin-import": "^2.29.1",
116
- "eslint-plugin-n": "^17.9.0",
90
+ "eslint-plugin-n": "^17.10.2",
117
91
  "eslint-plugin-node": "^11.1.0",
118
- "eslint-plugin-promise": "^6.4.0",
119
- "husky": "^9.0.11",
120
- "lint-staged": "^15.2.7",
92
+ "eslint-plugin-promise": "^7.1.0",
93
+ "husky": "^9.1.4",
94
+ "lint-staged": "^15.2.8",
121
95
  "pinst": "^3.0.0",
122
96
  "prettier": "^3.3.3",
123
97
  "rxjs": "^7.5.6",
124
98
  "send": "^0.18.0",
125
- "tap": "^21.0.0"
99
+ "tap": "^21.0.0",
100
+ "typescript-eslint": "^8.0.1"
126
101
  },
127
102
  "peerDependencies": {
128
103
  "@elastic/elasticsearch": "^8.6.0",
@@ -3,7 +3,6 @@ import { Observable, from, throwError } from 'rxjs'
3
3
  const EMPTY = Object.freeze([])
4
4
 
5
5
  function combineMapImpl(project, equals = (a, b) => a === b) {
6
- const self = this
7
6
  return new Observable((o) => {
8
7
  let curr = EMPTY
9
8
  let scheduled = false
@@ -39,7 +38,7 @@ function combineMapImpl(project, equals = (a, b) => a === b) {
39
38
  }
40
39
 
41
40
  active += 1
42
- const subscription = self.subscribe({
41
+ const subscription = this.subscribe({
43
42
  next(keys) {
44
43
  keys = Array.isArray(keys) ? keys : EMPTY
45
44
 
package/serializers.js CHANGED
@@ -186,7 +186,7 @@ function errSerializer(err) {
186
186
  }
187
187
 
188
188
  if (_err.statusCode == null && _err.status != null) {
189
- _err.statusCode = Number(_err.status) ?? undefined
189
+ _err.statusCode = Number(_err.status) || undefined
190
190
  }
191
191
 
192
192
  if (_err.signalCode == null && _err.signal != null) {
package/timers.js CHANGED
@@ -1,10 +1,10 @@
1
- let fastNow = Date.now()
1
+ let fastNow = 0
2
2
  let fastNowTimeout
3
3
 
4
4
  const fastTimers = []
5
5
 
6
6
  function onTimeout() {
7
- fastNow = Date.now()
7
+ fastNow += 500
8
8
 
9
9
  let len = fastTimers.length
10
10
  let idx = 0
@@ -41,7 +41,7 @@ function refreshTimeout() {
41
41
  fastNowTimeout.refresh()
42
42
  } else {
43
43
  clearTimeout(fastNowTimeout)
44
- fastNowTimeout = setTimeout(onTimeout, 1e3)
44
+ fastNowTimeout = setTimeout(onTimeout, 500)
45
45
  if (fastNowTimeout.unref) {
46
46
  fastNowTimeout.unref()
47
47
  }
@@ -18,7 +18,7 @@ function asFilter(transform, predicate, obj) {
18
18
  try {
19
19
  value = transform ? transform(value, options) : value
20
20
  return !predicate || predicate(value, options) ? filter(value, options) : null
21
- } catch (err) {
21
+ } catch {
22
22
  return null
23
23
  }
24
24
  }
package/weakCache.js CHANGED
@@ -1,5 +1,3 @@
1
- /* globals WeakRef FinalizationRegistry */
2
-
3
1
  export function makeWeakCache(valueSelector, keySelector) {
4
2
  const cache = new Map()
5
3
  const finalizationRegistry = new FinalizationRegistry((key) => {