@trpc/client 11.0.0-alpha-tmp-issues-5851-take-two.481 → 11.0.0-alpha-tmp-issues-5851-take-two.485

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,7 +1,7 @@
1
1
  {
2
- "bundleSize": 51133,
3
- "bundleOrigSize": 68325,
4
- "bundleReduction": 25.16,
2
+ "bundleSize": 51041,
3
+ "bundleOrigSize": 68216,
4
+ "bundleReduction": 25.18,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/links/wsLink.ts",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "removedExports": [],
15
15
  "dependents": [],
16
- "percent": 25.56,
16
+ "percent": 25.6,
17
17
  "reduction": 10.22
18
18
  },
19
19
  {
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "removedExports": [],
27
27
  "dependents": [],
28
- "percent": 11.56,
28
+ "percent": 11.58,
29
29
  "reduction": 3.32
30
30
  },
31
31
  {
@@ -37,7 +37,7 @@
37
37
  ],
38
38
  "removedExports": [],
39
39
  "dependents": [],
40
- "percent": 10.67,
40
+ "percent": 10.69,
41
41
  "reduction": 18.48
42
42
  },
43
43
  {
@@ -52,7 +52,7 @@
52
52
  "/src/links/httpBatchLink.ts",
53
53
  "/src/links/httpBatchStreamLink.ts"
54
54
  ],
55
- "percent": 7.99,
55
+ "percent": 8,
56
56
  "reduction": 5.64
57
57
  },
58
58
  {
@@ -64,7 +64,7 @@
64
64
  ],
65
65
  "removedExports": [],
66
66
  "dependents": [],
67
- "percent": 7.77,
67
+ "percent": 7.78,
68
68
  "reduction": 4.4
69
69
  },
70
70
  {
@@ -83,12 +83,12 @@
83
83
  ],
84
84
  "removedExports": [],
85
85
  "dependents": [
86
- "/src/links/httpLink.ts",
87
86
  "/src/links/httpBatchLink.ts",
87
+ "/src/links/httpLink.ts",
88
88
  "/src/links/httpBatchStreamLink.ts",
89
89
  "/src/links/httpSubscriptionLink.ts"
90
90
  ],
91
- "percent": 7.18,
91
+ "percent": 7.19,
92
92
  "reduction": 37.5
93
93
  },
94
94
  {
@@ -100,7 +100,7 @@
100
100
  ],
101
101
  "removedExports": [],
102
102
  "dependents": [],
103
- "percent": 6.89,
103
+ "percent": 6.9,
104
104
  "reduction": 6.13
105
105
  },
106
106
  {
@@ -112,13 +112,13 @@
112
112
  ],
113
113
  "removedExports": [],
114
114
  "dependents": [],
115
- "percent": 6.23,
115
+ "percent": 6.24,
116
116
  "reduction": 14.15
117
117
  },
118
118
  {
119
119
  "id": "/src/internals/TRPCUntypedClient.ts",
120
- "size": 2254,
121
- "origSize": 4235,
120
+ "size": 2162,
121
+ "origSize": 4126,
122
122
  "renderedExports": [
123
123
  "TRPCUntypedClient"
124
124
  ],
@@ -127,8 +127,8 @@
127
127
  "/src/createTRPCUntypedClient.ts",
128
128
  "/src/createTRPCClient.ts"
129
129
  ],
130
- "percent": 4.41,
131
- "reduction": 46.78
130
+ "percent": 4.24,
131
+ "reduction": 47.6
132
132
  },
133
133
  {
134
134
  "id": "/src/TRPCClientError.ts",
@@ -140,14 +140,14 @@
140
140
  "removedExports": [],
141
141
  "dependents": [
142
142
  "/src/index.ts",
143
- "/src/links/httpLink.ts",
144
143
  "/src/links/httpBatchLink.ts",
144
+ "/src/links/httpLink.ts",
145
145
  "/src/links/wsLink.ts",
146
146
  "/src/links/httpBatchStreamLink.ts",
147
147
  "/src/links/httpSubscriptionLink.ts",
148
148
  "/src/internals/TRPCUntypedClient.ts"
149
149
  ],
150
- "percent": 3.79,
150
+ "percent": 3.8,
151
151
  "reduction": 45.43
152
152
  },
153
153
  {
@@ -164,7 +164,7 @@
164
164
  "dependents": [
165
165
  "/src/index.ts"
166
166
  ],
167
- "percent": 2.32,
167
+ "percent": 2.33,
168
168
  "reduction": 73.19
169
169
  },
170
170
  {
@@ -191,7 +191,7 @@
191
191
  ],
192
192
  "removedExports": [],
193
193
  "dependents": [],
194
- "percent": 1.19,
194
+ "percent": 1.2,
195
195
  "reduction": 44.95
196
196
  },
197
197
  {
@@ -205,7 +205,7 @@
205
205
  "dependents": [
206
206
  "/src/unstable-internals.ts"
207
207
  ],
208
- "percent": 1.1,
208
+ "percent": 1.11,
209
209
  "reduction": 66.75
210
210
  },
