@risingwave/wavelet-server 0.1.1 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@risingwave/wavelet-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Wavelet server - WebSocket fanout layer for RisingWave",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "pg": "^8.13.0",
14
14
  "ws": "^8.18.0",
15
15
  "jose": "^6.0.0",
16
- "@risingwave/wavelet": "0.1.1"
16
+ "@risingwave/wavelet": "0.1.2"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/pg": "^8.11.0",
@@ -5,9 +5,17 @@ import type { WaveletConfig } from '@risingwave/wavelet'
5
5
  export async function loadConfig(configPath: string): Promise<WaveletConfig> {
6
6
  const abs = resolve(configPath)
7
7
  const mod = await import(pathToFileURL(abs).href)
8
- const config = mod.default ?? mod
9
8
 
10
- if (!config.database) {
9
+ // Handle various module formats:
10
+ // - ESM: mod.default is the config
11
+ // - CJS interop: mod.default.default is the config
12
+ // - Plain object: mod itself is the config
13
+ let config = mod.default ?? mod
14
+ if (config && typeof config === 'object' && 'default' in config) {
15
+ config = config.default
16
+ }
17
+
18
+ if (!config || !config.database) {
11
19
  throw new Error(
12
20
  `wavelet.config.ts must export a config with a 'database' field.\n` +
13
21
  `Example:\n` +