@trpc/client 10.0.0-alpha.2 → 10.0.0-alpha.22

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.
Files changed (183) hide show
  1. package/dist/{declarations/src/TRPCClientError.d.ts → TRPCClientError.d.ts} +21 -29
  2. package/dist/TRPCClientError.d.ts.map +1 -0
  3. package/dist/{declarations/src/createTRPCClient.d.ts → createTRPCClient.d.ts} +5 -5
  4. package/dist/createTRPCClient.d.ts.map +1 -0
  5. package/dist/{declarations/src/getFetch.d.ts → getFetch.d.ts} +1 -1
  6. package/dist/getFetch.d.ts.map +1 -0
  7. package/dist/{declarations/src/index.d.ts → index.d.ts} +4 -4
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +1417 -0
  10. package/dist/index.mjs +1391 -0
  11. package/dist/index.ts.js +1 -0
  12. package/dist/{declarations/src/internals → internals}/TRPCClient.d.ts +61 -64
  13. package/dist/internals/TRPCClient.d.ts.map +1 -0
  14. package/dist/{declarations/src/internals → internals}/dataLoader.d.ts +17 -14
  15. package/dist/internals/dataLoader.d.ts.map +1 -0
  16. package/dist/{declarations/src/internals → internals}/fetchHelpers.d.ts +2 -2
  17. package/dist/internals/fetchHelpers.d.ts.map +1 -0
  18. package/dist/{declarations/src/internals → internals}/retryDelay.d.ts +1 -1
  19. package/dist/internals/retryDelay.d.ts.map +1 -0
  20. package/dist/links/dedupeLink.d.ts +4 -0
  21. package/dist/links/dedupeLink.d.ts.map +1 -0
  22. package/dist/links/httpBatchLink.d.ts +8 -0
  23. package/dist/links/httpBatchLink.d.ts.map +1 -0
  24. package/dist/{declarations/src/links → links}/httpLink.d.ts +4 -4
  25. package/dist/links/httpLink.d.ts.map +1 -0
  26. package/dist/links/index.d.ts +9 -0
  27. package/dist/links/index.d.ts.map +1 -0
  28. package/dist/{declarations/src/links → links}/internals/createChain.d.ts +7 -7
  29. package/dist/links/internals/createChain.d.ts.map +1 -0
  30. package/dist/links/internals/httpUtils.d.ts +30 -0
  31. package/dist/links/internals/httpUtils.d.ts.map +1 -0
  32. package/dist/links/internals/transformOperationResult.d.ts +30 -0
  33. package/dist/links/internals/transformOperationResult.d.ts.map +1 -0
  34. package/dist/{declarations/src/links → links}/loggerLink.d.ts +38 -38
  35. package/dist/links/loggerLink.d.ts.map +1 -0
  36. package/dist/links/retryLink.d.ts +6 -0
  37. package/dist/links/retryLink.d.ts.map +1 -0
  38. package/dist/{declarations/src/links → links}/splitLink.d.ts +13 -13
  39. package/dist/links/splitLink.d.ts.map +1 -0
  40. package/dist/{declarations/src/links → links}/types.d.ts +42 -39
  41. package/dist/links/types.d.ts.map +1 -0
  42. package/dist/{declarations/src/links → links}/wsLink.d.ts +19 -19
  43. package/dist/links/wsLink.d.ts.map +1 -0
  44. package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.dev.js +68 -38
  45. package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.prod.js +68 -38
  46. package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.esm.js +67 -37
  47. package/links/httpLink/dist/trpc-client-links-httpLink.cjs.dev.js +52 -29
  48. package/links/httpLink/dist/trpc-client-links-httpLink.cjs.prod.js +52 -29
  49. package/links/httpLink/dist/trpc-client-links-httpLink.esm.js +52 -29
  50. package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.dev.js +19 -31
  51. package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.prod.js +19 -31
  52. package/links/loggerLink/dist/trpc-client-links-loggerLink.esm.js +19 -31
  53. package/links/splitLink/dist/trpc-client-links-splitLink.cjs.dev.js +7 -20
  54. package/links/splitLink/dist/trpc-client-links-splitLink.cjs.prod.js +7 -20
  55. package/links/splitLink/dist/trpc-client-links-splitLink.esm.js +7 -20
  56. package/links/wsLink/dist/trpc-client-links-wsLink.cjs.dev.js +84 -60
  57. package/links/wsLink/dist/trpc-client-links-wsLink.cjs.prod.js +84 -60
  58. package/links/wsLink/dist/trpc-client-links-wsLink.esm.js +84 -60
  59. package/package.json +26 -23
  60. package/src/TRPCClientError.ts +3 -11
  61. package/src/createTRPCClient.ts +1 -1
  62. package/src/index.ts +1 -1
  63. package/src/internals/TRPCClient.ts +52 -36
  64. package/src/internals/dataLoader.ts +120 -45
  65. package/src/links/dedupeLink.test.ts +1 -1
  66. package/src/links/dedupeLink.ts +3 -5
  67. package/src/links/httpBatchLink.ts +64 -31
  68. package/src/links/httpLink.ts +4 -4
  69. package/src/links/index.ts +8 -0
  70. package/src/links/internals/createChain.test.ts +5 -5
  71. package/src/links/internals/createChain.ts +3 -3
  72. package/src/links/internals/httpUtils.ts +116 -0
  73. package/src/links/internals/transformOperationResult.ts +40 -12
  74. package/src/links/loggerLink.ts +1 -2
  75. package/src/links/retryLink.ts +1 -2
  76. package/src/links/splitLink.test.ts +3 -3
  77. package/src/links/splitLink.ts +5 -5
  78. package/src/links/types.ts +13 -8
  79. package/src/links/wsLink.ts +12 -12
  80. package/dist/TRPCClientError-a5312a5f.cjs.dev.js +0 -74
  81. package/dist/TRPCClientError-e1da1ef0.esm.js +0 -72
  82. package/dist/TRPCClientError-ea7d89b2.cjs.prod.js +0 -74
  83. package/dist/createChain-93a38e1c.cjs.dev.js +0 -27
  84. package/dist/createChain-e45e052a.cjs.prod.js +0 -27
  85. package/dist/createChain-e45e6cf2.esm.js +0 -25
  86. package/dist/declarations/src/TRPCClientError.d.ts.map +0 -1
  87. package/dist/declarations/src/createTRPCClient.d.ts.map +0 -1
  88. package/dist/declarations/src/getFetch.d.ts.map +0 -1
  89. package/dist/declarations/src/index.d.ts.map +0 -1
  90. package/dist/declarations/src/internals/TRPCClient.d.ts.map +0 -1
  91. package/dist/declarations/src/internals/dataLoader.d.ts.map +0 -1
  92. package/dist/declarations/src/internals/fetchHelpers.d.ts.map +0 -1
  93. package/dist/declarations/src/internals/retryDelay.d.ts.map +0 -1
  94. package/dist/declarations/src/links/httpBatchLink.d.ts +0 -5
  95. package/dist/declarations/src/links/httpBatchLink.d.ts.map +0 -1
  96. package/dist/declarations/src/links/httpLink.d.ts.map +0 -1
  97. package/dist/declarations/src/links/httpUtils.d.ts +0 -22
  98. package/dist/declarations/src/links/httpUtils.d.ts.map +0 -1
  99. package/dist/declarations/src/links/internals/createChain.d.ts.map +0 -1
  100. package/dist/declarations/src/links/internals/transformOperationResult.d.ts +0 -16
  101. package/dist/declarations/src/links/internals/transformOperationResult.d.ts.map +0 -1
  102. package/dist/declarations/src/links/loggerLink.d.ts.map +0 -1
  103. package/dist/declarations/src/links/splitLink.d.ts.map +0 -1
  104. package/dist/declarations/src/links/transformerLink.d.ts +0 -4
  105. package/dist/declarations/src/links/transformerLink.d.ts.map +0 -1
  106. package/dist/declarations/src/links/types.d.ts.map +0 -1
  107. package/dist/declarations/src/links/wsLink.d.ts.map +0 -1
  108. package/dist/declarations/src/rx/index.d.ts +0 -3
  109. package/dist/declarations/src/rx/index.d.ts.map +0 -1
  110. package/dist/declarations/src/rx/observable.d.ts +0 -4
  111. package/dist/declarations/src/rx/observable.d.ts.map +0 -1
  112. package/dist/declarations/src/rx/operators/index.d.ts +0 -4
  113. package/dist/declarations/src/rx/operators/index.d.ts.map +0 -1
  114. package/dist/declarations/src/rx/operators/map.d.ts +0 -3
  115. package/dist/declarations/src/rx/operators/map.d.ts.map +0 -1
  116. package/dist/declarations/src/rx/operators/share.d.ts +0 -6
  117. package/dist/declarations/src/rx/operators/share.d.ts.map +0 -1
  118. package/dist/declarations/src/rx/operators/tap.d.ts +0 -3
  119. package/dist/declarations/src/rx/operators/tap.d.ts.map +0 -1
  120. package/dist/declarations/src/rx/types.d.ts +0 -29
  121. package/dist/declarations/src/rx/types.d.ts.map +0 -1
  122. package/dist/declarations/src/rx/util/identity.d.ts +0 -2
  123. package/dist/declarations/src/rx/util/identity.d.ts.map +0 -1
  124. package/dist/declarations/src/rx/util/observableToPromise.d.ts +0 -10
  125. package/dist/declarations/src/rx/util/observableToPromise.d.ts.map +0 -1
  126. package/dist/declarations/src/rx/util/pipe.d.ts +0 -4
  127. package/dist/declarations/src/rx/util/pipe.d.ts.map +0 -1
  128. package/dist/httpUtils-299a66f6.cjs.prod.js +0 -89
  129. package/dist/httpUtils-a1426e14.cjs.dev.js +0 -89
  130. package/dist/httpUtils-e45c9056.esm.js +0 -87
  131. package/dist/observable-01534ea8.esm.js +0 -102
  132. package/dist/observable-9aad8c3e.cjs.dev.js +0 -104
  133. package/dist/observable-ccb54234.cjs.prod.js +0 -104
  134. package/dist/share-5a8c2543.cjs.prod.js +0 -106
  135. package/dist/share-ca585761.esm.js +0 -104
  136. package/dist/share-f2ac9332.cjs.dev.js +0 -106
  137. package/dist/tap-2d565250.cjs.dev.js +0 -32
  138. package/dist/tap-606957cb.esm.js +0 -30
  139. package/dist/tap-d907998d.cjs.prod.js +0 -32
  140. package/dist/trpc-client.cjs.d.ts +0 -1
  141. package/dist/trpc-client.cjs.dev.js +0 -300
  142. package/dist/trpc-client.cjs.js +0 -7
  143. package/dist/trpc-client.cjs.prod.js +0 -300
  144. package/dist/trpc-client.esm.js +0 -295
  145. package/links/httpBatchLink/package.json +0 -4
  146. package/links/httpLink/package.json +0 -4
  147. package/links/loggerLink/package.json +0 -4
  148. package/links/splitLink/package.json +0 -4
  149. package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.d.ts +0 -1
  150. package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.dev.js +0 -67
  151. package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.js +0 -7
  152. package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.prod.js +0 -67
  153. package/links/transformerLink/dist/trpc-client-links-transformerLink.esm.js +0 -63
  154. package/links/transformerLink/package.json +0 -4
  155. package/links/wsLink/package.json +0 -4
  156. package/rx/dist/trpc-client-rx.cjs.d.ts +0 -1
  157. package/rx/dist/trpc-client-rx.cjs.dev.js +0 -9
  158. package/rx/dist/trpc-client-rx.cjs.js +0 -7
  159. package/rx/dist/trpc-client-rx.cjs.prod.js +0 -9
  160. package/rx/dist/trpc-client-rx.esm.js +0 -1
  161. package/rx/operators/dist/trpc-client-rx-operators.cjs.d.ts +0 -1
  162. package/rx/operators/dist/trpc-client-rx-operators.cjs.dev.js +0 -39
  163. package/rx/operators/dist/trpc-client-rx-operators.cjs.js +0 -7
  164. package/rx/operators/dist/trpc-client-rx-operators.cjs.prod.js +0 -39
  165. package/rx/operators/dist/trpc-client-rx-operators.esm.js +0 -33
  166. package/rx/operators/package.json +0 -4
  167. package/rx/package.json +0 -4
  168. package/src/internals/transformRPCResponse.ts +0 -25
  169. package/src/links/httpUtils.ts +0 -94
  170. package/src/links/transformerLink.ts +0 -70
  171. package/src/rx/index.ts +0 -2
  172. package/src/rx/observable.test.ts +0 -83
  173. package/src/rx/observable.ts +0 -70
  174. package/src/rx/operators/index.ts +0 -3
  175. package/src/rx/operators/map.test.ts +0 -92
  176. package/src/rx/operators/map.ts +0 -25
  177. package/src/rx/operators/share.test.ts +0 -60
  178. package/src/rx/operators/share.ts +0 -67
  179. package/src/rx/operators/tap.ts +0 -26
  180. package/src/rx/types.ts +0 -69
  181. package/src/rx/util/identity.ts +0 -3
  182. package/src/rx/util/observableToPromise.ts +0 -49
  183. package/src/rx/util/pipe.ts +0 -22
