@supabase/supabase-js 2.91.1 → 2.91.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": "@supabase/supabase-js",
3
- "version": "2.91.1",
3
+ "version": "2.91.2",
4
4
  "description": "Isomorphic Javascript SDK for Supabase",
5
5
  "keywords": [
6
6
  "javascript",
@@ -70,11 +70,11 @@
70
70
  "update:test-deps:bun": "cd test/integration/bun && bun install"
71
71
  },
72
72
  "dependencies": {
73
- "@supabase/auth-js": "2.91.1",
74
- "@supabase/functions-js": "2.91.1",
75
- "@supabase/postgrest-js": "2.91.1",
76
- "@supabase/realtime-js": "2.91.1",
77
- "@supabase/storage-js": "2.91.1"
73
+ "@supabase/auth-js": "2.91.2",
74
+ "@supabase/functions-js": "2.91.2",
75
+ "@supabase/postgrest-js": "2.91.2",
76
+ "@supabase/realtime-js": "2.91.2",
77
+ "@supabase/storage-js": "2.91.2"
78
78
  },
79
79
  "devDependencies": {
80
80
  "jsr": "^0.13.5",
@@ -15,7 +15,137 @@ if (typeof Deno !== 'undefined') {
15
15
  JS_ENV = 'node'
16
16
  }
17
17
 
18
- export const DEFAULT_HEADERS = { 'X-Client-Info': `supabase-js-${JS_ENV}/${version}` }
18
+ export function getClientPlatform(): string | null {
19
+ // @ts-ignore
20
+ if (typeof process !== 'undefined' && process.platform) {
21
+ // @ts-ignore
22
+ const platform = process.platform
23
+ if (platform === 'darwin') return 'macOS'
24
+ if (platform === 'win32') return 'Windows'
25
+ if (platform === 'linux') return 'Linux'
26
+ if (platform === 'android') return 'Android'
27
+ }
28
+
29
+ // @ts-ignore
30
+ if (typeof navigator !== 'undefined') {
31
+ // Modern User-Agent Client Hints API
32
+ // @ts-ignore
33
+ if (navigator.userAgentData && navigator.userAgentData.platform) {
34
+ // @ts-ignore
35
+ const platform = navigator.userAgentData.platform
36
+ if (platform === 'macOS') return 'macOS'
37
+ if (platform === 'Windows') return 'Windows'
38
+ if (platform === 'Linux') return 'Linux'
39
+ if (platform === 'Android') return 'Android'
40
+ if (platform === 'iOS') return 'iOS'
41
+ }
42
+ }
43
+
44
+ return null
45
+ }
46
+
47
+ export function getClientPlatformVersion(): string | null {
48
+ // Node.js / Bun environment
49
+ // @ts-ignore
50
+ if (typeof process !== 'undefined' && process.versions && process.versions.node) {
51
+ try {
52
+ // @ts-ignore
53
+ const os = require('os')
54
+ return os.release()
55
+ } catch (error) {
56
+ return null
57
+ }
58
+ }
59
+
60
+ // Deno environment
61
+ // @ts-ignore
62
+ if (typeof Deno !== 'undefined' && Deno.osRelease) {
63
+ try {
64
+ // @ts-ignore
65
+ return Deno.osRelease()
66
+ } catch (error) {
67
+ return null
68
+ }
69
+ }
70
+
71
+ // Browser environment
72
+ // @ts-ignore
73
+ if (typeof navigator !== 'undefined') {
74
+ // Modern User-Agent Client Hints API
75
+ // @ts-ignore
76
+ if (navigator.userAgentData && navigator.userAgentData.platformVersion) {
77
+ // @ts-ignore
78
+ return navigator.userAgentData.platformVersion
79
+ }
80
+ }
81
+
82
+ return null
83
+ }
84
+
85
+ export function getClientRuntime(): string | null {
86
+ // @ts-ignore
87
+ if (typeof Deno !== 'undefined') {
88
+ return 'deno'
89
+ }
90
+ // @ts-ignore
91
+ if (typeof Bun !== 'undefined') {
92
+ return 'bun'
93
+ }
94
+ // @ts-ignore
95
+ if (typeof process !== 'undefined' && process.versions && process.versions.node) {
96
+ return 'node'
97
+ }
98
+ return null
99
+ }
100
+
101
+ export function getClientRuntimeVersion(): string | null {
102
+ // @ts-ignore
103
+ if (typeof Deno !== 'undefined' && Deno.version) {
104
+ // @ts-ignore
105
+ return Deno.version.deno
106
+ }
107
+ // @ts-ignore
108
+ if (typeof Bun !== 'undefined' && Bun.version) {
109
+ // @ts-ignore
110
+ return Bun.version
111
+ }
112
+ // @ts-ignore
113
+ if (typeof process !== 'undefined' && process.versions && process.versions.node) {
114
+ // @ts-ignore
115
+ return process.versions.node
116
+ }
117
+ return null
118
+ }
119
+
120
+ function buildHeaders() {
121
+ const headers: Record<string, string> = {
122
+ 'X-Client-Info': `supabase-js-${JS_ENV}/${version}`,
123
+ }
124
+
125
+ const platform = getClientPlatform()
126
+ if (platform) {
127
+ headers['X-Supabase-Client-Platform'] = platform
128
+ }
129
+
130
+ const platformVersion = getClientPlatformVersion()
131
+ if (platformVersion) {
132
+ headers['X-Supabase-Client-Platform-Version'] = platformVersion
133
+ }
134
+
135
+ const runtime = getClientRuntime()
136
+ if (runtime) {
137
+ headers['X-Supabase-Client-Runtime'] = runtime
138
+ }
139
+
140
+ const runtimeVersion = getClientRuntimeVersion()
141
+ if (runtimeVersion) {
142
+ headers['X-Supabase-Client-Runtime-Version'] = runtimeVersion
143
+ }
144
+
145
+ return headers
146
+ }
147
+
148
+ export const DEFAULT_HEADERS = buildHeaders()
19
149
 
20
150
  export const DEFAULT_GLOBAL_OPTIONS = {
21
151
  headers: DEFAULT_HEADERS,
@@ -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.91.1'
7
+ export const version = '2.91.2'