@trpc/client 11.0.0-alpha-tmp-subscription-connection-state.485 → 11.0.0-alpha-tmp-subscription-connection-state.486

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.
@@ -1,20 +1,20 @@
1
1
  {
2
- "bundleSize": 57149,
3
- "bundleOrigSize": 76725,
4
- "bundleReduction": 25.51,
2
+ "bundleSize": 57199,
3
+ "bundleOrigSize": 76775,
4
+ "bundleReduction": 25.5,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/links/wsLink.ts",
8
- "size": 16017,
9
- "origSize": 17038,
8
+ "size": 16042,
9
+ "origSize": 17063,
10
10
  "renderedExports": [
11
11
  "createWSClient",
12
12
  "wsLink"
13
13
  ],
14
14
  "removedExports": [],
15
15
  "dependents": [],
16
- "percent": 28.03,
17
- "reduction": 5.99
16
+ "percent": 28.05,
17
+ "reduction": 5.98
18
18
  },
19
19
  {
20
20
  "id": "/src/links/httpBatchStreamLink.ts",
@@ -25,19 +25,19 @@
25
25
  ],
26
26
  "removedExports": [],
27
27
  "dependents": [],
28
- "percent": 10.26,
28
+ "percent": 10.25,
29
29
  "reduction": 3.51
30
30
  },
31
31
  {
32
32
  "id": "/src/links/httpSubscriptionLink.ts",
33
- "size": 5727,
34
- "origSize": 5459,
33
+ "size": 5752,
34
+ "origSize": 5484,
35
35
  "renderedExports": [
36
36
  "unstable_httpSubscriptionLink"
37
37
  ],
38
38
  "removedExports": [],
39
39
  "dependents": [],
40
- "percent": 10.02,
40
+ "percent": 10.06,
41
41
  "reduction": 0
42
42
  },
43
43
  {
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "removedExports": [],
51
51
  "dependents": [],
52
- "percent": 9.55,
52
+ "percent": 9.54,
53
53
  "reduction": 18.48
54
54
  },
55
55
  {
@@ -68,8 +68,8 @@
68
68
  ],
69
69
  "removedExports": [],
70
70
  "dependents": [
71
- "/src/links/httpBatchLink.ts",
72
71
  "/src/links/httpLink.ts",
72
+ "/src/links/httpBatchLink.ts",
73
73
  "/src/links/httpBatchStreamLink.ts",
74
74
  "/src/links/httpSubscriptionLink.ts"
75
75
  ],
@@ -88,7 +88,7 @@
88
88
  "/src/links/httpBatchLink.ts",
89
89
  "/src/links/httpBatchStreamLink.ts"
90
90
  ],
91
- "percent": 7.15,
91
+ "percent": 7.14,
92
92
  "reduction": 5.64
93
93
  },
94
94
  {
@@ -100,7 +100,7 @@
100
100
  ],
101
101
  "removedExports": [],
102
102
  "dependents": [],
103
- "percent": 6.87,
103
+ "percent": 6.86,
104
104
  "reduction": 4.69
105
105
  },
106
106
  {
@@ -127,7 +127,7 @@
127
127
  "/src/createTRPCUntypedClient.ts",
128
128
  "/src/createTRPCClient.ts"
129
129
  ],
130
- "percent": 4,
130
+ "percent": 3.99,
131
131
  "reduction": 47.25
132
132
  },
