@trpc/client 11.0.0-next-alpha.153 → 11.0.0-next-alpha.155

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 (106) hide show
  1. package/dist/{TRPCClientError-c88f4205.js → TRPCClientError-27d80214.js} +1 -2
  2. package/dist/{TRPCClientError-2ec26a15.mjs → TRPCClientError-3414c3d5.mjs} +1 -2
  3. package/dist/{TRPCClientError-848288ef.js → TRPCClientError-67aefe1c.js} +3 -4
  4. package/dist/TRPCClientError.d.ts +2 -4
  5. package/dist/TRPCClientError.d.ts.map +1 -1
  6. package/dist/bundle-analysis.json +71 -86
  7. package/dist/createTRPCClient.d.ts +6 -7
  8. package/dist/createTRPCClient.d.ts.map +1 -1
  9. package/dist/createTRPCUntypedClient.d.ts +3 -2
  10. package/dist/createTRPCUntypedClient.d.ts.map +1 -1
  11. package/dist/getFetch.d.ts +1 -1
  12. package/dist/getFetch.d.ts.map +1 -1
  13. package/dist/{httpBatchLink-865a32d4.js → httpBatchLink-4653e4a1.js} +4 -4
  14. package/dist/{httpBatchLink-35588380.mjs → httpBatchLink-a1f60db9.mjs} +4 -4
  15. package/dist/{httpBatchLink-32dfcf36.js → httpBatchLink-f7c51d58.js} +4 -4
  16. package/dist/{httpUtils-7ea72426.js → httpUtils-49fa3edc.js} +1 -1
  17. package/dist/{httpUtils-85f06c75.js → httpUtils-60af4c3d.js} +1 -1
  18. package/dist/{httpUtils-e82f7939.mjs → httpUtils-82ae6a64.mjs} +1 -1
  19. package/dist/index.js +18 -19
  20. package/dist/index.mjs +21 -22
  21. package/dist/internals/TRPCUntypedClient.d.ts +3 -3
  22. package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
  23. package/dist/internals/dataLoader.d.ts +1 -1
  24. package/dist/internals/dataLoader.d.ts.map +1 -1
  25. package/dist/internals/getAbortController.d.ts +2 -2
  26. package/dist/internals/getAbortController.d.ts.map +1 -1
  27. package/dist/links/HTTPBatchLinkOptions.d.ts +3 -3
  28. package/dist/links/HTTPBatchLinkOptions.d.ts.map +1 -1
  29. package/dist/links/httpBatchLink.d.ts +2 -2
  30. package/dist/links/httpBatchLink.d.ts.map +1 -1
  31. package/dist/links/httpBatchLink.js +6 -6
  32. package/dist/links/httpBatchLink.mjs +6 -6
  33. package/dist/links/httpBatchStreamLink.d.ts +3 -3
  34. package/dist/links/httpBatchStreamLink.d.ts.map +1 -1
  35. package/dist/links/httpFormDataLink.d.ts +1 -1
  36. package/dist/links/httpFormDataLink.d.ts.map +1 -1
  37. package/dist/links/httpLink.d.ts +3 -3
  38. package/dist/links/httpLink.d.ts.map +1 -1
  39. package/dist/links/httpLink.js +5 -5
  40. package/dist/links/httpLink.mjs +5 -5
  41. package/dist/links/internals/createChain.d.ts +2 -2
  42. package/dist/links/internals/createChain.d.ts.map +1 -1
  43. package/dist/links/internals/createHTTPBatchLink.d.ts +4 -4
  44. package/dist/links/internals/createHTTPBatchLink.d.ts.map +1 -1
  45. package/dist/links/internals/dedupeLink.d.ts +2 -2
  46. package/dist/links/internals/dedupeLink.d.ts.map +1 -1
  47. package/dist/links/internals/getTextDecoder.d.ts +1 -1
  48. package/dist/links/internals/getTextDecoder.d.ts.map +1 -1
  49. package/dist/links/internals/httpUtils.d.ts +7 -7
  50. package/dist/links/internals/httpUtils.d.ts.map +1 -1
  51. package/dist/links/internals/parseJSONStream.d.ts +4 -4
  52. package/dist/links/internals/parseJSONStream.d.ts.map +1 -1
  53. package/dist/links/internals/retryLink.d.ts +2 -2
  54. package/dist/links/internals/retryLink.d.ts.map +1 -1
  55. package/dist/links/loggerLink.d.ts +3 -3
  56. package/dist/links/loggerLink.d.ts.map +1 -1
  57. package/dist/links/loggerLink.js +1 -1
  58. package/dist/links/loggerLink.mjs +1 -1
  59. package/dist/links/splitLink.d.ts +2 -2
  60. package/dist/links/splitLink.d.ts.map +1 -1
  61. package/dist/links/splitLink.js +2 -2
  62. package/dist/links/splitLink.mjs +2 -2
  63. package/dist/links/types.d.ts +5 -5
  64. package/dist/links/types.d.ts.map +1 -1
  65. package/dist/links/wsLink.d.ts +4 -5
  66. package/dist/links/wsLink.d.ts.map +1 -1
  67. package/dist/links/wsLink.js +4 -4
  68. package/dist/links/wsLink.mjs +4 -4
  69. package/dist/shared/index.js +2 -1
  70. package/dist/shared/index.mjs +2 -1
  71. package/dist/shared/transformResult.d.ts +6 -4
  72. package/dist/shared/transformResult.d.ts.map +1 -1
  73. package/dist/{splitLink-4c75f7be.mjs → splitLink-13989f7f.mjs} +1 -1
  74. package/dist/{splitLink-f29e84be.js → splitLink-18238436.js} +1 -1
  75. package/dist/{splitLink-0df96fdc.js → splitLink-bd4bf809.js} +1 -1
  76. package/dist/{transformResult-db438b36.js → transformResult-150436c9.js} +3 -7
  77. package/dist/{transformResult-15ae4dcc.js → transformResult-c388d1ca.js} +2 -5
  78. package/dist/{transformResult-c5af197e.mjs → transformResult-e5b21a85.mjs} +2 -5
  79. package/package.json +13 -14
  80. package/src/TRPCClientError.ts +6 -7
  81. package/src/createTRPCClient.ts +10 -13
  82. package/src/createTRPCUntypedClient.ts +3 -5
  83. package/src/getFetch.ts +1 -1
  84. package/src/internals/TRPCUntypedClient.ts +6 -7
  85. package/src/internals/dataLoader.ts +1 -1
  86. package/src/internals/getAbortController.ts +2 -2
  87. package/src/links/HTTPBatchLinkOptions.ts +3 -3
  88. package/src/links/httpBatchLink.ts +5 -7
  89. package/src/links/httpBatchStreamLink.ts +6 -8
  90. package/src/links/httpFormDataLink.ts +11 -12
  91. package/src/links/httpLink.ts +7 -5
  92. package/src/links/internals/createChain.ts +7 -3
  93. package/src/links/internals/createHTTPBatchLink.ts +11 -10
  94. package/src/links/internals/dedupeLink.ts +4 -3
  95. package/src/links/internals/getTextDecoder.ts +1 -1
  96. package/src/links/internals/httpUtils.ts +11 -10
  97. package/src/links/internals/parseJSONStream.ts +6 -11
  98. package/src/links/internals/retryLink.ts +4 -3
  99. package/src/links/loggerLink.ts +4 -4
  100. package/src/links/splitLink.ts +3 -3
  101. package/src/links/types.ts +6 -6
  102. package/src/links/wsLink.ts +11 -6
  103. package/src/shared/transformResult.ts +2 -3
  104. package/dist/internals/isObject.d.ts +0 -2
  105. package/dist/internals/isObject.d.ts.map +0 -1
  106. package/src/internals/isObject.ts +0 -4
