@trpc/client 10.27.3 → 10.28.1

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 (47) hide show
  1. package/dist/TRPCClientError.d.ts +25 -25
  2. package/dist/TRPCClientError.d.ts.map +1 -1
  3. package/dist/createTRPCClient.d.ts +19 -19
  4. package/dist/createTRPCClientProxy.d.ts +38 -38
  5. package/dist/createTRPCClientProxy.d.ts.map +1 -1
  6. package/dist/createTRPCUntypedClient.d.ts +4 -4
  7. package/dist/getFetch.d.ts +2 -2
  8. package/dist/{httpUtils-1a07b2e6.js → httpUtils-00c8b54e.js} +125 -125
  9. package/dist/index.d.ts +6 -6
  10. package/dist/internals/TRPCUntypedClient.d.ts +61 -61
  11. package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
  12. package/dist/internals/dataLoader.d.ts +17 -17
  13. package/dist/internals/dataLoader.d.ts.map +1 -1
  14. package/dist/internals/getAbortController.d.ts +3 -3
  15. package/dist/internals/retryDelay.d.ts +1 -1
  16. package/dist/internals/types.d.ts +75 -102
  17. package/dist/internals/types.d.ts.map +1 -1
  18. package/dist/links/dedupeLink.d.ts +3 -3
  19. package/dist/links/httpBatchLink.d.ts +15 -15
  20. package/dist/links/httpFormDataLink.d.ts +1 -1
  21. package/dist/links/httpLink.d.ts +16 -16
  22. package/dist/links/index.d.ts +7 -7
  23. package/dist/links/internals/createChain.d.ts +7 -7
  24. package/dist/links/internals/httpUtils.d.ts +59 -59
  25. package/dist/links/internals/httpUtils.d.ts.map +1 -1
  26. package/dist/links/internals/isObject.d.ts +1 -1
  27. package/dist/links/loggerLink.d.ts +39 -39
  28. package/dist/links/loggerLink.d.ts.map +1 -1
  29. package/dist/links/retryLink.d.ts +5 -5
  30. package/dist/links/splitLink.d.ts +13 -13
  31. package/dist/links/types.d.ts +69 -69
  32. package/dist/links/types.d.ts.map +1 -1
  33. package/dist/links/wsLink.d.ts +28 -28
  34. package/dist/links/wsLink.d.ts.map +1 -1
  35. package/dist/links/wsLink.js +9 -17
  36. package/dist/links/wsLink.mjs +9 -17
  37. package/dist/shared/index.d.ts +1 -1
  38. package/dist/shared/transformResult.d.ts +33 -33
  39. package/dist/{splitLink-aebd28df.js → splitLink-0df96fdc.js} +34 -34
  40. package/dist/{transformResult-fc4863b8.js → transformResult-ae8e970c.js} +80 -80
  41. package/package.json +11 -7
  42. package/src/internals/types.ts +0 -39
  43. package/src/links/wsLink.ts +10 -24
  44. package/src/internals/types.test.ts +0 -66
  45. package/src/links/dedupeLink.test.ts +0 -128
  46. package/src/links/internals/createChain.test.ts +0 -117
  47. package/src/links/splitLink.test.ts +0 -55
@@ -1,55 +0,0 @@
1
- import { observable } from '@trpc/server/observable';
2
- import { splitLink } from '../';
3
- import { OperationLink, TRPCLink } from '../';
4
- import { AnyRouter } from '../../../server/src';
5
- import { createChain } from '../links/internals/createChain';
6
-
7
- test('splitLink', () => {
8
- const wsLinkSpy = vi.fn();
9
- const wsLink: TRPCLink<any> = () => () =>
10
- observable(() => {
11
- wsLinkSpy();
12
- });
13
- const httpLinkSpy = vi.fn();
14
- const httpLink: TRPCLink<any> = () => () =>
15
- observable(() => {
16
- httpLinkSpy();
17
- });
18
- const links: OperationLink<AnyRouter, any, any>[] = [
19
- // "dedupe link"
20
- splitLink({
21
- condition(op) {
22
- return op.type === 'subscription';
23
- },
24
- true: wsLink,
25
- false: [httpLink],
26
- })(null as any),
27
- ];
28
-
29
- createChain({
30
- links,
31
- op: {
32
- type: 'query',
33
- input: null,
34
- path: '.',
35
- id: 0,
36
- context: {},
37
- },
38
- }).subscribe({});
39
- expect(httpLinkSpy).toHaveBeenCalledTimes(1);
40
- expect(wsLinkSpy).toHaveBeenCalledTimes(0);
41
- vi.resetAllMocks();
42
-
43
- createChain({
44
- links,
45
- op: {
46
- type: 'subscription',
47
- input: null,
48
- path: '.',
49
- id: 0,
50
- context: {},
51
- },
52
- }).subscribe({});
53
- expect(httpLinkSpy).toHaveBeenCalledTimes(0);
54
- expect(wsLinkSpy).toHaveBeenCalledTimes(1);
55
- });