spine-framework 0.1.10 → 0.1.12

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.
@@ -73,8 +73,7 @@ const dbSchema: string = _env.DB_SCHEMA || 'public'
73
73
  * ```
74
74
  */
75
75
  export const adminDb = createClient(supabaseUrl, supabaseServiceKey, {
76
- db: { schema: dbSchema },
77
- realtime: { transport: typeof WebSocket !== 'undefined' ? WebSocket : undefined } as any,
76
+ db: { schema: dbSchema }
78
77
  })
79
78
 
80
79
  // ─── CHUNK_START: SHARED_DB_GET_USER_DB ──────────────────────────────────────────────
@@ -24,6 +24,20 @@ for (let i = 0; i < args.length; i++) {
24
24
  if (args[i] === '--service-role-key' && args[i + 1]) childEnv.SUPABASE_SERVICE_ROLE_KEY = args[++i]
25
25
  }
26
26
 
27
+ // On Node < 22, supabase-js Realtime crashes if WebSocket is not globally available.
28
+ // Polyfill it via a small inline require so every createClient() call across all
29
+ // _shared modules finds a valid WebSocket constructor at module load time.
30
+ const wsPolyfillPath = resolve(pkgRoot, 'node_modules/ws')
31
+ const wsPolyfillExists = fs.existsSync(wsPolyfillPath)
32
+ if (wsPolyfillExists && !childEnv.SUPABASE_WS_PATCHED) {
33
+ const major = parseInt(process.version.replace('v', '').split('.')[0], 10)
34
+ if (major < 22) {
35
+ const wsShimPath = resolve(pkgRoot, 'bin/ws-shim.cjs')
36
+ childEnv.NODE_OPTIONS = `--require ${wsShimPath}${childEnv.NODE_OPTIONS ? ' ' + childEnv.NODE_OPTIONS : ''}`
37
+ childEnv.SUPABASE_WS_PATCHED = '1'
38
+ }
39
+ }
40
+
27
41
  const entry = resolve(pkgRoot, '.framework/cli/index.ts')
28
42
 
29
43
  // Find tsx: prefer consuming project's copy, fall back to our own
@@ -0,0 +1,8 @@
1
+ // Polyfill globalThis.WebSocket with the 'ws' package for Node < 22.
2
+ // Required by supabase-js Realtime client which checks for WebSocket at construction time.
3
+ if (typeof globalThis.WebSocket === 'undefined') {
4
+ try {
5
+ const { WebSocket } = require('ws')
6
+ globalThis.WebSocket = WebSocket
7
+ } catch {}
8
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../.framework/functions/_shared/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0BH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,OAAO,iFAGlB,CAAA;AAGF;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,mFAWpC;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IACd,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,KAAK;;;;;;;;CAQjB,CAAA"}
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../.framework/functions/_shared/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0BH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,OAAO,iFAElB,CAAA;AAGF;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,mFAWpC;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IACd,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,KAAK;;;;;;;;CAQjB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "private": false,
5
5
  "description": "Spine — enterprise application framework built on Supabase + Netlify + React",
6
6
  "type": "module",
@@ -89,7 +89,8 @@
89
89
  "commander": "^12.0.0",
90
90
  "jsonwebtoken": "^9.0.3",
91
91
  "jwt-decode": "^4.0.0",
92
- "tsx": "^4.21.0"
92
+ "tsx": "^4.21.0",
93
+ "ws": "^8.21.0"
93
94
  },
94
95
  "peerDependencies": {
95
96
  "@netlify/functions": "^2.0.0",