@supabase/realtime-js 2.72.1-canary.8 → 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.
- package/README.md +1 -1
- package/dist/main/RealtimeChannel.d.ts.map +1 -1
- package/dist/main/RealtimeChannel.js +4 -3
- package/dist/main/RealtimeChannel.js.map +1 -1
- package/dist/main/RealtimeClient.d.ts +2 -0
- package/dist/main/RealtimeClient.d.ts.map +1 -1
- package/dist/main/RealtimeClient.js +30 -8
- package/dist/main/RealtimeClient.js.map +1 -1
- package/dist/main/lib/constants.d.ts +2 -2
- package/dist/main/lib/transformers.d.ts +1 -1
- package/dist/main/lib/transformers.d.ts.map +1 -1
- package/dist/main/lib/transformers.js +3 -0
- package/dist/main/lib/transformers.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/websocket-factory.d.ts.map +1 -1
- package/dist/main/lib/websocket-factory.js +24 -18
- package/dist/main/lib/websocket-factory.js.map +1 -1
- package/dist/module/RealtimeChannel.d.ts.map +1 -1
- package/dist/module/RealtimeChannel.js +4 -3
- package/dist/module/RealtimeChannel.js.map +1 -1
- package/dist/module/RealtimeClient.d.ts +2 -0
- package/dist/module/RealtimeClient.d.ts.map +1 -1
- package/dist/module/RealtimeClient.js +30 -8
- package/dist/module/RealtimeClient.js.map +1 -1
- package/dist/module/lib/constants.d.ts +2 -2
- package/dist/module/lib/transformers.d.ts +1 -1
- package/dist/module/lib/transformers.d.ts.map +1 -1
- package/dist/module/lib/transformers.js +3 -0
- package/dist/module/lib/transformers.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/websocket-factory.d.ts.map +1 -1
- package/dist/module/lib/websocket-factory.js +24 -18
- package/dist/module/lib/websocket-factory.js.map +1 -1
- package/package.json +4 -4
- package/src/RealtimeChannel.ts +3 -2
- package/src/RealtimeClient.ts +23 -5
- package/src/lib/transformers.ts +5 -1
- package/src/lib/version.ts +1 -1
- package/src/lib/websocket-factory.ts +27 -21
package/src/lib/transformers.ts
CHANGED
|
@@ -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
|
package/src/lib/version.ts
CHANGED
|
@@ -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.
|
|
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'
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
97
|
+
|
|
98
|
+
// Node.js < 22 doesn't have native WebSocket
|
|
86
99
|
return {
|
|
87
100
|
type: 'unsupported',
|
|
88
|
-
error: `Node.js ${nodeVersion} detected
|
|
89
|
-
workaround:
|
|
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 {
|