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

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
  {
@@ -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
  {
@@ -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',
@@ -114,7 +114,6 @@ async function urlWithConnectionParams(opts) {
114
114
  });
115
115
  }).catch((error)=>{
116
116
  const trpcError = TRPCClientError.TRPCClientError.from(error);
117
- observer.error(trpcError);
118
117
  observer.next({
119
118
  result: {
120
119
  type: 'state',
@@ -122,6 +121,7 @@ async function urlWithConnectionParams(opts) {
122
121
  data: TRPCClientError.TRPCClientError.from(trpcError)
123
122
  }
124
123
  });
124
+ observer.error(trpcError);
125
125
  });
126
126
  return ()=>{
127
127
  observer.complete();
@@ -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',
@@ -112,7 +112,6 @@ async function urlWithConnectionParams(opts) {
112
112
  });
113
113
  }).catch((error)=>{
114
114
  const trpcError = TRPCClientError.from(error);
115
- observer.error(trpcError);
116
115
  observer.next({
117
116
  result: {
118
117
  type: 'state',
@@ -120,6 +119,7 @@ async function urlWithConnectionParams(opts) {
120
119
  data: TRPCClientError.from(trpcError)
121
120
  }
122
121
  });
122
+ observer.error(trpcError);
123
123
  });
124
124
  return ()=>{
125
125
  observer.complete();
@@ -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.487+b2f85a07a",
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.487+b2f85a07a"
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.487+b2f85a07a",
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": "b2f85a07a4f64586d8e9b7dfa747ddeb2ee9c8f2"
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
 
@@ -165,7 +165,6 @@ export function unstable_httpSubscriptionLink<
165
165
  }).catch((error) => {
166
166
  const trpcError = TRPCClientError.from(error);
167
167
 
168
- observer.error(trpcError);
169
168
  observer.next({
170
169
  result: {
171
170
  type: 'state',
@@ -173,6 +172,7 @@ export function unstable_httpSubscriptionLink<
173
172
  data: TRPCClientError.from(trpcError),
174
173
  },
175
174
  });
175
+ observer.error(trpcError);
176
176
  });
177
177
 
178
178
  return () => {
@@ -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'));