@laplace.live/event-bridge-server 0.3.1 → 0.3.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 (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/index.ts +11 -8
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @laplace.live/event-bridge-server
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e8a96e2: Migrate linter from eslint to biome
8
+
3
9
  ## 0.3.1
4
10
 
5
11
  ### Patch Changes
package/index.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { parseArgs } from 'util'
1
+ import { parseArgs } from 'node:util'
2
2
  import type { LaplaceEvent } from '@laplace.live/event-types'
3
3
 
4
+ import pkg from './package.json' with { type: 'json' }
5
+
4
6
  // Parse command line arguments properly
5
7
  const { values } = parseArgs({
6
8
  args: Bun.argv,
@@ -19,13 +21,13 @@ const { values } = parseArgs({
19
21
  })
20
22
 
21
23
  // Get authentication token from environment variable or CLI
22
- const AUTH_TOKEN = process.env['LEB_AUTH'] || process.env['LAPLACE_EVENT_BRIDGE_AUTH'] || values.auth || ''
24
+ const AUTH_TOKEN = process.env.LEB_AUTH || process.env.LAPLACE_EVENT_BRIDGE_AUTH || values.auth || ''
23
25
 
24
26
  // Debug mode configuration
25
- const DEBUG_MODE = process.env['DEBUG'] === '1' || process.env['DEBUG']?.toLowerCase() === 'true' || !!values.debug
27
+ const DEBUG_MODE = process.env.DEBUG === '1' || process.env.DEBUG?.toLowerCase() === 'true' || !!values.debug
26
28
 
27
29
  // Network interface configuration
28
- const HOST = process.env['HOST'] || (values.host as string) || 'localhost'
30
+ const HOST = process.env.HOST || (values.host as string) || 'localhost'
29
31
 
30
32
  interface Client {
31
33
  id: string
@@ -83,7 +85,8 @@ const server = Bun.serve<Client, {}>({
83
85
  type: 'established',
84
86
  clientId,
85
87
  isServer,
86
- message: 'Connected to LAPLACE Event bridge',
88
+ version: pkg.version,
89
+ message: 'Connected to LAPLACE Event Bridge',
87
90
  })
88
91
  )
89
92
  },
@@ -94,7 +97,7 @@ const server = Bun.serve<Client, {}>({
94
97
  try {
95
98
  const messageStr = message.toString()
96
99
  let parsedMessage: LaplaceEvent
97
- let broadcastMessage
100
+ let broadcastMessage: unknown
98
101
 
99
102
  try {
100
103
  // Try to parse as JSON
@@ -111,7 +114,7 @@ const server = Bun.serve<Client, {}>({
111
114
  ...parsedMessage,
112
115
  source: clientId,
113
116
  })
114
- } catch (e) {
117
+ } catch {
115
118
  // Handle as plain text if not JSON
116
119
  console.log(`Received message from ${clientId}: ${messageStr}`)
117
120
 
@@ -131,7 +134,7 @@ const server = Bun.serve<Client, {}>({
131
134
  // console.log(`Broadcasting message from laplace-chat to all clients`)
132
135
 
133
136
  // Broadcast to all clients except the server
134
- for (const [client, data] of clients.entries()) {
137
+ for (const [client, _data] of clients.entries()) {
135
138
  if (client !== ws) {
136
139
  client.send(broadcastMessage)
137
140
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@laplace.live/event-bridge-server",
3
3
  "description": "LAPLACE Event Bridge Server",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "module": "index.ts",