@trpc/client 10.45.1-canary.8 → 10.45.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.
- package/dist/TRPCClientError.d.ts +2 -2
- package/dist/TRPCClientError.d.ts.map +1 -1
- package/dist/createTRPCClient.d.ts +5 -5
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/createTRPCClientProxy.d.ts +6 -5
- package/dist/createTRPCClientProxy.d.ts.map +1 -1
- package/dist/createTRPCUntypedClient.d.ts +3 -2
- package/dist/createTRPCUntypedClient.d.ts.map +1 -1
- package/dist/getFetch.d.ts +1 -1
- package/dist/getFetch.d.ts.map +1 -1
- package/dist/internals/TRPCUntypedClient.d.ts +3 -3
- package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
- package/dist/internals/dataLoader.d.ts +1 -1
- package/dist/internals/dataLoader.d.ts.map +1 -1
- package/dist/internals/getAbortController.d.ts +2 -2
- package/dist/internals/getAbortController.d.ts.map +1 -1
- package/dist/links/HTTPBatchLinkOptions.d.ts +3 -3
- package/dist/links/HTTPBatchLinkOptions.d.ts.map +1 -1
- package/dist/links/httpBatchLink.d.ts +1 -1
- package/dist/links/httpBatchLink.d.ts.map +1 -1
- package/dist/links/httpBatchStreamLink.d.ts +2 -2
- package/dist/links/httpBatchStreamLink.d.ts.map +1 -1
- package/dist/links/httpFormDataLink.d.ts.map +1 -1
- package/dist/links/httpLink.d.ts +3 -3
- package/dist/links/httpLink.d.ts.map +1 -1
- package/dist/links/internals/createChain.d.ts +2 -2
- package/dist/links/internals/createChain.d.ts.map +1 -1
- package/dist/links/internals/createHTTPBatchLink.d.ts +4 -4
- package/dist/links/internals/createHTTPBatchLink.d.ts.map +1 -1
- package/dist/links/internals/dedupeLink.d.ts +2 -2
- package/dist/links/internals/dedupeLink.d.ts.map +1 -1
- package/dist/links/internals/getTextDecoder.d.ts +1 -1
- package/dist/links/internals/getTextDecoder.d.ts.map +1 -1
- package/dist/links/internals/httpUtils.d.ts +5 -5
- package/dist/links/internals/httpUtils.d.ts.map +1 -1
- package/dist/links/internals/parseJSONStream.d.ts +4 -4
- package/dist/links/internals/parseJSONStream.d.ts.map +1 -1
- package/dist/links/internals/retryLink.d.ts +2 -2
- package/dist/links/internals/retryLink.d.ts.map +1 -1
- package/dist/links/loggerLink.d.ts +3 -3
- package/dist/links/loggerLink.d.ts.map +1 -1
- package/dist/links/splitLink.d.ts +2 -2
- package/dist/links/splitLink.d.ts.map +1 -1
- package/dist/links/types.d.ts +5 -5
- package/dist/links/types.d.ts.map +1 -1
- package/dist/links/wsLink.d.ts +4 -4
- package/dist/links/wsLink.d.ts.map +1 -1
- package/links/formDataLink/index.d.ts +1 -0
- package/links/formDataLink/index.js +1 -0
- package/links/httpTuplesonLink/index.d.ts +1 -0
- package/links/httpTuplesonLink/index.js +1 -0
- package/package.json +4 -4
- package/src/TRPCClientError.ts +2 -2
- package/src/createTRPCClient.ts +6 -6
- package/src/createTRPCClientProxy.ts +7 -8
- package/src/createTRPCUntypedClient.ts +3 -5
- package/src/getFetch.ts +1 -1
- package/src/internals/TRPCUntypedClient.ts +4 -5
- package/src/internals/dataLoader.ts +1 -1
- package/src/internals/getAbortController.ts +2 -2
- package/src/links/HTTPBatchLinkOptions.ts +3 -3
- package/src/links/httpBatchLink.ts +5 -7
- package/src/links/httpBatchStreamLink.ts +6 -8
- package/src/links/httpFormDataLink.ts +2 -1
- package/src/links/httpLink.ts +6 -4
- package/src/links/internals/createChain.ts +6 -2
- package/src/links/internals/createHTTPBatchLink.ts +10 -9
- package/src/links/internals/dedupeLink.ts +4 -3
- package/src/links/internals/getTextDecoder.ts +1 -1
- package/src/links/internals/httpUtils.ts +9 -5
- package/src/links/internals/parseJSONStream.ts +6 -11
- package/src/links/internals/retryLink.ts +4 -3
- package/src/links/loggerLink.ts +3 -3
- package/src/links/splitLink.ts +2 -2
- package/src/links/types.ts +5 -5
- package/src/links/wsLink.ts +5 -4
- package/dist/bundle-analysis.json +0 -367
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
AnyRouter,
|
|
3
3
|
ClientDataTransformerOptions,
|
|
4
4
|
CombinedDataTransformer,
|
|
5
5
|
DataTransformerOptions,
|
|
6
6
|
DefaultDataTransformer,
|
|
7
7
|
} from '@trpc/server';
|
|
8
|
-
import {
|
|
8
|
+
import type {
|
|
9
9
|
inferObservableValue,
|
|
10
|
-
observableToPromise,
|
|
11
|
-
share,
|
|
12
10
|
Unsubscribable,
|
|
13
11
|
} from '@trpc/server/observable';
|
|
12
|
+
import { observableToPromise, share } from '@trpc/server/observable';
|
|
14
13
|
import { createChain } from '../links/internals/createChain';
|
|
15
|
-
import {
|
|
14
|
+
import type {
|
|
16
15
|
OperationContext,
|
|
17
16
|
OperationLink,
|
|
18
17
|
TRPCClientRuntime,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Maybe } from '@trpc/server';
|
|
2
|
-
import { AbortControllerEsque } from './types';
|
|
1
|
+
import type { Maybe } from '@trpc/server';
|
|
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
|
-
|
|
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
|
-
|
|
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,5 +1,6 @@
|
|
|
1
1
|
import { httpLinkFactory } from './httpLink';
|
|
2
|
-
import { GetBody,
|
|
2
|
+
import type { GetBody, Requester } from './internals/httpUtils';
|
|
3
|
+
import { httpRequest } from './internals/httpUtils';
|
|
3
4
|
|
|
4
5
|
const getBody: GetBody = (opts) => {
|
|
5
6
|
if (!('input' in opts)) {
|
package/src/links/httpLink.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { AnyRouter } from '@trpc/server';
|
|
1
|
+
import type { AnyRouter } from '@trpc/server';
|
|
2
2
|
import { observable } from '@trpc/server/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';
|
|
1
|
+
import type { AnyRouter } from '@trpc/server';
|
|
2
2
|
import { observable } from '@trpc/server/observable';
|
|
3
|
-
import {
|
|
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';
|
|
1
|
+
import type { AnyRouter, ProcedureType } from '@trpc/server';
|
|
2
2
|
import { observable } from '@trpc/server/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 {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
5
|
-
import {
|
|
3
|
+
import type { AnyRouter } from '@trpc/server';
|
|
4
|
+
import type { Observable } from '@trpc/server/observable';
|
|
5
|
+
import { observable, share } from '@trpc/server/observable';
|
|
6
|
+
import type { TRPCLink } from '../types';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @internal used for testing
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ProcedureType } from '@trpc/server';
|
|
2
|
-
import { TRPCResponse } from '@trpc/server/rpc';
|
|
1
|
+
import type { ProcedureType } from '@trpc/server';
|
|
2
|
+
import type { TRPCResponse } from '@trpc/server/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 {
|
|
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
|
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
getUrl,
|
|
9
|
-
HTTPBaseRequestOptions,
|
|
10
|
-
HTTPResult,
|
|
11
|
-
} from './httpUtils';
|
|
12
|
-
import { TextDecoderEsque } from './streamingUtils';
|
|
2
|
+
import type { TRPCResponse } from '@trpc/server/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 {
|
|
5
|
-
import {
|
|
3
|
+
import type { AnyRouter } from '@trpc/server';
|
|
4
|
+
import type { Unsubscribable } from '@trpc/server/observable';
|
|
5
|
+
import { observable } from '@trpc/server/observable';
|
|
6
|
+
import type { TRPCLink } from '../types';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @internal used for testing
|
package/src/links/loggerLink.ts
CHANGED
|
@@ -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';
|
|
8
|
+
import type { AnyRouter } from '@trpc/server';
|
|
9
9
|
import { observable, tap } from '@trpc/server/observable';
|
|
10
|
-
import { TRPCClientError } from '..';
|
|
11
|
-
import { Operation, OperationResultEnvelope, TRPCLink } from './types';
|
|
10
|
+
import type { TRPCClientError } from '..';
|
|
11
|
+
import type { Operation, OperationResultEnvelope, TRPCLink } from './types';
|
|
12
12
|
|
|
13
13
|
type ConsoleEsque = {
|
|
14
14
|
log: (...args: any[]) => void;
|
package/src/links/splitLink.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AnyRouter } from '@trpc/server';
|
|
1
|
+
import type { AnyRouter } from '@trpc/server';
|
|
2
2
|
import { observable } from '@trpc/server/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];
|
package/src/links/types.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
AnyRouter,
|
|
3
3
|
CombinedDataTransformer,
|
|
4
4
|
DataTransformer,
|
|
5
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';
|
|
6
|
+
import type { Observable, Observer } from '@trpc/server/observable';
|
|
7
|
+
import type { TRPCResultMessage, TRPCSuccessResponse } from '@trpc/server/rpc';
|
|
8
|
+
import type { ResponseEsque } from '../internals/types';
|
|
9
|
+
import type { TRPCClientError } from '../TRPCClientError';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @internal
|
package/src/links/wsLink.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AnyRouter, inferRouterError, ProcedureType } from '@trpc/server';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { AnyRouter, inferRouterError, ProcedureType } from '@trpc/server';
|
|
2
|
+
import type { Observer, UnsubscribeFn } from '@trpc/server/observable';
|
|
3
|
+
import { observable } from '@trpc/server/observable';
|
|
4
|
+
import type {
|
|
4
5
|
TRPCClientIncomingMessage,
|
|
5
6
|
TRPCClientIncomingRequest,
|
|
6
7
|
TRPCClientOutgoingMessage,
|
|
@@ -10,7 +11,7 @@ import {
|
|
|
10
11
|
import { retryDelay } from '../internals/retryDelay';
|
|
11
12
|
import { transformResult } from '../shared/transformResult';
|
|
12
13
|
import { TRPCClientError } from '../TRPCClientError';
|
|
13
|
-
import { Operation, TRPCLink } from './types';
|
|
14
|
+
import type { Operation, TRPCLink } from './types';
|
|
14
15
|
|
|
15
16
|
type WSCallbackResult<TRouter extends AnyRouter, TOutput> = TRPCResponseMessage<
|
|
16
17
|
TOutput,
|