211
211
  {
@@ -1 +1 @@
1
- {"version":3,"file":"TRPCUntypedClient.d.ts","sourceRoot":"","sources":["../../src/internals/TRPCUntypedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EAErB,SAAS,EACV,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EACV,gBAAgB,EAEhB,iBAAiB,EACjB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB,CAAC,MAAM,EAAE,MAAM;IACtD,SAAS,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,gBAAgB;AAChB,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,qBAAqB,IAAI;IAC3E,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAC,qEAAqE,CAAC,CAAC;CAChG,CAAC;AAEF,gBAAgB;AAChB,MA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AI,EAAE,OAAO,CACX,wBAAwB,CAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAC9D,GACC,kBAAkB,GACnB,cAAc;CA4BlB"}
@@ -16,17 +16,15 @@ class TRPCUntypedClient {
16
16
  });
17
17
  return chain$.pipe(observable.share());
18
18
  }
19
- requestAsPromise(opts) {
20
- const req$ = this.$request(opts);
21
- const promise = observable.observableToPromise(req$);
22
- return new Promise((resolve, reject)=>{
23
- promise.then((envelope)=>{
24
- const data = envelope.result.data;
25
- resolve(data);
26
- }).catch((err)=>{
27
- reject(TRPCClientError.TRPCClientError.from(err));
28
- });
29
- });
19
+ async requestAsPromise(opts) {
20
+ try {
21
+ const req$ = this.$request(opts);
22
+ const envelope = await observable.observableToPromise(req$);
23
+ const data = envelope.result.data;
24
+ return data;
25
+ } catch (err) {
26
+ throw TRPCClientError.TRPCClientError.from(err);
27
+ }
30
28
  }
31
29
  query(path, input, opts) {
32
30
  return this.requestAsPromise({
@@ -14,17 +14,15 @@ class TRPCUntypedClient {
14
14
  });
15
15
  return chain$.pipe(share());
16
16
  }
17
- requestAsPromise(opts) {
18
- const req$ = this.$request(opts);
19
- const promise = observableToPromise(req$);
20
- return new Promise((resolve, reject)=>{
21
- promise.then((envelope)=>{
22
- const data = envelope.result.data;
23
- resolve(data);
24
- }).catch((err)=>{
25
- reject(TRPCClientError.from(err));
26
- });
27
- });
17
+ async requestAsPromise(opts) {
18
+ try {
19
+ const req$ = this.$request(opts);
20
+ const envelope = await observableToPromise(req$);
21
+ const data = envelope.result.data;
22
+ return data;
23
+ } catch (err) {
24
+ throw TRPCClientError.from(err);
25
+ }
28
26
  }
29
27
  query(path, input, opts) {
30
28
  return this.requestAsPromise({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/client",
3
- "version": "11.0.0-alpha-tmp-issues-5851-take-two.481+521a58480",
3
+ "version": "11.0.0-alpha-tmp-issues-5851-take-two.485+12edd65f5",
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-issues-5851-take-two.481+521a58480"
79
+ "@trpc/server": "11.0.0-alpha-tmp-issues-5851-take-two.485+12edd65f5"
80
80
  },
81
81
  "devDependencies": {
82
- "@trpc/server": "11.0.0-alpha-tmp-issues-5851-take-two.481+521a58480",
82
+ "@trpc/server": "11.0.0-alpha-tmp-issues-5851-take-two.485+12edd65f5",
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": "521a58480a40f3448c788cf38297f0fab5d51558"
99
+ "gitHead": "12edd65f58886c26fd4539484e12fb2f507556cb"
100
100
  }
@@ -84,28 +84,23 @@ export class TRPCUntypedClient<TRouter extends AnyRouter> {
84
84
  return chain$.pipe(share());
85
85
  }
86
86
 
87
- private requestAsPromise<TInput = unknown, TOutput = unknown>(opts: {
87
+ private async requestAsPromise<TInput = unknown, TOutput = unknown>(opts: {
88
88
  type: TRPCType;
89
89
  input: TInput;
90
90
  path: string;
91
91
  context?: OperationContext;
92
92
  signal: Maybe<AbortSignal>;
93
93
  }): Promise<TOutput> {
94
- const req$ = this.$request<TInput, TOutput>(opts);
95
- type TValue = inferObservableValue<typeof req$>;
96
- const promise = observableToPromise<TValue>(req$);
94
+ try {
95
+ const req$ = this.$request<TInput, TOutput>(opts);
96
+ type TValue = inferObservableValue<typeof req$>;
97
97
 
98
- return new Promise<TOutput>((resolve, reject) => {
99
- promise
100
- .then((envelope) => {
101
- const data = (envelope.result as any).data;
102
-
103
- resolve(data);
104
- })
105
- .catch((err) => {
106
- reject(TRPCClientError.from(err));
107
- });
108
- });
98
+ const envelope = await observableToPromise<TValue>(req$);
99
+ const data = (envelope.result as any).data;
100
+ return data;
101
+ } catch (err) {
102
+ throw TRPCClientError.from(err as Error);
103
+ }
109
104
  }
110
105
  public query(path: string, input?: unknown, opts?: TRPCRequestOptions) {
111
106
  return this.requestAsPromise<unknown, unknown>({