@supabase/realtime-js 2.72.1-canary.9 → 2.80.1-canary.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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/main/RealtimeChannel.d.ts.map +1 -1
  3. package/dist/main/RealtimeChannel.js +4 -3
  4. package/dist/main/RealtimeChannel.js.map +1 -1
  5. package/dist/main/RealtimeClient.d.ts +2 -0
  6. package/dist/main/RealtimeClient.d.ts.map +1 -1
  7. package/dist/main/RealtimeClient.js +30 -8
  8. package/dist/main/RealtimeClient.js.map +1 -1
  9. package/dist/main/lib/constants.d.ts +2 -2
  10. package/dist/main/lib/transformers.d.ts +1 -1
  11. package/dist/main/lib/transformers.d.ts.map +1 -1
  12. package/dist/main/lib/transformers.js +3 -0
  13. package/dist/main/lib/transformers.js.map +1 -1
  14. package/dist/main/lib/version.d.ts +1 -1
  15. package/dist/main/lib/version.js +1 -1
  16. package/dist/main/lib/websocket-factory.d.ts.map +1 -1
  17. package/dist/main/lib/websocket-factory.js +24 -18
  18. package/dist/main/lib/websocket-factory.js.map +1 -1
  19. package/dist/module/RealtimeChannel.d.ts.map +1 -1
  20. package/dist/module/RealtimeChannel.js +4 -3
  21. package/dist/module/RealtimeChannel.js.map +1 -1
  22. package/dist/module/RealtimeClient.d.ts +2 -0
  23. package/dist/module/RealtimeClient.d.ts.map +1 -1
  24. package/dist/module/RealtimeClient.js +30 -8
  25. package/dist/module/RealtimeClient.js.map +1 -1
  26. package/dist/module/lib/constants.d.ts +2 -2
  27. package/dist/module/lib/transformers.d.ts +1 -1
  28. package/dist/module/lib/transformers.d.ts.map +1 -1
  29. package/dist/module/lib/transformers.js +3 -0
  30. package/dist/module/lib/transformers.js.map +1 -1
  31. package/dist/module/lib/version.d.ts +1 -1
  32. package/dist/module/lib/version.js +1 -1
  33. package/dist/module/lib/websocket-factory.d.ts.map +1 -1
  34. package/dist/module/lib/websocket-factory.js +24 -18
  35. package/dist/module/lib/websocket-factory.js.map +1 -1
  36. package/package.json +4 -4
  37. package/src/RealtimeChannel.ts +3 -2
  38. package/src/RealtimeClient.ts +23 -5
  39. package/src/lib/transformers.ts +5 -1
  40. package/src/lib/version.ts +1 -1
  41. package/src/lib/websocket-factory.ts +27 -21
@@ -60,11 +60,15 @@ type Record = {
60
60
  */
61
61
  export const convertChangeData = (
62
62
  columns: Columns,
63
- record: Record,
63
+ record: Record | null,
64
64
  options: { skipTypes?: string[] } = {}
65
65
  ): Record => {
66
66
  const skipTypes = options.skipTypes ?? []
67
67
 
68
+ if (!record) {
69
+ return {}
70
+ }
71
+
68
72
  return Object.keys(record).reduce((acc, rec_key) => {
69
73
  acc[rec_key] = convertColumn(rec_key, columns, record, skipTypes)
70
74
  return acc
@@ -4,4 +4,4 @@
4
4
  // - Debugging and support (identifying which version is running)
5
5
  // - Telemetry and logging (version reporting in errors/analytics)
6
6
  // - Ensuring build artifacts match the published package version
7
- export const version = '2.72.1-canary.9'
7
+ export const version = '2.80.1-canary.0'
@@ -73,32 +73,38 @@ export class WebSocketFactory {
73
73
  }
74
74
  }
75
75
 
76
- if (typeof process !== 'undefined' && process.versions && process.versions.node) {
77
- const nodeVersion = parseInt(process.versions.node.split('.')[0])
78
-
79
- // Node.js 22+ should have native WebSocket
80
- if (nodeVersion >= 22) {
81
- // Check if native WebSocket is available (should be in Node.js 22+)
82
- if (typeof globalThis.WebSocket !== 'undefined') {
83
- return { type: 'native', constructor: globalThis.WebSocket }
76
+ if (typeof process !== 'undefined') {
77
+ // Use dynamic property access to avoid Next.js Edge Runtime static analysis warnings
78
+ const processVersions = (process as any)['versions']
79
+ if (processVersions && processVersions['node']) {
80
+ // Remove 'v' prefix if present and parse the major version
81
+ const versionString = processVersions['node']
82
+ const nodeVersion = parseInt(versionString.replace(/^v/, '').split('.')[0])
83
+
84
+ // Node.js 22+ should have native WebSocket
85
+ if (nodeVersion >= 22) {
86
+ // Check if native WebSocket is available (should be in Node.js 22+)
87
+ if (typeof globalThis.WebSocket !== 'undefined') {
88
+ return { type: 'native', constructor: globalThis.WebSocket }
89
+ }
90
+ // If not available, user needs to provide it
91
+ return {
92
+ type: 'unsupported',
93
+ error: `Node.js ${nodeVersion} detected but native WebSocket not found.`,
94
+ workaround: 'Provide a WebSocket implementation via the transport option.',
95
+ }
84
96
  }
85
- // If not available, user needs to provide it
97
+
98
+ // Node.js < 22 doesn't have native WebSocket
86
99
  return {
87
100
  type: 'unsupported',
88
- error: `Node.js ${nodeVersion} detected but native WebSocket not found.`,
89
- workaround: 'Provide a WebSocket implementation via the transport option.',
101
+ error: `Node.js ${nodeVersion} detected without native WebSocket support.`,
102
+ workaround:
103
+ 'For Node.js < 22, install "ws" package and provide it via the transport option:\n' +
104
+ 'import ws from "ws"\n' +
105
+ 'new RealtimeClient(url, { transport: ws })',
90
106
  }
91
107
  }
92
-
93
- // Node.js < 22 doesn't have native WebSocket
94
- return {
95
- type: 'unsupported',
96
- error: `Node.js ${nodeVersion} detected without native WebSocket support.`,
97
- workaround:
98
- 'For Node.js < 22, install "ws" package and provide it via the transport option:\n' +
99
- 'import ws from "ws"\n' +
100
- 'new RealtimeClient(url, { transport: ws })',
101
- }
102
108
  }
103
109
 
104
110
  return {