@kumiai/hub-server 0.9.0 → 0.10.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.
@@ -241,7 +241,8 @@ function isLive(entry, nowSeconds) {
241
241
  startIndex = 0;
242
242
  } else {
243
243
  for(let index = 0; index < pending.length; index++){
244
- if (pending[index] > params.after) {
244
+ const sequenceID = pending[index];
245
+ if (sequenceID !== undefined && sequenceID > params.after) {
245
246
  startIndex = index;
246
247
  break;
247
248
  }
@@ -258,7 +259,7 @@ function isLive(entry, nowSeconds) {
258
259
  resultMessages.push(asStoredMessage(entry));
259
260
  }
260
261
  }
261
- const cursor = resultMessages.length > 0 ? resultMessages[resultMessages.length - 1].sequenceID : null;
262
+ const cursor = resultMessages.at(-1)?.sequenceID ?? null;
262
263
  const result = {
263
264
  messages: resultMessages,
264
265
  cursor
@@ -294,7 +295,7 @@ function isLive(entry, nowSeconds) {
294
295
  return {
295
296
  messages,
296
297
  head: heads.get(params.topicID) ?? null,
297
- oldest: log.length > 0 ? log[0] : null
298
+ oldest: log[0] ?? null
298
299
  };
299
300
  },
300
301
  async trim (params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumiai/hub-server",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Hub server for Enkaku E2EE group message routing",
5
5
  "keywords": [
6
6
  "hub",
@@ -28,7 +28,7 @@
28
28
  "@enkaku/protocol": "^0.21.1",
29
29
  "@enkaku/server": "^0.21.2",
30
30
  "@kokuin/token": "^0.5.0",
31
- "@kumiai/hub-protocol": "^0.9.0",
31
+ "@kumiai/hub-protocol": "^0.10.0",
32
32
  "@sozai/codec": "^0.4.0",
33
33
  "@sozai/event": "^0.1.3",
34
34
  "@sozai/log": "^0.3.1"
@@ -36,8 +36,8 @@
36
36
  "devDependencies": {
37
37
  "@enkaku/client": "^0.21.2",
38
38
  "@enkaku/transport": "^0.21.0",
39
- "@kumiai/hub-conformance": "^0.9.0",
40
- "@kumiai/hub-wake": "^0.9.0"
39
+ "@kumiai/hub-conformance": "^0.10.0",
40
+ "@kumiai/hub-wake": "^0.10.0"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -45,8 +45,8 @@
45
45
  "scripts": {
46
46
  "build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
47
47
  "build:clean": "del lib",
48
- "build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
49
- "build:types": "tsc --emitDeclarationOnly --skipLibCheck",
48
+ "build:js": "del 'lib/**/*.js' && swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
49
+ "build:types": "del 'lib/**/*.d.ts' 'lib/**/*.d.ts.map' && tsc --emitDeclarationOnly --skipLibCheck",
50
50
  "test": "pnpm run test:types && pnpm run test:unit",
51
51
  "test:types": "tsc --noEmit --skipLibCheck -p tsconfig.test.json",
52
52
  "test:unit": "vitest run"