133
133
  {
@@ -140,8 +140,8 @@
140
140
  "removedExports": [],
141
141
  "dependents": [
142
142
  "/src/index.ts",
143
- "/src/links/httpBatchLink.ts",
144
143
  "/src/links/httpLink.ts",
144
+ "/src/links/httpBatchLink.ts",
145
145
  "/src/links/wsLink.ts",
146
146
  "/src/links/httpBatchStreamLink.ts",
147
147
  "/src/links/httpSubscriptionLink.ts",
@@ -78,7 +78,7 @@ async function urlWithConnectionParams(opts) {
78
78
  if (eventSource?.readyState === EventSource.CLOSED) {
79
79
  return;
80
80
  }
81
- const error = event instanceof ErrorEvent ? TRPCClientError.TRPCClientError.from(event.error) : TRPCClientError.TRPCClientError.from(new Error(`Unknown EventSource error`));
81
+ const error = globalThis.ErrorEvent && event instanceof ErrorEvent ? TRPCClientError.TRPCClientError.from(event.error) : TRPCClientError.TRPCClientError.from(new Error(`Unknown EventSource error`));
82
82
  observer.next({
83
83
  result: {
84
84
  type: 'state',
@@ -76,7 +76,7 @@ async function urlWithConnectionParams(opts) {
76
76
  if (eventSource?.readyState === EventSource.CLOSED) {
77
77
  return;
78
78
  }
79
- const error = event instanceof ErrorEvent ? TRPCClientError.from(event.error) : TRPCClientError.from(new Error(`Unknown EventSource error`));
79
+ const error = globalThis.ErrorEvent && event instanceof ErrorEvent ? TRPCClientError.from(event.error) : TRPCClientError.from(new Error(`Unknown EventSource error`));
80
80
  observer.next({
81
81
  result: {
82
82
  type: 'state',
@@ -184,7 +184,7 @@ function createWSClient(opts) {
184
184
  });
185
185
  });
186
186
  ws.addEventListener('error', (event)=>{
187
- if (event instanceof ErrorEvent) {
187
+ if (globalThis.ErrorEvent && event instanceof ErrorEvent) {
188
188
  onError(event.error);
189
189
  } else {
190
190
  onError(new Error('Unknown WebSocket error'));
@@ -182,7 +182,7 @@ function createWSClient(opts) {
182
182
  });
183
183
  });
184
184
  ws.addEventListener('error', (event)=>{
185
- if (event instanceof ErrorEvent) {
185
+ if (globalThis.ErrorEvent && event instanceof ErrorEvent) {
186
186
  onError(event.error);
187
187
  } else {
188
188
  onError(new Error('Unknown WebSocket error'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/client",
3
- "version": "11.0.0-alpha-tmp-subscription-connection-state.485+386eae02c",
3
+ "version": "11.0.0-alpha-tmp-subscription-connection-state.486+fb825f371",
4
4
  "description": "The tRPC client library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -76,10 +76,10 @@
76
76
  "!**/*.test.*"
77
77
  ],
78
78
  "peerDependencies": {
79
- "@trpc/server": "11.0.0-alpha-tmp-subscription-connection-state.485+386eae02c"
79
+ "@trpc/server": "11.0.0-alpha-tmp-subscription-connection-state.486+fb825f371"
80
80
  },
81
81
  "devDependencies": {
82
- "@trpc/server": "11.0.0-alpha-tmp-subscription-connection-state.485+386eae02c",
82
+ "@trpc/server": "11.0.0-alpha-tmp-subscription-connection-state.486+fb825f371",
83
83
  "@types/isomorphic-fetch": "^0.0.39",
84
84
  "@types/node": "^20.10.0",
85
85
  "eslint": "^8.56.0",
@@ -96,5 +96,5 @@
96
96
  "funding": [
97
97
  "https://trpc.io/sponsor"
98
98
  ],
99
- "gitHead": "386eae02c675ba0fe0feda78188b6975e56d0e49"
99
+ "gitHead": "fb825f371eeffc9b17a3621fcd4acf9990913d8f"
100
100
  }
@@ -121,7 +121,7 @@ export function unstable_httpSubscriptionLink<
121
121
  }
122
122
 
123
123
  const error =
124
- event instanceof ErrorEvent
124
+ globalThis.ErrorEvent && event instanceof ErrorEvent
125
125
  ? TRPCClientError.from(event.error)
126
126
  : TRPCClientError.from(new Error(`Unknown EventSource error`));
127
127
 
@@ -320,7 +320,7 @@ export function createWSClient(opts: WebSocketClientOptions) {
320
320
  });
321
321
  });
322
322
  ws.addEventListener('error', (event) => {
323
- if (event instanceof ErrorEvent) {
323
+ if (globalThis.ErrorEvent && event instanceof ErrorEvent) {
324
324
  onError(event.error);
325
325
  } else {
326
326
  onError(new Error('Unknown WebSocket error'));