@@ -1,12 +1,12 @@
1
- import type { AnyRouter, inferRouterError } from '@trpc/server';
2
- import type { TRPCResponse, TRPCResponseMessage } from '@trpc/server/rpc';
1
+ import { type AnyRouter, type inferRouterError } from '@trpc/core';
2
+ import type { TRPCResponse, TRPCResponseMessage } from '@trpc/core/rpc';
3
3
  import type { TRPCClientRuntime } from '../links';
4
4
  /** @internal */
5
5
  declare function transformResultInner<TRouter extends AnyRouter, TOutput>(response: TRPCResponse<TOutput, inferRouterError<TRouter>> | TRPCResponseMessage<TOutput, inferRouterError<TRouter>>, runtime: TRPCClientRuntime): {
6
6
  readonly ok: false;
7
7
  readonly error: {
8
8
  readonly error: inferRouterError<TRouter>;
9
- readonly id?: import("@trpc/server/rpc").JSONRPC2.RequestId | undefined;
9
+ readonly id?: import("@trpc/core/rpc").JSONRPC2.RequestId | undefined;
10
10
  readonly jsonrpc?: "2.0" | undefined;
11
11
  } | {
12
12
  readonly error: inferRouterError<TRouter>;
@@ -18,9 +18,11 @@ declare function transformResultInner<TRouter extends AnyRouter, TOutput>(respon
18
18
  readonly ok: true;
19
19
  readonly result: {
20
20
  type: "started";
21
+ data?: undefined;
21
22
  } | {
22
23
  type: "stopped";
23
- } | (import("@trpc/server/rpc").TRPCResult<TOutput> & {
24
+ data?: undefined;
25
+ } | (import("@trpc/core/rpc").TRPCResult<TOutput> & {
24
26
  type: "data";
25
27
  });
26
28
  readonly error?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"transformResult.d.ts","sourceRoot":"","sources":["../../src/shared/transformResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKlD,gBAAgB;AAChB,iBAAS,oBAAoB,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,EAC9D,QAAQ,EACJ,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAChD,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAC3D,OAAO,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAuB3B;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,EAChE,QAAQ,EACJ,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAChD,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAC3D,OAAO,EAAE,iBAAiB,GACzB,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAqBzC"}
1
+ {"version":3,"file":"transformResult.d.ts","sourceRoot":"","sources":["../../src/shared/transformResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKlD,gBAAgB;AAChB,iBAAS,oBAAoB,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,EAC9D,QAAQ,EACJ,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAChD,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAC3D,OAAO,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;EAuB3B;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,EAChE,QAAQ,EACJ,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAChD,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAC3D,OAAO,EAAE,iBAAiB,GACzB,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAqBzC"}
@@ -1,4 +1,4 @@
1
- import { observable } from '@trpc/server/observable';
1
+ import { observable } from '@trpc/core/observable';
2
2
 
3
3
  /** @internal */ function createChain(opts) {
4
4
  return observable((observer)=>{
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var observable = require('@trpc/server/observable');
3
+ var observable = require('@trpc/core/observable');
4
4
 
5
5
  /** @internal */ function createChain(opts) {
6
6
  return observable.observable((observer)=>{
@@ -1,4 +1,4 @@
1
- import { observable } from '@trpc/server/observable';
1
+ import { observable } from '@trpc/core/observable';
2
2
 
3
3
  /** @internal */
4
4
  function createChain(opts) {
@@ -1,9 +1,6 @@
1
1
  'use strict';
2
2
 
3
- function isObject(value) {
4
- // check that value is object
5
- return !!value && !Array.isArray(value) && typeof value === 'object';
6
- }
3
+ var core = require('@trpc/core');
7
4
 
8
5
  // FIXME:
9
6
  // - the generics here are probably unnecessary
@@ -48,14 +45,13 @@ class TransformResultError extends Error {
48
45
  throw new TransformResultError();
49
46
  }
50
47
  // check that output of the transformers is a valid TRPCResponse
51
- if (!result.ok && (!isObject(result.error.error) || typeof result.error.error['code'] !== 'number')) {
48
+ if (!result.ok && (!core.isObject(result.error.error) || typeof result.error.error['code'] !== 'number')) {
52
49
  throw new TransformResultError();
53
50
  }
54
- if (result.ok && !isObject(result.result)) {
51
+ if (result.ok && !core.isObject(result.result)) {
55
52
  throw new TransformResultError();
56
53
  }
57
54
  return result;
58
55
  }
59
56
 
60
- exports.isObject = isObject;
61
57
  exports.transformResult = transformResult;
@@ -1,7 +1,4 @@
1
- function isObject(value) {
2
- // check that value is object
3
- return !!value && !Array.isArray(value) && typeof value === 'object';
4
- }
1
+ import { isObject } from '@trpc/core';
5
2
 
6
3
  // FIXME:
7
4
  // - the generics here are probably unnecessary
@@ -57,4 +54,4 @@ function transformResult(response, runtime) {
57
54
  return result;
58
55
  }
59
56
 
60
- export { isObject as i, transformResult as t };
57
+ export { transformResult as t };
@@ -1,7 +1,4 @@
1
- function isObject(value) {
2
- // check that value is object
3
- return !!value && !Array.isArray(value) && typeof value === 'object';
4
- }
1
+ import { isObject } from '@trpc/core';
5
2
 
6
3
  // FIXME:
7
4
  // - the generics here are probably unnecessary
@@ -55,4 +52,4 @@ class TransformResultError extends Error {
55
52
  return result;
56
53
  }
57
54
 
58
- export { isObject as i, transformResult as t };
55
+ export { transformResult as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/client",
3
- "version": "11.0.0-next-alpha.153+ad79cc8a2",
3
+ "version": "11.0.0-next-alpha.155+b93149c63",
4
4
  "description": "The tRPC client library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -35,26 +35,26 @@
35
35
  "require": "./dist/index.js",
36
36
  "default": "./dist/index.js"
37
37
  },
38
- "./links/httpLink": {
39
- "import": "./dist/links/httpLink.mjs",
40
- "require": "./dist/links/httpLink.js",
41
- "default": "./dist/links/httpLink.js"
42
- },
43
38
  "./links/httpBatchLink": {
44
39
  "import": "./dist/links/httpBatchLink.mjs",
45
40
  "require": "./dist/links/httpBatchLink.js",
46
41
  "default": "./dist/links/httpBatchLink.js"
47
42
  },
48
- "./links/splitLink": {
49
- "import": "./dist/links/splitLink.mjs",
50
- "require": "./dist/links/splitLink.js",
51
- "default": "./dist/links/splitLink.js"
43
+ "./links/httpLink": {
44
+ "import": "./dist/links/httpLink.mjs",
45
+ "require": "./dist/links/httpLink.js",
46
+ "default": "./dist/links/httpLink.js"
52
47
  },
53
48
  "./links/loggerLink": {
54
49
  "import": "./dist/links/loggerLink.mjs",
55
50
  "require": "./dist/links/loggerLink.js",
56
51
  "default": "./dist/links/loggerLink.js"
57
52
  },
53
+ "./links/splitLink": {
54
+ "import": "./dist/links/splitLink.mjs",
55
+ "require": "./dist/links/splitLink.js",
56
+ "default": "./dist/links/splitLink.js"
57
+ },
58
58
  "./links/wsLink": {
59
59
  "import": "./dist/links/wsLink.mjs",
60
60
  "require": "./dist/links/wsLink.js",
@@ -75,12 +75,11 @@
75
75
  "shared",
76
76
  "!**/*.test.*"
77
77
  ],
78
- "peerDependencies": {
79
- "@trpc/server": "11.0.0-next-alpha.153+ad79cc8a2"
78
+ "dependencies": {
79
+ "@trpc/core": "11.0.0-next-alpha.155+b93149c63"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@testing-library/dom": "^9.0.0",
83
- "@trpc/server": "11.0.0-next-alpha.153+ad79cc8a2",
84
83
  "@types/isomorphic-fetch": "^0.0.39",
85
84
  "@types/node": "^20.10.0",
86
85
  "eslint": "^8.40.0",
@@ -97,5 +96,5 @@
97
96
  "funding": [
98
97
  "https://trpc.io/sponsor"
99
98
  ],
100
- "gitHead": "ad79cc8a233428b1ff9a12d0927cfc53064571eb"
99
+ "gitHead": "b93149c63192bc113ef45f43188fbd993df39027"
101
100
  }
@@ -1,12 +1,11 @@
1
- import { DefaultErrorShape } from '@trpc/server';
2
- import { TRPCErrorResponse } from '@trpc/server/rpc';
3
- import {
4
- getCauseFromUnknown,
1
+ import type {
2
+ DefaultErrorShape,
5
3
  inferErrorShape,
4
+ Maybe,
6
5
  TRPCInferrable,
7
- } from '@trpc/server/shared';
8
- import { Maybe } from '@trpc/server/unstableInternalsExport';
9
- import { isObject } from './internals/isObject';
6
+ } from '@trpc/core';
7
+ import { getCauseFromUnknown, isObject } from '@trpc/core';
8
+ import type { TRPCErrorResponse } from '@trpc/core/rpc';
10
9
 
11
10
  export interface TRPCClientErrorBase<TShape extends DefaultErrorShape> {
12
11
  readonly message: string;
@@ -6,25 +6,22 @@ import type {
6
6
  AnyRootConfig,
7
7
  AnyRouter,
8
8
  AnySubscriptionProcedure,
9
+ inferTransformedProcedureOutput,
10
+ inferTransformedSubscriptionOutput,
11
+ IntersectionError,
9
12
  ProcedureArgs,
10
13
  ProcedureRouterRecord,
11
14
  ProcedureType,
12
- } from '@trpc/server';
13
- import type { Unsubscribable } from '@trpc/server/observable';
14
- import {
15
- createFlatProxy,
16
- createRecursiveProxy,
17
- inferTransformedProcedureOutput,
18
- inferTransformedSubscriptionOutput,
19
- } from '@trpc/server/shared';
20
- import { IntersectionError } from '@trpc/server/unstableInternalsExport';
21
- import { CreateTRPCClientOptions } from './createTRPCUntypedClient';
22
- import {
15
+ } from '@trpc/core';
16
+ import { createFlatProxy, createRecursiveProxy } from '@trpc/core';
17
+ import type { Unsubscribable } from '@trpc/core/observable';
18
+ import type { CreateTRPCClientOptions } from './createTRPCUntypedClient';
19
+ import type {
23
20
  TRPCSubscriptionObserver,
24
- TRPCUntypedClient,
25
21
  UntypedClientProperties,
26
22
  } from './internals/TRPCUntypedClient';
27
- import { TRPCClientError } from './TRPCClientError';
23
+ import { TRPCUntypedClient } from './internals/TRPCUntypedClient';
24
+ import type { TRPCClientError } from './TRPCClientError';
28
25
 
29
26
  /**
30
27
  * @public
@@ -1,8 +1,6 @@
1
- import { AnyRouter } from '@trpc/server';
2
- import {
3
- CreateTRPCClientOptions,
4
- TRPCUntypedClient,
5
- } from './internals/TRPCUntypedClient';
1
+ import type { AnyRouter } from '@trpc/core';
2
+ import type { CreateTRPCClientOptions } from './internals/TRPCUntypedClient';
3
+ import { TRPCUntypedClient } from './internals/TRPCUntypedClient';
6
4
 
7
5
  export function createTRPCUntypedClient<TRouter extends AnyRouter>(
8
6
  opts: CreateTRPCClientOptions<TRouter>,
package/src/getFetch.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FetchEsque, NativeFetchEsque } from './internals/types';
1
+ import type { FetchEsque, NativeFetchEsque } from './internals/types';
2
2
 
3
3
  type AnyFn = (...args: any[]) => unknown;
4
4
 
@@ -1,17 +1,16 @@
1
- import {
1
+ import type {
2
2
  AnyRouter,
3
3
  CombinedDataTransformer,
4
4
  DataTransformerOptions,
5
5
  DefaultDataTransformer,
6
- } from '@trpc/server';
7
- import {
6
+ } from '@trpc/core';
7
+ import type {
8
8
  inferObservableValue,
9
- observableToPromise,
10
- share,
11
9
  Unsubscribable,
12
- } from '@trpc/server/observable';
10
+ } from '@trpc/core/observable';
11
+ import { observableToPromise, share } from '@trpc/core/observable';
13
12
  import { createChain } from '../links/internals/createChain';
14
- import {
13
+ import type {
15
14
  OperationContext,
16
15
  OperationLink,
17
16
  TRPCClientRuntime,
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
- import { CancelFn, PromiseAndCancel } from '../links/types';
2
+ import type { CancelFn, PromiseAndCancel } from '../links/types';
3
3
 
4
4
  type BatchItem<TKey, TValue> = {
5
5
  aborted: boolean;
@@ -1,5 +1,5 @@
1
- import { Maybe } from '@trpc/server/unstableInternalsExport';
2
- import { AbortControllerEsque } from './types';
1
+ import type { Maybe } from '@trpc/core';
2
+ import type { AbortControllerEsque } from './types';
3
3
 
4
4
  export function getAbortController(
5
5
  customAbortControllerImpl: Maybe<AbortControllerEsque>,
@@ -1,6 +1,6 @@
1
- import { NonEmptyArray } from '../internals/types';
2
- import { HTTPLinkBaseOptions } from './internals/httpUtils';
3
- import { HTTPHeaders, Operation } from './types';
1
+ import type { NonEmptyArray } from '../internals/types';
2
+ import type { HTTPLinkBaseOptions } from './internals/httpUtils';
3
+ import type { HTTPHeaders, Operation } from './types';
4
4
 
5
5
  export interface HTTPBatchLinkOptions extends HTTPLinkBaseOptions {
6
6
  maxURLLength?: number;
@@ -1,11 +1,9 @@
1
- import { NonEmptyArray } from '../internals/types';
2
- import { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
3
- import {
4
- createHTTPBatchLink,
5
- RequesterFn,
6
- } from './internals/createHTTPBatchLink';
1
+ import type { NonEmptyArray } from '../internals/types';
2
+ import type { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
3
+ import type { RequesterFn } from './internals/createHTTPBatchLink';
4
+ import { createHTTPBatchLink } from './internals/createHTTPBatchLink';
7
5
  import { jsonHttpRequester } from './internals/httpUtils';
8
- import { Operation } from './types';
6
+ import type { Operation } from './types';
9
7
 
10
8
  const batchRequester: RequesterFn<HTTPBatchLinkOptions> = (requesterOpts) => {
11
9
  return (batchOps) => {
@@ -1,13 +1,11 @@
1
- import { NonEmptyArray } from '../internals/types';
2
- import { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
3
- import {
4
- createHTTPBatchLink,
5
- RequesterFn,
6
- } from './internals/createHTTPBatchLink';
1
+ import type { NonEmptyArray } from '../internals/types';
2
+ import type { HTTPBatchLinkOptions } from './HTTPBatchLinkOptions';
3
+ import type { RequesterFn } from './internals/createHTTPBatchLink';
4
+ import { createHTTPBatchLink } from './internals/createHTTPBatchLink';
7
5
  import { getTextDecoder } from './internals/getTextDecoder';
8
6
  import { streamingJsonHttpRequester } from './internals/parseJSONStream';
9
- import { TextDecoderEsque } from './internals/streamingUtils';
10
- import { Operation } from './types';
7
+ import type { TextDecoderEsque } from './internals/streamingUtils';
8
+ import type { Operation } from './types';
11
9
 
12
10
  export interface HTTPBatchStreamLinkOptions extends HTTPBatchLinkOptions {
13
11
  /**
@@ -1,15 +1,6 @@
1
1
  import { httpLinkFactory } from './httpLink';
2
- import { GetBody, httpRequest, Requester } from './internals/httpUtils';
3
-
4
- const getBody: GetBody = (opts) => {
5
- if (!('input' in opts)) {
6
- return undefined;
7
- }
8
- if (!(opts.input instanceof FormData)) {
9
- throw new Error('Input is not FormData');
10
- }
11
- return opts.input;
12
- };
2
+ import type { Requester } from './internals/httpUtils';
3
+ import { httpRequest } from './internals/httpUtils';
13
4
 
14
5
  const formDataRequester: Requester = (opts) => {
15
6
  if (opts.type !== 'mutation') {
@@ -21,7 +12,15 @@ const formDataRequester: Requester = (opts) => {
21
12
  getUrl() {
22
13
  return `${opts.url}/${opts.path}`;
23
14
  },
24
- getBody,
15
+ getBody(opts) {
16
+ if (!('input' in opts)) {
17
+ return undefined;
18
+ }
19
+ if (!(opts.input instanceof FormData)) {
20
+ throw new Error('Input is not FormData');
21
+ }
22
+ return opts.input;
23
+ },
25
24
  });
26
25
  };
27
26
 
@@ -1,15 +1,17 @@
1
- import { AnyRouter } from '@trpc/server';
2
- import { observable } from '@trpc/server/observable';
1
+ import type { AnyRouter } from '@trpc/core';
2
+ import { observable } from '@trpc/core/observable';
3
3
  import { transformResult } from '../shared/transformResult';
4
4
  import { TRPCClientError } from '../TRPCClientError';
5
- import {
5
+ import type {
6
6
  HTTPLinkBaseOptions,
7
7
  HTTPResult,
8
- jsonHttpRequester,
9
8
  Requester,
9
+ } from './internals/httpUtils';
10
+ import {
11
+ jsonHttpRequester,
10
12
  resolveHTTPLinkOptions,
11
13
  } from './internals/httpUtils';
12
- import { HTTPHeaders, Operation, TRPCLink } from './types';
14
+ import type { HTTPHeaders, Operation, TRPCLink } from './types';
13
15
 
14
16
  export interface HTTPLinkOptions extends HTTPLinkBaseOptions {
15
17
  /**
@@ -1,6 +1,10 @@
1
- import { AnyRouter } from '@trpc/server';
2
- import { observable } from '@trpc/server/observable';
3
- import { Operation, OperationLink, OperationResultObservable } from '../types';
1
+ import type { AnyRouter } from '@trpc/core';
2
+ import { observable } from '@trpc/core/observable';
3
+ import type {
4
+ Operation,
5
+ OperationLink,
6
+ OperationResultObservable,
7
+ } from '../types';
4
8
 
5
9
  /** @internal */
6
10
  export function createChain<
@@ -1,16 +1,17 @@
1
- import { AnyRouter, ProcedureType } from '@trpc/server';
2
- import { observable } from '@trpc/server/observable';
1
+ import type { AnyRouter, ProcedureType } from '@trpc/core';
2
+ import { observable } from '@trpc/core/observable';
3
3
  import { dataLoader } from '../../internals/dataLoader';
4
4
  import { transformResult } from '../../shared/transformResult';
5
5
  import { TRPCClientError } from '../../TRPCClientError';
6
- import { HTTPBatchLinkOptions } from '../HTTPBatchLinkOptions';
7
- import { CancelFn, Operation, TRPCClientRuntime, TRPCLink } from '../types';
8
- import {
9
- getUrl,
10
- HTTPResult,
11
- ResolvedHTTPLinkOptions,
12
- resolveHTTPLinkOptions,
13
- } from './httpUtils';
6
+ import type { HTTPBatchLinkOptions } from '../HTTPBatchLinkOptions';
7
+ import type {
8
+ CancelFn,
9
+ Operation,
10
+ TRPCClientRuntime,
11
+ TRPCLink,
12
+ } from '../types';
13
+ import type { HTTPResult, ResolvedHTTPLinkOptions } from './httpUtils';
14
+ import { getUrl, resolveHTTPLinkOptions } from './httpUtils';
14
15
 
15
16
  /**
16
17
  * @internal
@@ -1,8 +1,9 @@
1
1
  /* istanbul ignore file -- @preserve */
2
2
  // We're not actually exporting this link
3
- import { AnyRouter } from '@trpc/server';
4
- import { Observable, observable, share } from '@trpc/server/observable';
5
- import { TRPCLink } from '../types';
3
+ import type { AnyRouter } from '@trpc/core';
4
+ import type { Observable } from '@trpc/core/observable';
5
+ import { observable, share } from '@trpc/core/observable';
6
+ import type { TRPCLink } from '../types';
6
7
 
7
8
  /**
8
9
  * @internal used for testing
@@ -1,4 +1,4 @@
1
- import { TextDecoderEsque } from './streamingUtils';
1
+ import type { TextDecoderEsque } from './streamingUtils';
2
2
 
3
3
  export function getTextDecoder(
4
4
  customTextDecoder?: TextDecoderEsque,
@@ -1,8 +1,8 @@
1
- import { ProcedureType } from '@trpc/server';
2
- import { TRPCResponse } from '@trpc/server/rpc';
1
+ import type { ProcedureType } from '@trpc/core';
2
+ import type { TRPCResponse } from '@trpc/core/rpc';
3
3
  import { getFetch } from '../../getFetch';
4
4
  import { getAbortController } from '../../internals/getAbortController';
5
- import {
5
+ import type {
6
6
  AbortControllerEsque,
7
7
  AbortControllerInstanceEsque,
8
8
  FetchEsque,
@@ -10,8 +10,12 @@ import {
10
10
  ResponseEsque,
11
11
  } from '../../internals/types';
12
12
  import { TRPCClientError } from '../../TRPCClientError';
13
- import { TextDecoderEsque } from '../internals/streamingUtils';
14
- import { HTTPHeaders, PromiseAndCancel, TRPCClientRuntime } from '../types';
13
+ import type { TextDecoderEsque } from '../internals/streamingUtils';
14
+ import type {
15
+ HTTPHeaders,
16
+ PromiseAndCancel,
17
+ TRPCClientRuntime,
18
+ } from '../types';
15
19
 
16
20
  /**
17
21
  * @internal
@@ -85,11 +89,8 @@ export type HTTPBaseRequestOptions = GetInputOptions &
85
89
  path: string;
86
90
  };
87
91
 
88
- export type GetUrl = (opts: HTTPBaseRequestOptions) => string;
89
- export type GetBody = (
90
- opts: HTTPBaseRequestOptions,
91
- ) => RequestInitEsque['body'];
92
-
92
+ type GetUrl = (opts: HTTPBaseRequestOptions) => string;
93
+ type GetBody = (opts: HTTPBaseRequestOptions) => RequestInitEsque['body'];
93
94
  export type ContentOptions = {
94
95
  batchModeHeader?: 'stream';
95
96
  contentTypeHeader?: string;
@@ -1,15 +1,10 @@
1
1
  // Stream parsing adapted from https://www.loginradius.com/blog/engineering/guest-post/http-streaming-with-nodejs-and-fetch-api/
2
- import { TRPCResponse } from '@trpc/server/rpc';
3
- import { WebReadableStreamEsque } from '../../internals/types';
4
- import { HTTPHeaders } from '../types';
5
- import {
6
- fetchHTTPResponse,
7
- getBody,
8
- getUrl,
9
- HTTPBaseRequestOptions,
10
- HTTPResult,
11
- } from './httpUtils';
12
- import { TextDecoderEsque } from './streamingUtils';
2
+ import type { TRPCResponse } from '@trpc/core/rpc';
3
+ import type { WebReadableStreamEsque } from '../../internals/types';
4
+ import type { HTTPHeaders } from '../types';
5
+ import type { HTTPBaseRequestOptions, HTTPResult } from './httpUtils';
6
+ import { fetchHTTPResponse, getBody, getUrl } from './httpUtils';
7
+ import type { TextDecoderEsque } from './streamingUtils';
13
8
 
14
9
  /**
15
10
  * @internal
@@ -1,8 +1,9 @@
1
1
  /* istanbul ignore file -- @preserve */
2
2
  // We're not actually exporting this link
3
- import { AnyRouter } from '@trpc/server';
4
- import { observable, Unsubscribable } from '@trpc/server/observable';
5
- import { TRPCLink } from '../types';
3
+ import type { AnyRouter } from '@trpc/core';
4
+ import type { Unsubscribable } from '@trpc/core/observable';
5
+ import { observable } from '@trpc/core/observable';
6
+ import type { TRPCLink } from '../types';
6
7
 
7
8
  /**
8
9
  * @internal used for testing
@@ -5,10 +5,10 @@
5
5
  // Using triple-slash directive makes sure that it will be available,
6
6
  // even if end-user `tsconfig.json` omits it in the `lib` array.
7
7
 
8
- import { AnyRouter } from '@trpc/server';
9
- import { observable, tap } from '@trpc/server/observable';
10
- import { TRPCClientError } from '..';
11
- import { Operation, OperationResultEnvelope, TRPCLink } from './types';
8
+ import type { AnyRouter } from '@trpc/core';
9
+ import { observable, tap } from '@trpc/core/observable';
10
+ import type { TRPCClientError } from '../TRPCClientError';
11
+ import type { Operation, OperationResultEnvelope, TRPCLink } from './types';
12
12
 
13
13
  type ConsoleEsque = {
14
14
  log: (...args: any[]) => void;
@@ -1,7 +1,7 @@
1
- import { AnyRouter } from '@trpc/server';
2
- import { observable } from '@trpc/server/observable';
1
+ import type { AnyRouter } from '@trpc/core';
2
+ import { observable } from '@trpc/core/observable';
3
3
  import { createChain } from './internals/createChain';
4
- import { Operation, TRPCLink } from './types';
4
+ import type { Operation, TRPCLink } from './types';
5
5
 
6
6
  function asArray<TType>(value: TType | TType[]) {
7
7
  return Array.isArray(value) ? value : [value];
@@ -1,12 +1,12 @@
1
- import {
1
+ import type {
2
2
  AnyRouter,
3
3
  CombinedDataTransformer,
4
4
  DataTransformer,
5
- } from '@trpc/server';
6
- import { Observable, Observer } from '@trpc/server/observable';
7
- import { TRPCResultMessage, TRPCSuccessResponse } from '@trpc/server/rpc';
8
- import { ResponseEsque } from '../internals/types';
9
- import { TRPCClientError } from '../TRPCClientError';
5
+ } from '@trpc/core';
6
+ import type { Observable, Observer } from '@trpc/core/observable';
7
+ import type { TRPCResultMessage, TRPCSuccessResponse } from '@trpc/core/rpc';
8
+ import type { ResponseEsque } from '../internals/types';
9
+ import type { TRPCClientError } from '../TRPCClientError';
10
10
 
11
11
  /**
12
12
  * @internal
@@ -1,16 +1,21 @@
1
- import { AnyRouter, inferRouterError, ProcedureType } from '@trpc/server';
2
- import { observable, Observer, UnsubscribeFn } from '@trpc/server/observable';
3
- import {
1
+ import type {
2
+ AnyRouter,
3
+ inferRouterError,
4
+ MaybePromise,
5
+ ProcedureType,
6
+ } from '@trpc/core';
7
+ import type { Observer, UnsubscribeFn } from '@trpc/core/observable';
8
+ import { observable } from '@trpc/core/observable';
9
+ import type {
4
10
  TRPCClientIncomingMessage,
5
11
  TRPCClientIncomingRequest,
6
12
  TRPCClientOutgoingMessage,
7
13
  TRPCRequestMessage,
8
14
  TRPCResponseMessage,
9
- } from '@trpc/server/rpc';
10
- import { MaybePromise } from '@trpc/server/unstableInternalsExport';
15
+ } from '@trpc/core/rpc';
11
16
  import { transformResult } from '../shared/transformResult';
12
17
  import { TRPCClientError } from '../TRPCClientError';
13
- import { Operation, TRPCLink } from './types';
18
+ import type { Operation, TRPCLink } from './types';
14
19
 
15
20
  const run = <TResult>(fn: () => TResult): TResult => fn();
16
21