@nxtedition/lib 28.0.28 → 28.0.30

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
@@ -63,11 +63,12 @@ export function makeApp(appConfig, onTerminateOrMeta, metaOrNull) {
63
63
 
64
64
  if (typeof onTerminateOrMeta === 'function') {
65
65
  meta = metaOrNull
66
+ onTerminate = onTerminateOrMeta
66
67
  } else {
67
68
  meta = onTerminateOrMeta ?? metaOrNull
68
69
  }
69
70
 
70
- if (onTerminate != null && typeof onTerminateOrMeta !== 'function') {
71
+ if (onTerminate != null && typeof onTerminate !== 'function') {
71
72
  throw new Error('onTerminate must be a function or null')
72
73
  }
73
74
 
@@ -187,7 +188,7 @@ export function makeApp(appConfig, onTerminateOrMeta, metaOrNull) {
187
188
  }
188
189
 
189
190
  globalThis.__nxt_undici_global_headers = {
190
- ...(globalThis.__nxt_undici_global_headers ?? {}),
191
+ ...globalThis.__nxt_undici_global_headers,
191
192
  'nxt-module': serviceModule,
192
193
  'nxt-instance-id': serviceInstanceId,
193
194
  'nxt-worker-id': String(serviceWorkerId),
package/errors.d.ts CHANGED
@@ -42,6 +42,7 @@ export interface MessageOptions {
42
42
  }
43
43
 
44
44
  export function makeMessages(
45
+ // oxlint-disable-next-line typescript/no-redundant-type-constituents
45
46
  error: MessageError | MessageError[],
46
47
  options?: MessageOptions,
47
48
  ): Message[]
package/fixed-queue.js CHANGED
@@ -75,7 +75,9 @@ class FixedCircularBuffer {
75
75
 
76
76
  shift() {
77
77
  const nextItem = this.list[this.bottom]
78
- if (nextItem === undefined) return null
78
+ if (nextItem === undefined) {
79
+ return null
80
+ }
79
81
  this.list[this.bottom] = undefined
80
82
  this.bottom = (this.bottom + 1) & kMask
81
83
  return nextItem
package/http.js CHANGED
@@ -1225,7 +1225,9 @@ export const compose = (...middleware) => {
1225
1225
  const funcs = middleware.flat()
1226
1226
 
1227
1227
  for (const fn of funcs) {
1228
- if (typeof fn !== 'function') throw new TypeError('Middleware must be composed of functions!')
1228
+ if (typeof fn !== 'function') {
1229
+ throw new TypeError('Middleware must be composed of functions!')
1230
+ }
1229
1231
  }
1230
1232
 
1231
1233
  if (process.env.NODE_ENV === 'production') {
@@ -1235,12 +1237,16 @@ export const compose = (...middleware) => {
1235
1237
  return async (ctx, next) => {
1236
1238
  const dispatch = async (i) => {
1237
1239
  const fn = i === funcs.length ? next : funcs[i]
1238
- if (!fn) return
1240
+ if (!fn) {
1241
+ return
1242
+ }
1239
1243
 
1240
1244
  let nextCalled = false
1241
1245
  let nextResolved = false
1242
1246
  const nextProxy = async () => {
1243
- if (nextCalled) throw Error('next() called multiple times')
1247
+ if (nextCalled) {
1248
+ throw Error('next() called multiple times')
1249
+ }
1244
1250
  nextCalled = true
1245
1251
  try {
1246
1252
  return await dispatch(i + 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "28.0.28",
3
+ "version": "28.0.30",
4
4
  "license": "UNLICENSED",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -45,16 +45,17 @@
45
45
  ],
46
46
  "scripts": {
47
47
  "test": "node --test-timeout 60000 --test",
48
- "test:types": "tsd"
48
+ "test:types": "tsd",
49
+ "test:ci": "node --test && tsd"
49
50
  },
50
51
  "dependencies": {
51
52
  "@elastic/elasticsearch": "^8.17.1",
52
53
  "@elastic/transport": "^8.9.3",
53
54
  "@nxtedition/nxt-undici": "^7.1.9",
54
55
  "@nxtedition/sched": "^1.0.2",
55
- "@nxtedition/template": "^1.0.11",
56
- "@nxtedition/weak-cache": "^1.0.2",
57
- "@nxtedition/yield": "^1.0.2",
56
+ "@nxtedition/template": "^1.0.12",
57
+ "@nxtedition/weak-cache": "^1.0.3",
58
+ "@nxtedition/yield": "^1.0.3",
58
59
  "diff": "5.2.0",
59
60
  "fast-querystring": "^1.1.2",
60
61
  "flamegraph-middleware": "^1.0.0",
@@ -92,5 +93,5 @@
92
93
  "canvas": "^3.1.0",
93
94
  "rxjs": "^7.0.0"
94
95
  },
95
- "gitHead": "496495d55ea9a51bfbde66c3ba6fba11cc62ccf5"
96
+ "gitHead": "0f407ebce03f670f13a733240af2a733ca56eefc"
96
97
  }
package/shared.js CHANGED
@@ -94,6 +94,9 @@ export function reader({ sharedState, sharedBuffer }) {
94
94
  // wrapped around to the beginning of the buffer.
95
95
  if (dataLen === -1) {
96
96
  readPos = 0
97
+ // After wrapping, we must re-check against the writer's position.
98
+ // It's possible the writer is now at a position > 0.
99
+ writePos = Atomics.load(state, WRITE_INDEX) | 0
97
100
  } else {
98
101
  if (dataLen < 0) {
99
102
  throw new Error('Invalid data length')
package/time.js CHANGED
@@ -15,8 +15,14 @@ export function isTimeBetween(date, startTime, endTime) {
15
15
  const currentMinutes = date.getMinutes()
16
16
 
17
17
  // Validate and parse start and end times
18
- if (!startTime) startTime = '00:00' // Default start at midnight
19
- if (!endTime) endTime = '23:59' // Default end at 23:59
18
+ if (!startTime) {
19
+ // Default start at midnight
20
+ startTime = '00:00'
21
+ }
22
+ if (!endTime) {
23
+ // Default end at 23:59
24
+ endTime = '23:59'
25
+ }
20
26
 
21
27
  const [startHours, startMinutes] = startTime.split(':').map(Number)
22
28
  const [endHours, endMinutes] = endTime.split(':').map(Number)