@@ -1,295 +0,0 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/esm/createClass';
3
- import { httpBatchLink } from '../links/httpBatchLink/dist/trpc-client-links-httpBatchLink.esm.js';
4
- import { c as createChain } from './createChain-e45e6cf2.esm.js';
5
- import { T as TRPCClientError } from './TRPCClientError-e1da1ef0.esm.js';
6
- export { T as TRPCClientError } from './TRPCClientError-e1da1ef0.esm.js';
7
- import { s as share } from './share-ca585761.esm.js';
8
- import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
9
- import _inherits from '@babel/runtime/helpers/esm/inherits';
10
- import _createSuper from '@babel/runtime/helpers/esm/createSuper';
11
- import _wrapNativeSuper from '@babel/runtime/helpers/esm/wrapNativeSuper';
12
- import '@babel/runtime/helpers/createForOfIteratorHelper';
13
- import './observable-01534ea8.esm.js';
14
- import './httpUtils-e45c9056.esm.js';
15
- import '@babel/runtime/helpers/objectSpread2';
16
-
17
- function getWindow() {
18
- if (typeof window !== 'undefined') {
19
- return window;
20
- }
21
-
22
- return global;
23
- }
24
- function getAbortController(ac) {
25
- var win = getWindow();
26
- return ac || win.AbortController || null;
27
- }
28
-
29
- function getFetch(f) {
30
- if (f) {
31
- return f;
32
- }
33
-
34
- var win = getWindow();
35
-
36
- if (win.fetch) {
37
- return typeof win.fetch.bind === 'function' ? win.fetch.bind(win) : win.fetch;
38
- }
39
-
40
- throw new Error('No fetch implementation found');
41
- }
42
-
43
- /** @internal */
44
- function transformOperationResult(result) {
45
- var context = result.context;
46
-
47
- if ('error' in result.data) {
48
- var error = TRPCClientError.from(result.data);
49
- return {
50
- ok: false,
51
- error: error,
52
- context: context
53
- };
54
- }
55
-
56
- var data = result.data.result.data;
57
- return {
58
- ok: true,
59
- data: data,
60
- context: context
61
- };
62
- }
63
-
64
- var ObservableAbortError = /*#__PURE__*/function (_Error) {
65
- _inherits(ObservableAbortError, _Error);
66
-
67
- var _super = /*#__PURE__*/_createSuper(ObservableAbortError);
68
-
69
- function ObservableAbortError(message) {
70
- var _this;
71
-
72
- _classCallCheck(this, ObservableAbortError);
73
-
74
- _this = _super.call(this, message);
75
- _this.name = 'ObservableAbortError';
76
- Object.setPrototypeOf(_assertThisInitialized(_this), ObservableAbortError.prototype);
77
- return _this;
78
- }
79
-
80
- return ObservableAbortError;
81
- }( /*#__PURE__*/_wrapNativeSuper(Error));
82
- /** @internal */
83
-
84
- function observableToPromise(observable) {
85
- var abort;
86
- var promise = new Promise(function (resolve, reject) {
87
- var isDone = false;
88
-
89
- function onDone() {
90
- if (isDone) {
91
- return;
92
- }
93
-
94
- isDone = true;
95
- reject(new ObservableAbortError('This operation was cancelled.'));
96
- obs$.unsubscribe();
97
- }
98
-
99
- var obs$ = observable.subscribe({
100
- next: function next(data) {
101
- isDone = true;
102
- resolve(data);
103
- onDone();
104
- },
105
- error: function error(data) {
106
- isDone = true;
107
- reject(data);
108
- onDone();
109
- },
110
- complete: function complete() {
111
- isDone = true;
112
- onDone();
113
- }
114
- });
115
- abort = onDone;
116
- });
117
- return {
118
- promise: promise,
119
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
120
- abort: abort
121
- };
122
- }
123
-
124
- var idCounter = 0;
125
-
126
- function getRequestId() {
127
- return ++idCounter;
128
- }
129
-
130
- var TRPCClient = /*#__PURE__*/function () {
131
- function TRPCClient(opts) {
132
- var _this = this;
133
-
134
- _classCallCheck(this, TRPCClient);
135
-
136
- this.links = void 0;
137
- this.runtime = void 0;
138
-
139
- var _fetch = getFetch(opts === null || opts === void 0 ? void 0 : opts.fetch);
140
-
141
- var AC = getAbortController(opts === null || opts === void 0 ? void 0 : opts.AbortController);
142
-
143
- function getHeadersFn() {
144
- if (opts.headers) {
145
- var headers = opts.headers;
146
- return typeof headers === 'function' ? headers : function () {
147
- return headers;
148
- };
149
- }
150
-
151
- return function () {
152
- return {};
153
- };
154
- }
155
-
156
- this.runtime = {
157
- AbortController: AC,
158
- fetch: _fetch,
159
- headers: getHeadersFn()
160
- };
161
-
162
- if ('links' in opts) {
163
- this.links = opts.links.map(function (link) {
164
- return link(_this.runtime);
165
- });
166
- } else {
167
- this.links = [httpBatchLink({
168
- url: opts.url
169
- })(this.runtime)];
170
- }
171
- }
172
-
173
- _createClass(TRPCClient, [{
174
- key: "$request",
175
- value: function $request(_ref) {
176
- var type = _ref.type,
177
- input = _ref.input,
178
- path = _ref.path,
179
- _ref$context = _ref.context,
180
- context = _ref$context === void 0 ? {} : _ref$context;
181
- var chain$ = createChain({
182
- links: this.links,
183
- op: {
184
- id: getRequestId(),
185
- type: type,
186
- path: path,
187
- input: input,
188
- context: context
189
- }
190
- });
191
- return chain$.pipe(share());
192
- }
193
- }, {
194
- key: "requestAsPromise",
195
- value: function requestAsPromise(opts) {
196
- var req$ = this.$request(opts);
197
-
198
- var _observableToPromise = observableToPromise(req$),
199
- promise = _observableToPromise.promise,
200
- abort = _observableToPromise.abort;
201
-
202
- var cancellablePromise = new Promise(function (resolve, reject) {
203
- promise.then(function (result) {
204
- var transformed = transformOperationResult(result);
205
-
206
- if (transformed.ok) {
207
- resolve(transformed.data);
208
- return;
209
- }
210
-
211
- reject(transformed.error);
212
- }).catch(function (err) {
213
- reject(TRPCClientError.from(err));
214
- });
215
- });
216
- cancellablePromise.cancel = abort;
217
- return cancellablePromise;
218
- }
219
- }, {
220
- key: "query",
221
- value: function query(path) {
222
- var _ref2;
223
-
224
- var context = (_ref2 = arguments.length <= 2 ? undefined : arguments[2]) === null || _ref2 === void 0 ? void 0 : _ref2.context;
225
- return this.requestAsPromise({
226
- type: 'query',
227
- path: path,
228
- input: arguments.length <= 1 ? undefined : arguments[1],
229
- context: context
230
- });
231
- }
232
- }, {
233
- key: "mutation",
234
- value: function mutation(path) {
235
- var _ref3;
236
-
237
- var context = (_ref3 = arguments.length <= 2 ? undefined : arguments[2]) === null || _ref3 === void 0 ? void 0 : _ref3.context;
238
- return this.requestAsPromise({
239
- type: 'mutation',
240
- path: path,
241
- input: arguments.length <= 1 ? undefined : arguments[1],
242
- context: context
243
- });
244
- }
245
- }, {
246
- key: "subscription",
247
- value: function subscription(path, input, opts) {
248
- var observable$ = this.$request({
249
- type: 'subscription',
250
- path: path,
251
- input: input,
252
- context: opts.context
253
- });
254
- var observer = observable$.subscribe({
255
- next: function next(result) {
256
- var _opts$next;
257
-
258
- if ('error' in result.data) {
259
- var _opts$error;
260
-
261
- var err = TRPCClientError.from(result.data, {
262
- meta: result.context
263
- });
264
- (_opts$error = opts.error) === null || _opts$error === void 0 ? void 0 : _opts$error.call(opts, err);
265
- return;
266
- }
267
-
268
- (_opts$next = opts.next) === null || _opts$next === void 0 ? void 0 : _opts$next.call(opts, result.data.result);
269
- },
270
- error: function error(err) {
271
- var _opts$error2;
272
-
273
- (_opts$error2 = opts.error) === null || _opts$error2 === void 0 ? void 0 : _opts$error2.call(opts, err);
274
- },
275
- complete: function complete() {
276
- var _opts$complete;
277
-
278
- (_opts$complete = opts.complete) === null || _opts$complete === void 0 ? void 0 : _opts$complete.call(opts);
279
- }
280
- });
281
- return function () {
282
- observer.unsubscribe();
283
- };
284
- }
285
- }]);
286
-
287
- return TRPCClient;
288
- }();
289
-
290
- /* eslint-disable @typescript-eslint/no-explicit-any */
291
- function createTRPCClient(opts) {
292
- return new TRPCClient(opts);
293
- }
294
-
295
- export { createTRPCClient, getFetch };
@@ -1,4 +0,0 @@
1
- {
2
- "main": "dist/trpc-client-links-httpBatchLink.cjs.js",
3
- "module": "dist/trpc-client-links-httpBatchLink.esm.js"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "main": "dist/trpc-client-links-httpLink.cjs.js",
3
- "module": "dist/trpc-client-links-httpLink.esm.js"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "main": "dist/trpc-client-links-loggerLink.cjs.js",
3
- "module": "dist/trpc-client-links-loggerLink.esm.js"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "main": "dist/trpc-client-links-splitLink.cjs.js",
3
- "module": "dist/trpc-client-links-splitLink.esm.js"
4
- }
@@ -1 +0,0 @@
1
- export * from "../../../dist/declarations/src/links/transformerLink";
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
- var observable = require('../../../dist/observable-9aad8c3e.cjs.dev.js');
7
-
8
- /**
9
- * @internal
10
- */
11
- function transformOperationResult(result, transformer) {
12
- if ('error' in result.data) {
13
- return _objectSpread(_objectSpread({}, result), {}, {
14
- data: _objectSpread(_objectSpread({}, result.data), {}, {
15
- error: transformer.deserialize(result.data.error)
16
- })
17
- });
18
- }
19
-
20
- if (result.data.result.type !== 'data') {
21
- return result;
22
- }
23
-
24
- return _objectSpread(_objectSpread({}, result), {}, {
25
- data: _objectSpread(_objectSpread({}, result.data), {}, {
26
- result: _objectSpread(_objectSpread({}, result.data.result), {}, {
27
- data: transformer.deserialize(result.data.result.data)
28
- })
29
- })
30
- });
31
- }
32
-
33
- function transformerLink(transformer) {
34
- var _transformer = transformer ? 'input' in transformer ? {
35
- serialize: transformer.input.serialize,
36
- deserialize: transformer.output.deserialize
37
- } : transformer : {
38
- serialize: function serialize(data) {
39
- return data;
40
- },
41
- deserialize: function deserialize(data) {
42
- return data;
43
- }
44
- };
45
-
46
- return function () {
47
- return function (props) {
48
- var input = _transformer.serialize(props.op.input);
49
-
50
- return observable.observable(function (observer) {
51
- var next$ = props.next(_objectSpread(_objectSpread({}, props.op), {}, {
52
- input: input
53
- })).subscribe({
54
- next: function next(value) {
55
- var transformed = transformOperationResult(value, _transformer);
56
- observer.next(transformed);
57
- },
58
- error: observer.error,
59
- complete: observer.complete
60
- });
61
- return next$;
62
- });
63
- };
64
- };
65
- }
66
-
67
- exports.transformerLink = transformerLink;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./trpc-client-links-transformerLink.cjs.prod.js");
5
- } else {
6
- module.exports = require("./trpc-client-links-transformerLink.cjs.dev.js");
7
- }
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
- var observable = require('../../../dist/observable-ccb54234.cjs.prod.js');
7
-
8
- /**
9
- * @internal
10
- */
11
- function transformOperationResult(result, transformer) {
12
- if ('error' in result.data) {
13
- return _objectSpread(_objectSpread({}, result), {}, {
14
- data: _objectSpread(_objectSpread({}, result.data), {}, {
15
- error: transformer.deserialize(result.data.error)
16
- })
17
- });
18
- }
19
-
20
- if (result.data.result.type !== 'data') {
21
- return result;
22
- }
23
-
24
- return _objectSpread(_objectSpread({}, result), {}, {
25
- data: _objectSpread(_objectSpread({}, result.data), {}, {
26
- result: _objectSpread(_objectSpread({}, result.data.result), {}, {
27
- data: transformer.deserialize(result.data.result.data)
28
- })
29
- })
30
- });
31
- }
32
-
33
- function transformerLink(transformer) {
34
- var _transformer = transformer ? 'input' in transformer ? {
35
- serialize: transformer.input.serialize,
36
- deserialize: transformer.output.deserialize
37
- } : transformer : {
38
- serialize: function serialize(data) {
39
- return data;
40
- },
41
- deserialize: function deserialize(data) {
42
- return data;
43
- }
44
- };
45
-
46
- return function () {
47
- return function (props) {
48
- var input = _transformer.serialize(props.op.input);
49
-
50
- return observable.observable(function (observer) {
51
- var next$ = props.next(_objectSpread(_objectSpread({}, props.op), {}, {
52
- input: input
53
- })).subscribe({
54
- next: function next(value) {
55
- var transformed = transformOperationResult(value, _transformer);
56
- observer.next(transformed);
57
- },
58
- error: observer.error,
59
- complete: observer.complete
60
- });
61
- return next$;
62
- });
63
- };
64
- };
65
- }
66
-
67
- exports.transformerLink = transformerLink;
@@ -1,63 +0,0 @@
1
- import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
2
- import { o as observable } from '../../../dist/observable-01534ea8.esm.js';
3
-
4
- /**
5
- * @internal
6
- */
7
- function transformOperationResult(result, transformer) {
8
- if ('error' in result.data) {
9
- return _objectSpread(_objectSpread({}, result), {}, {
10
- data: _objectSpread(_objectSpread({}, result.data), {}, {
11
- error: transformer.deserialize(result.data.error)
12
- })
13
- });
14
- }
15
-
16
- if (result.data.result.type !== 'data') {
17
- return result;
18
- }
19
-
20
- return _objectSpread(_objectSpread({}, result), {}, {
21
- data: _objectSpread(_objectSpread({}, result.data), {}, {
22
- result: _objectSpread(_objectSpread({}, result.data.result), {}, {
23
- data: transformer.deserialize(result.data.result.data)
24
- })
25
- })
26
- });
27
- }
28
-
29
- function transformerLink(transformer) {
30
- var _transformer = transformer ? 'input' in transformer ? {
31
- serialize: transformer.input.serialize,
32
- deserialize: transformer.output.deserialize
33
- } : transformer : {
34
- serialize: function serialize(data) {
35
- return data;
36
- },
37
- deserialize: function deserialize(data) {
38
- return data;
39
- }
40
- };
41
-
42
- return function () {
43
- return function (props) {
44
- var input = _transformer.serialize(props.op.input);
45
-
46
- return observable(function (observer) {
47
- var next$ = props.next(_objectSpread(_objectSpread({}, props.op), {}, {
48
- input: input
49
- })).subscribe({
50
- next: function next(value) {
51
- var transformed = transformOperationResult(value, _transformer);
52
- observer.next(transformed);
53
- },
54
- error: observer.error,
55
- complete: observer.complete
56
- });
57
- return next$;
58
- });
59
- };
60
- };
61
- }
62
-
63
- export { transformerLink };
@@ -1,4 +0,0 @@
1
- {
2
- "main": "dist/trpc-client-links-transformerLink.cjs.js",
3
- "module": "dist/trpc-client-links-transformerLink.esm.js"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "main": "dist/trpc-client-links-wsLink.cjs.js",
3
- "module": "dist/trpc-client-links-wsLink.esm.js"
4
- }
@@ -1 +0,0 @@
1
- export * from "../../dist/declarations/src/rx/index";
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var observable = require('../../dist/observable-9aad8c3e.cjs.dev.js');
6
-
7
-
8
-
9
- exports.observable = observable.observable;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./trpc-client-rx.cjs.prod.js");
5
- } else {
6
- module.exports = require("./trpc-client-rx.cjs.dev.js");
7
- }
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var observable = require('../../dist/observable-ccb54234.cjs.prod.js');
6
-
7
-
8
-
9
- exports.observable = observable.observable;
@@ -1 +0,0 @@
1
- export { o as observable } from '../../dist/observable-01534ea8.esm.js';
@@ -1 +0,0 @@
1
- export * from "../../../dist/declarations/src/rx/operators/index";
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var share = require('../../../dist/share-f2ac9332.cjs.dev.js');
6
- var tap = require('../../../dist/tap-2d565250.cjs.dev.js');
7
- require('@babel/runtime/helpers/createForOfIteratorHelper');
8
-
9
- function map(project) {
10
- return function (originalObserver) {
11
- return {
12
- subscribe: function subscribe(observer) {
13
- var index = 0;
14
- var subscription = originalObserver.subscribe({
15
- next: function next(value) {
16
- var _observer$next;
17
-
18
- (_observer$next = observer.next) === null || _observer$next === void 0 ? void 0 : _observer$next.call(observer, project(value, index++));
19
- },
20
- error: function error(_error) {
21
- var _observer$error;
22
-
23
- (_observer$error = observer.error) === null || _observer$error === void 0 ? void 0 : _observer$error.call(observer, _error);
24
- },
25
- complete: function complete() {
26
- var _observer$complete;
27
-
28
- (_observer$complete = observer.complete) === null || _observer$complete === void 0 ? void 0 : _observer$complete.call(observer);
29
- }
30
- });
31
- return subscription;
32
- }
33
- };
34
- };
35
- }
36
-
37
- exports.share = share.share;
38
- exports.tap = tap.tap;
39
- exports.map = map;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./trpc-client-rx-operators.cjs.prod.js");
5
- } else {
6
- module.exports = require("./trpc-client-rx-operators.cjs.dev.js");
7
- }
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var share = require('../../../dist/share-5a8c2543.cjs.prod.js');
6
- var tap = require('../../../dist/tap-d907998d.cjs.prod.js');
7
- require('@babel/runtime/helpers/createForOfIteratorHelper');
8
-
9
- function map(project) {
10
- return function (originalObserver) {
11
- return {
12
- subscribe: function subscribe(observer) {
13
- var index = 0;
14
- var subscription = originalObserver.subscribe({
15
- next: function next(value) {
16
- var _observer$next;
17
-
18
- (_observer$next = observer.next) === null || _observer$next === void 0 ? void 0 : _observer$next.call(observer, project(value, index++));
19
- },
20
- error: function error(_error) {
21
- var _observer$error;
22
-
23
- (_observer$error = observer.error) === null || _observer$error === void 0 ? void 0 : _observer$error.call(observer, _error);
24
- },
25
- complete: function complete() {
26
- var _observer$complete;
27
-
28
- (_observer$complete = observer.complete) === null || _observer$complete === void 0 ? void 0 : _observer$complete.call(observer);
29
- }
30
- });
31
- return subscription;
32
- }
33
- };
34
- };
35
- }
36
-
37
- exports.share = share.share;
38
- exports.tap = tap.tap;
39
- exports.map = map;