@trpc/client 10.0.0-alpha.12 → 10.0.0-alpha.13
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/dist/{httpUtils-1f9e4e3c.js → httpUtils-27640b42.js} +0 -0
- package/dist/{httpUtils-c09d7b79.mjs → httpUtils-b92552af.mjs} +0 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +138 -9
- package/dist/index.mjs +128 -6
- package/dist/links/httpBatchLink.d.ts +1 -1
- package/dist/links/httpBatchLink.d.ts.map +1 -1
- package/dist/links/httpBatchLink.js +1 -1
- package/dist/links/httpBatchLink.mjs +1 -1
- package/dist/links/httpLink.d.ts +1 -1
- package/dist/links/httpLink.d.ts.map +1 -1
- package/dist/links/httpLink.js +1 -1
- package/dist/links/httpLink.mjs +1 -1
- package/dist/links/index.d.ts +11 -0
- package/dist/links/index.d.ts.map +1 -0
- package/dist/links/{httpUtils.d.ts → internals/httpUtils.d.ts} +1 -1
- package/dist/links/internals/httpUtils.d.ts.map +1 -0
- package/dist/links/splitLink.js +3 -25
- package/dist/links/splitLink.mjs +2 -28
- package/dist/links/wsLink.js +11 -377
- package/dist/links/wsLink.mjs +9 -369
- package/dist/{createChain-e77be464.js → splitLink-8635d455.js} +25 -0
- package/dist/{createChain-480b6341.mjs → splitLink-a736378a.mjs} +25 -1
- package/dist/wsLink-a6a0f3a8.mjs +440 -0
- package/dist/wsLink-c9323097.js +455 -0
- package/package.json +4 -34
- package/src/index.ts +1 -1
- package/src/links/httpBatchLink.ts +5 -1
- package/src/links/httpLink.ts +1 -1
- package/src/links/index.ts +10 -0
- package/src/links/{httpUtils.ts → internals/httpUtils.ts} +1 -1
- package/dist/TRPCClientError-17b117e1.mjs +0 -81
- package/dist/TRPCClientError-ec6bd2ca.js +0 -94
- package/dist/links/httpUtils.d.ts.map +0 -1
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.d.ts +0 -1
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.dev.js +0 -214
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.js +0 -7
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.prod.js +0 -214
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.esm.js +0 -210
- package/links/httpBatchLink/index.d.ts +0 -1
- package/links/httpBatchLink/index.js +0 -1
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.d.ts +0 -1
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.dev.js +0 -67
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.js +0 -7
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.prod.js +0 -67
- package/links/httpLink/dist/trpc-client-links-httpLink.esm.js +0 -63
- package/links/httpLink/index.d.ts +0 -1
- package/links/httpLink/index.js +0 -1
- package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.d.ts +0 -1
- package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.dev.js +0 -89
- package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.js +0 -7
- package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.prod.js +0 -89
- package/links/loggerLink/dist/trpc-client-links-loggerLink.esm.js +0 -85
- package/links/loggerLink/index.d.ts +0 -1
- package/links/loggerLink/index.js +0 -1
- package/links/splitLink/dist/trpc-client-links-splitLink.cjs.d.ts +0 -1
- package/links/splitLink/dist/trpc-client-links-splitLink.cjs.dev.js +0 -19
- package/links/splitLink/dist/trpc-client-links-splitLink.cjs.js +0 -7
- package/links/splitLink/dist/trpc-client-links-splitLink.cjs.prod.js +0 -19
- package/links/splitLink/dist/trpc-client-links-splitLink.esm.js +0 -15
- package/links/splitLink/index.d.ts +0 -1
- package/links/splitLink/index.js +0 -1
- package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.d.ts +0 -1
- package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.dev.js +0 -67
- package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.js +0 -7
- package/links/transformerLink/dist/trpc-client-links-transformerLink.cjs.prod.js +0 -67
- package/links/transformerLink/dist/trpc-client-links-transformerLink.esm.js +0 -63
- package/links/transformerLink/index.d.ts +0 -1
- package/links/transformerLink/index.js +0 -1
- package/links/wsLink/dist/trpc-client-links-wsLink.cjs.d.ts +0 -1
- package/links/wsLink/dist/trpc-client-links-wsLink.cjs.dev.js +0 -395
- package/links/wsLink/dist/trpc-client-links-wsLink.cjs.js +0 -7
- package/links/wsLink/dist/trpc-client-links-wsLink.cjs.prod.js +0 -395
- package/links/wsLink/dist/trpc-client-links-wsLink.esm.js +0 -390
- package/links/wsLink/index.d.ts +0 -1
- package/links/wsLink/index.js +0 -1
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,17 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
6
6
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
7
7
|
var links_httpBatchLink = require('./links/httpBatchLink.js');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var links_splitLink = require('./splitLink-8635d455.js');
|
|
9
|
+
var links_wsLink = require('./wsLink-c9323097.js');
|
|
10
10
|
var share = require('./share-4afc084f.js');
|
|
11
11
|
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
12
12
|
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
13
13
|
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
14
14
|
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
15
15
|
var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
|
|
16
|
-
require('./observable-9aaca086.js');
|
|
17
|
-
require('./
|
|
16
|
+
var observable = require('./observable-9aaca086.js');
|
|
17
|
+
var links_httpLink = require('./links/httpLink.js');
|
|
18
|
+
var links_loggerLink = require('./links/loggerLink.js');
|
|
19
|
+
var links_transformerLink = require('./links/transformerLink.js');
|
|
20
|
+
require('./httpUtils-27640b42.js');
|
|
18
21
|
require('@babel/runtime/helpers/defineProperty');
|
|
22
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
23
|
+
require('./tap-aacf31bf.js');
|
|
19
24
|
|
|
20
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
26
|
|
|
@@ -58,7 +63,7 @@ function transformOperationResult(result) {
|
|
|
58
63
|
var context = result.context;
|
|
59
64
|
|
|
60
65
|
if ('error' in result.data) {
|
|
61
|
-
var error =
|
|
66
|
+
var error = links_wsLink.TRPCClientError.from(result.data);
|
|
62
67
|
return {
|
|
63
68
|
ok: false,
|
|
64
69
|
error: error,
|
|
@@ -195,7 +200,7 @@ var TRPCClient = /*#__PURE__*/function () {
|
|
|
195
200
|
path = _ref.path,
|
|
196
201
|
_ref$context = _ref.context,
|
|
197
202
|
context = _ref$context === void 0 ? {} : _ref$context;
|
|
198
|
-
var chain$ =
|
|
203
|
+
var chain$ = links_splitLink.createChain({
|
|
199
204
|
links: this.links,
|
|
200
205
|
op: {
|
|
201
206
|
id: getRequestId(),
|
|
@@ -227,7 +232,7 @@ var TRPCClient = /*#__PURE__*/function () {
|
|
|
227
232
|
|
|
228
233
|
reject(transformed.error);
|
|
229
234
|
}).catch(function (err) {
|
|
230
|
-
reject(
|
|
235
|
+
reject(links_wsLink.TRPCClientError.from(err));
|
|
231
236
|
});
|
|
232
237
|
});
|
|
233
238
|
cancellablePromise.cancel = abort;
|
|
@@ -275,7 +280,7 @@ var TRPCClient = /*#__PURE__*/function () {
|
|
|
275
280
|
if ('error' in result.data) {
|
|
276
281
|
var _opts$error;
|
|
277
282
|
|
|
278
|
-
var err =
|
|
283
|
+
var err = links_wsLink.TRPCClientError.from(result.data, {
|
|
279
284
|
meta: result.context
|
|
280
285
|
});
|
|
281
286
|
(_opts$error = opts.error) === null || _opts$error === void 0 ? void 0 : _opts$error.call(opts, err);
|
|
@@ -306,6 +311,130 @@ function createTRPCClient(opts) {
|
|
|
306
311
|
return new TRPCClient(opts);
|
|
307
312
|
}
|
|
308
313
|
|
|
309
|
-
|
|
314
|
+
function dedupeLink() {
|
|
315
|
+
// initialized config
|
|
316
|
+
return function () {
|
|
317
|
+
// initialized in app
|
|
318
|
+
var pending = {};
|
|
319
|
+
return function (_ref) {
|
|
320
|
+
var op = _ref.op,
|
|
321
|
+
next = _ref.next;
|
|
322
|
+
|
|
323
|
+
// initialized for request
|
|
324
|
+
if (op.type !== 'query') {
|
|
325
|
+
// pass through
|
|
326
|
+
return next(op);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
var key = JSON.stringify([op.path, op.input]);
|
|
330
|
+
|
|
331
|
+
if (pending[key]) {
|
|
332
|
+
// console.log('hooking into pending', { op });
|
|
333
|
+
return observable.observable(function (observer) {
|
|
334
|
+
return pending[key].subscribe(observer);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var shared$ = observable.observable(function (observer) {
|
|
339
|
+
function reset() {
|
|
340
|
+
delete pending[key];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
var subscription = next(op).subscribe({
|
|
344
|
+
next: function next(v) {
|
|
345
|
+
observer.next(v);
|
|
346
|
+
},
|
|
347
|
+
error: function error(e) {
|
|
348
|
+
reset();
|
|
349
|
+
observer.error(e);
|
|
350
|
+
},
|
|
351
|
+
complete: function complete() {
|
|
352
|
+
reset();
|
|
353
|
+
observer.complete();
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
return function () {
|
|
357
|
+
reset();
|
|
358
|
+
subscription.unsubscribe();
|
|
359
|
+
};
|
|
360
|
+
}).pipe(share.share());
|
|
361
|
+
pending[key] = shared$;
|
|
362
|
+
return shared$;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function retryLink(opts) {
|
|
368
|
+
// initialized config
|
|
369
|
+
return function () {
|
|
370
|
+
// initialized in app
|
|
371
|
+
return function (_ref) {
|
|
372
|
+
var op = _ref.op,
|
|
373
|
+
next = _ref.next;
|
|
374
|
+
// initialized for request
|
|
375
|
+
return observable.observable(function (observer) {
|
|
376
|
+
var next$ = null;
|
|
377
|
+
var attempts = 0;
|
|
378
|
+
var isDone = false;
|
|
379
|
+
|
|
380
|
+
function attempt() {
|
|
381
|
+
var _next$;
|
|
382
|
+
|
|
383
|
+
attempts++;
|
|
384
|
+
(_next$ = next$) === null || _next$ === void 0 ? void 0 : _next$.unsubscribe();
|
|
385
|
+
next$ = next(op).subscribe({
|
|
386
|
+
error: function error(_error) {
|
|
387
|
+
if (attempts >= opts.attempts) {
|
|
388
|
+
observer.error(_error);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
attempt();
|
|
393
|
+
},
|
|
394
|
+
next: function next(result) {
|
|
395
|
+
if ('result' in result.data) {
|
|
396
|
+
isDone = true;
|
|
397
|
+
observer.next(result);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (attempts >= opts.attempts) {
|
|
402
|
+
isDone = true;
|
|
403
|
+
observer.next(result);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
attempt();
|
|
408
|
+
},
|
|
409
|
+
complete: function complete() {
|
|
410
|
+
if (isDone) {
|
|
411
|
+
observer.complete();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
attempt();
|
|
418
|
+
return function () {
|
|
419
|
+
var _next$2;
|
|
420
|
+
|
|
421
|
+
isDone = true;
|
|
422
|
+
(_next$2 = next$) === null || _next$2 === void 0 ? void 0 : _next$2.unsubscribe();
|
|
423
|
+
};
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
exports.httpBatchLink = links_httpBatchLink.httpBatchLink;
|
|
430
|
+
exports.splitLink = links_splitLink.splitLink;
|
|
431
|
+
exports.TRPCClientError = links_wsLink.TRPCClientError;
|
|
432
|
+
exports.createWSClient = links_wsLink.createWSClient;
|
|
433
|
+
exports.wsLink = links_wsLink.wsLink;
|
|
434
|
+
exports.httpLink = links_httpLink.httpLink;
|
|
435
|
+
exports.loggerLink = links_loggerLink.loggerLink;
|
|
436
|
+
exports.transformerLink = links_transformerLink.transformerLink;
|
|
310
437
|
exports.createTRPCClient = createTRPCClient;
|
|
438
|
+
exports.dedupeLink = dedupeLink;
|
|
311
439
|
exports.getFetch = getFetch;
|
|
440
|
+
exports.retryLink = retryLink;
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
2
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
3
|
import { httpBatchLink } from './links/httpBatchLink.mjs';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
4
|
+
export { httpBatchLink } from './links/httpBatchLink.mjs';
|
|
5
|
+
import { c as createChain } from './splitLink-a736378a.mjs';
|
|
6
|
+
export { s as splitLink } from './splitLink-a736378a.mjs';
|
|
7
|
+
import { T as TRPCClientError } from './wsLink-a6a0f3a8.mjs';
|
|
8
|
+
export { T as TRPCClientError, c as createWSClient, w as wsLink } from './wsLink-a6a0f3a8.mjs';
|
|
7
9
|
import { s as share } from './share-9f12d26c.mjs';
|
|
8
10
|
import _assertThisInitialized from '@babel/runtime/helpers/assertThisInitialized';
|
|
9
11
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
10
12
|
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
11
13
|
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
|
|
12
14
|
import _wrapNativeSuper from '@babel/runtime/helpers/wrapNativeSuper';
|
|
13
|
-
import './observable-16fde241.mjs';
|
|
14
|
-
|
|
15
|
+
import { o as observable } from './observable-16fde241.mjs';
|
|
16
|
+
export { httpLink } from './links/httpLink.mjs';
|
|
17
|
+
export { loggerLink } from './links/loggerLink.mjs';
|
|
18
|
+
export { transformerLink } from './links/transformerLink.mjs';
|
|
19
|
+
import './httpUtils-b92552af.mjs';
|
|
15
20
|
import '@babel/runtime/helpers/defineProperty';
|
|
21
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
22
|
+
import './tap-f567ea97.mjs';
|
|
16
23
|
|
|
17
24
|
function getWindow() {
|
|
18
25
|
if (typeof window !== 'undefined') {
|
|
@@ -293,4 +300,119 @@ function createTRPCClient(opts) {
|
|
|
293
300
|
return new TRPCClient(opts);
|
|
294
301
|
}
|
|
295
302
|
|
|
296
|
-
|
|
303
|
+
function dedupeLink() {
|
|
304
|
+
// initialized config
|
|
305
|
+
return function () {
|
|
306
|
+
// initialized in app
|
|
307
|
+
var pending = {};
|
|
308
|
+
return function (_ref) {
|
|
309
|
+
var op = _ref.op,
|
|
310
|
+
next = _ref.next;
|
|
311
|
+
|
|
312
|
+
// initialized for request
|
|
313
|
+
if (op.type !== 'query') {
|
|
314
|
+
// pass through
|
|
315
|
+
return next(op);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
var key = JSON.stringify([op.path, op.input]);
|
|
319
|
+
|
|
320
|
+
if (pending[key]) {
|
|
321
|
+
// console.log('hooking into pending', { op });
|
|
322
|
+
return observable(function (observer) {
|
|
323
|
+
return pending[key].subscribe(observer);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
var shared$ = observable(function (observer) {
|
|
328
|
+
function reset() {
|
|
329
|
+
delete pending[key];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
var subscription = next(op).subscribe({
|
|
333
|
+
next: function next(v) {
|
|
334
|
+
observer.next(v);
|
|
335
|
+
},
|
|
336
|
+
error: function error(e) {
|
|
337
|
+
reset();
|
|
338
|
+
observer.error(e);
|
|
339
|
+
},
|
|
340
|
+
complete: function complete() {
|
|
341
|
+
reset();
|
|
342
|
+
observer.complete();
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
return function () {
|
|
346
|
+
reset();
|
|
347
|
+
subscription.unsubscribe();
|
|
348
|
+
};
|
|
349
|
+
}).pipe(share());
|
|
350
|
+
pending[key] = shared$;
|
|
351
|
+
return shared$;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function retryLink(opts) {
|
|
357
|
+
// initialized config
|
|
358
|
+
return function () {
|
|
359
|
+
// initialized in app
|
|
360
|
+
return function (_ref) {
|
|
361
|
+
var op = _ref.op,
|
|
362
|
+
next = _ref.next;
|
|
363
|
+
// initialized for request
|
|
364
|
+
return observable(function (observer) {
|
|
365
|
+
var next$ = null;
|
|
366
|
+
var attempts = 0;
|
|
367
|
+
var isDone = false;
|
|
368
|
+
|
|
369
|
+
function attempt() {
|
|
370
|
+
var _next$;
|
|
371
|
+
|
|
372
|
+
attempts++;
|
|
373
|
+
(_next$ = next$) === null || _next$ === void 0 ? void 0 : _next$.unsubscribe();
|
|
374
|
+
next$ = next(op).subscribe({
|
|
375
|
+
error: function error(_error) {
|
|
376
|
+
if (attempts >= opts.attempts) {
|
|
377
|
+
observer.error(_error);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
attempt();
|
|
382
|
+
},
|
|
383
|
+
next: function next(result) {
|
|
384
|
+
if ('result' in result.data) {
|
|
385
|
+
isDone = true;
|
|
386
|
+
observer.next(result);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (attempts >= opts.attempts) {
|
|
391
|
+
isDone = true;
|
|
392
|
+
observer.next(result);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
attempt();
|
|
397
|
+
},
|
|
398
|
+
complete: function complete() {
|
|
399
|
+
if (isDone) {
|
|
400
|
+
observer.complete();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
attempt();
|
|
407
|
+
return function () {
|
|
408
|
+
var _next$2;
|
|
409
|
+
|
|
410
|
+
isDone = true;
|
|
411
|
+
(_next$2 = next$) === null || _next$2 === void 0 ? void 0 : _next$2.unsubscribe();
|
|
412
|
+
};
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export { createTRPCClient, dedupeLink, getFetch, retryLink };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyRouter } from '@trpc/server';
|
|
2
2
|
import { TRPCLink } from './types';
|
|
3
|
-
import { HTTPLinkOptions } from './httpUtils';
|
|
3
|
+
import { HTTPLinkOptions } from './internals/httpUtils';
|
|
4
4
|
export interface HttpBatchLinkOptions extends HTTPLinkOptions {
|
|
5
5
|
maxBatchSize?: number;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpBatchLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"httpBatchLink.d.ts","sourceRoot":"","sources":["../../src/links/httpBatchLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,eAAe,EAGhB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD,wBAAgB,aAAa,CAAC,OAAO,SAAS,SAAS,EACrD,IAAI,EAAE,oBAAoB,GACzB,QAAQ,CAAC,OAAO,CAAC,CA+DnB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var observable = require('../observable-9aaca086.js');
|
|
6
|
-
var httpUtils = require('../httpUtils-
|
|
6
|
+
var httpUtils = require('../httpUtils-27640b42.js');
|
|
7
7
|
require('@babel/runtime/helpers/defineProperty');
|
|
8
8
|
|
|
9
9
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as observable } from '../observable-16fde241.mjs';
|
|
2
|
-
import { h as httpRequest } from '../httpUtils-
|
|
2
|
+
import { h as httpRequest } from '../httpUtils-b92552af.mjs';
|
|
3
3
|
import '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
|
|
5
5
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
package/dist/links/httpLink.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyRouter } from '@trpc/server';
|
|
2
2
|
import { TRPCLink } from './types';
|
|
3
|
-
import { HTTPLinkOptions } from './httpUtils';
|
|
3
|
+
import { HTTPLinkOptions } from './internals/httpUtils';
|
|
4
4
|
export declare function httpLink<TRouter extends AnyRouter>(opts: HTTPLinkOptions): TRPCLink<TRouter>;
|
|
5
5
|
//# sourceMappingURL=httpLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAe,MAAM,uBAAuB,CAAC;AAErE,wBAAgB,QAAQ,CAAC,OAAO,SAAS,SAAS,EAChD,IAAI,EAAE,eAAe,GACpB,QAAQ,CAAC,OAAO,CAAC,CA2BnB"}
|
package/dist/links/httpLink.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var observable = require('../observable-9aaca086.js');
|
|
6
|
-
var httpUtils = require('../httpUtils-
|
|
6
|
+
var httpUtils = require('../httpUtils-27640b42.js');
|
|
7
7
|
require('@babel/runtime/helpers/defineProperty');
|
|
8
8
|
|
|
9
9
|
function httpLink(opts) {
|
package/dist/links/httpLink.mjs
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './dedupeLink';
|
|
2
|
+
export * from './httpBatchLink';
|
|
3
|
+
export * from './httpLink';
|
|
4
|
+
export * from './loggerLink';
|
|
5
|
+
export * from './loggerLink';
|
|
6
|
+
export * from './retryLink';
|
|
7
|
+
export * from './splitLink';
|
|
8
|
+
export * from './transformerLink';
|
|
9
|
+
export * from './wsLink';
|
|
10
|
+
export * from './types';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/links/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpUtils.d.ts","sourceRoot":"","sources":["../../../src/links/internals/httpUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACzD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb;AAiBD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE;QACJ,QAAQ,EAAE,QAAQ,CAAC;KACpB,CAAC;CACH;AACD,wBAAgB,WAAW,CACzB,KAAK,EAAE;IACL,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,CAAC;IAAE,MAAM,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,GAC/C,gBAAgB,CAAC,aAAa,CAAC,CA2DjC"}
|
package/dist/links/splitLink.js
CHANGED
|
@@ -2,31 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
5
|
+
require('../observable-9aaca086.js');
|
|
6
|
+
var links_splitLink = require('../splitLink-8635d455.js');
|
|
7
7
|
|
|
8
|
-
function asArray(value) {
|
|
9
|
-
return Array.isArray(value) ? value : [value];
|
|
10
|
-
}
|
|
11
8
|
|
|
12
|
-
function splitLink(opts) {
|
|
13
|
-
return function (rt) {
|
|
14
|
-
var yes = asArray(opts.true).map(function (link) {
|
|
15
|
-
return link(rt);
|
|
16
|
-
});
|
|
17
|
-
var no = asArray(opts.false).map(function (link) {
|
|
18
|
-
return link(rt);
|
|
19
|
-
});
|
|
20
|
-
return function (props) {
|
|
21
|
-
return observable.observable(function (observer) {
|
|
22
|
-
var links = opts.condition(props.op) ? yes : no;
|
|
23
|
-
return createChain.createChain({
|
|
24
|
-
op: props.op,
|
|
25
|
-
links: links
|
|
26
|
-
}).subscribe(observer);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
9
|
|
|
32
|
-
exports.splitLink = splitLink;
|
|
10
|
+
exports.splitLink = links_splitLink.splitLink;
|
package/dist/links/splitLink.mjs
CHANGED
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function asArray(value) {
|
|
5
|
-
return Array.isArray(value) ? value : [value];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function splitLink(opts) {
|
|
9
|
-
return function (rt) {
|
|
10
|
-
var yes = asArray(opts.true).map(function (link) {
|
|
11
|
-
return link(rt);
|
|
12
|
-
});
|
|
13
|
-
var no = asArray(opts.false).map(function (link) {
|
|
14
|
-
return link(rt);
|
|
15
|
-
});
|
|
16
|
-
return function (props) {
|
|
17
|
-
return observable(function (observer) {
|
|
18
|
-
var links = opts.condition(props.op) ? yes : no;
|
|
19
|
-
return createChain({
|
|
20
|
-
op: props.op,
|
|
21
|
-
links: links
|
|
22
|
-
}).subscribe(observer);
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { splitLink };
|
|
1
|
+
import '../observable-16fde241.mjs';
|
|
2
|
+
export { s as splitLink } from '../splitLink-a736378a.mjs';
|