@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.
- package/dist/{declarations/src/TRPCClientError.d.ts → TRPCClientError.d.ts} +21 -29
- package/dist/TRPCClientError.d.ts.map +1 -0
- package/dist/{declarations/src/createTRPCClient.d.ts → createTRPCClient.d.ts} +5 -5
- package/dist/createTRPCClient.d.ts.map +1 -0
- package/dist/{declarations/src/getFetch.d.ts → getFetch.d.ts} +1 -1
- package/dist/getFetch.d.ts.map +1 -0
- package/dist/{declarations/src/index.d.ts → index.d.ts} +4 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1417 -0
- package/dist/index.mjs +1391 -0
- package/dist/index.ts.js +1 -0
- package/dist/{declarations/src/internals → internals}/TRPCClient.d.ts +61 -64
- package/dist/internals/TRPCClient.d.ts.map +1 -0
- package/dist/{declarations/src/internals → internals}/dataLoader.d.ts +17 -14
- package/dist/internals/dataLoader.d.ts.map +1 -0
- package/dist/{declarations/src/internals → internals}/fetchHelpers.d.ts +2 -2
- package/dist/internals/fetchHelpers.d.ts.map +1 -0
- package/dist/{declarations/src/internals → internals}/retryDelay.d.ts +1 -1
- package/dist/internals/retryDelay.d.ts.map +1 -0
- package/dist/links/dedupeLink.d.ts +4 -0
- package/dist/links/dedupeLink.d.ts.map +1 -0
- package/dist/links/httpBatchLink.d.ts +8 -0
- package/dist/links/httpBatchLink.d.ts.map +1 -0
- package/dist/{declarations/src/links → links}/httpLink.d.ts +4 -4
- package/dist/links/httpLink.d.ts.map +1 -0
- package/dist/links/index.d.ts +9 -0
- package/dist/links/index.d.ts.map +1 -0
- package/dist/{declarations/src/links → links}/internals/createChain.d.ts +7 -7
- package/dist/links/internals/createChain.d.ts.map +1 -0
- package/dist/links/internals/httpUtils.d.ts +30 -0
- package/dist/links/internals/httpUtils.d.ts.map +1 -0
- package/dist/links/internals/transformOperationResult.d.ts +30 -0
- package/dist/links/internals/transformOperationResult.d.ts.map +1 -0
- package/dist/{declarations/src/links → links}/loggerLink.d.ts +38 -38
- package/dist/links/loggerLink.d.ts.map +1 -0
- package/dist/links/retryLink.d.ts +6 -0
- package/dist/links/retryLink.d.ts.map +1 -0
- package/dist/{declarations/src/links → links}/splitLink.d.ts +13 -13
- package/dist/links/splitLink.d.ts.map +1 -0
- package/dist/{declarations/src/links → links}/types.d.ts +42 -39
- package/dist/links/types.d.ts.map +1 -0
- package/dist/{declarations/src/links → links}/wsLink.d.ts +19 -19
- package/dist/links/wsLink.d.ts.map +1 -0
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.dev.js +68 -38
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.prod.js +68 -38
- package/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.esm.js +67 -37
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.dev.js +52 -29
- package/links/httpLink/dist/trpc-client-links-httpLink.cjs.prod.js +52 -29
- package/links/httpLink/dist/trpc-client-links-httpLink.esm.js +52 -29
- package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.dev.js +19 -31
- package/links/loggerLink/dist/trpc-client-links-loggerLink.cjs.prod.js +19 -31
- package/links/loggerLink/dist/trpc-client-links-loggerLink.esm.js +19 -31
- package/links/splitLink/dist/trpc-client-links-splitLink.cjs.dev.js +7 -20
- package/links/splitLink/dist/trpc-client-links-splitLink.cjs.prod.js +7 -20
- package/links/splitLink/dist/trpc-client-links-splitLink.esm.js +7 -20
- package/links/wsLink/dist/trpc-client-links-wsLink.cjs.dev.js +84 -60
- package/links/wsLink/dist/trpc-client-links-wsLink.cjs.prod.js +84 -60
- package/links/wsLink/dist/trpc-client-links-wsLink.esm.js +84 -60
- package/package.json +26 -23
- package/src/TRPCClientError.ts +3 -11
- package/src/createTRPCClient.ts +1 -1
- package/src/index.ts +1 -1
- package/src/internals/TRPCClient.ts +52 -36
- package/src/internals/dataLoader.ts +120 -45
- package/src/links/dedupeLink.test.ts +1 -1
- package/src/links/dedupeLink.ts +3 -5
- package/src/links/httpBatchLink.ts +64 -31
- package/src/links/httpLink.ts +4 -4
- package/src/links/index.ts +8 -0
- package/src/links/internals/createChain.test.ts +5 -5
- package/src/links/internals/createChain.ts +3 -3
- package/src/links/internals/httpUtils.ts +116 -0
- package/src/links/internals/transformOperationResult.ts +40 -12
- package/src/links/loggerLink.ts +1 -2
- package/src/links/retryLink.ts +1 -2
- package/src/links/splitLink.test.ts +3 -3
- package/src/links/splitLink.ts +5 -5
- package/src/links/types.ts +13 -8
- package/src/links/wsLink.ts +12 -12
- package/dist/TRPCClientError-a5312a5f.cjs.dev.js +0 -74
- package/dist/TRPCClientError-e1da1ef0.esm.js +0 -72
- package/dist/TRPCClientError-ea7d89b2.cjs.prod.js +0 -74
- package/dist/createChain-93a38e1c.cjs.dev.js +0 -27
- package/dist/createChain-e45e052a.cjs.prod.js +0 -27
- package/dist/createChain-e45e6cf2.esm.js +0 -25
- package/dist/declarations/src/TRPCClientError.d.ts.map +0 -1
- package/dist/declarations/src/createTRPCClient.d.ts.map +0 -1
- package/dist/declarations/src/getFetch.d.ts.map +0 -1
- package/dist/declarations/src/index.d.ts.map +0 -1
- package/dist/declarations/src/internals/TRPCClient.d.ts.map +0 -1
- package/dist/declarations/src/internals/dataLoader.d.ts.map +0 -1
- package/dist/declarations/src/internals/fetchHelpers.d.ts.map +0 -1
- package/dist/declarations/src/internals/retryDelay.d.ts.map +0 -1
- package/dist/declarations/src/links/httpBatchLink.d.ts +0 -5
- package/dist/declarations/src/links/httpBatchLink.d.ts.map +0 -1
- package/dist/declarations/src/links/httpLink.d.ts.map +0 -1
- package/dist/declarations/src/links/httpUtils.d.ts +0 -22
- package/dist/declarations/src/links/httpUtils.d.ts.map +0 -1
- package/dist/declarations/src/links/internals/createChain.d.ts.map +0 -1
- package/dist/declarations/src/links/internals/transformOperationResult.d.ts +0 -16
- package/dist/declarations/src/links/internals/transformOperationResult.d.ts.map +0 -1
- package/dist/declarations/src/links/loggerLink.d.ts.map +0 -1
- package/dist/declarations/src/links/splitLink.d.ts.map +0 -1
- package/dist/declarations/src/links/transformerLink.d.ts +0 -4
- package/dist/declarations/src/links/transformerLink.d.ts.map +0 -1
- package/dist/declarations/src/links/types.d.ts.map +0 -1
- package/dist/declarations/src/links/wsLink.d.ts.map +0 -1
- package/dist/declarations/src/rx/index.d.ts +0 -3
- package/dist/declarations/src/rx/index.d.ts.map +0 -1
- package/dist/declarations/src/rx/observable.d.ts +0 -4
- package/dist/declarations/src/rx/observable.d.ts.map +0 -1
- package/dist/declarations/src/rx/operators/index.d.ts +0 -4
- package/dist/declarations/src/rx/operators/index.d.ts.map +0 -1
- package/dist/declarations/src/rx/operators/map.d.ts +0 -3
- package/dist/declarations/src/rx/operators/map.d.ts.map +0 -1
- package/dist/declarations/src/rx/operators/share.d.ts +0 -6
- package/dist/declarations/src/rx/operators/share.d.ts.map +0 -1
- package/dist/declarations/src/rx/operators/tap.d.ts +0 -3
- package/dist/declarations/src/rx/operators/tap.d.ts.map +0 -1
- package/dist/declarations/src/rx/types.d.ts +0 -29
- package/dist/declarations/src/rx/types.d.ts.map +0 -1
- package/dist/declarations/src/rx/util/identity.d.ts +0 -2
- package/dist/declarations/src/rx/util/identity.d.ts.map +0 -1
- package/dist/declarations/src/rx/util/observableToPromise.d.ts +0 -10
- package/dist/declarations/src/rx/util/observableToPromise.d.ts.map +0 -1
- package/dist/declarations/src/rx/util/pipe.d.ts +0 -4
- package/dist/declarations/src/rx/util/pipe.d.ts.map +0 -1
- package/dist/httpUtils-299a66f6.cjs.prod.js +0 -89
- package/dist/httpUtils-a1426e14.cjs.dev.js +0 -89
- package/dist/httpUtils-e45c9056.esm.js +0 -87
- package/dist/observable-01534ea8.esm.js +0 -102
- package/dist/observable-9aad8c3e.cjs.dev.js +0 -104
- package/dist/observable-ccb54234.cjs.prod.js +0 -104
- package/dist/share-5a8c2543.cjs.prod.js +0 -106
- package/dist/share-ca585761.esm.js +0 -104
- package/dist/share-f2ac9332.cjs.dev.js +0 -106
- package/dist/tap-2d565250.cjs.dev.js +0 -32
- package/dist/tap-606957cb.esm.js +0 -30
- package/dist/tap-d907998d.cjs.prod.js +0 -32
- package/dist/trpc-client.cjs.d.ts +0 -1
- package/dist/trpc-client.cjs.dev.js +0 -300
- package/dist/trpc-client.cjs.js +0 -7
- package/dist/trpc-client.cjs.prod.js +0 -300
- package/dist/trpc-client.esm.js +0 -295
- package/links/httpBatchLink/package.json +0 -4
- package/links/httpLink/package.json +0 -4
- package/links/loggerLink/package.json +0 -4
- package/links/splitLink/package.json +0 -4
- 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/package.json +0 -4
- package/links/wsLink/package.json +0 -4
- package/rx/dist/trpc-client-rx.cjs.d.ts +0 -1
- package/rx/dist/trpc-client-rx.cjs.dev.js +0 -9
- package/rx/dist/trpc-client-rx.cjs.js +0 -7
- package/rx/dist/trpc-client-rx.cjs.prod.js +0 -9
- package/rx/dist/trpc-client-rx.esm.js +0 -1
- package/rx/operators/dist/trpc-client-rx-operators.cjs.d.ts +0 -1
- package/rx/operators/dist/trpc-client-rx-operators.cjs.dev.js +0 -39
- package/rx/operators/dist/trpc-client-rx-operators.cjs.js +0 -7
- package/rx/operators/dist/trpc-client-rx-operators.cjs.prod.js +0 -39
- package/rx/operators/dist/trpc-client-rx-operators.esm.js +0 -33
- package/rx/operators/package.json +0 -4
- package/rx/package.json +0 -4
- package/src/internals/transformRPCResponse.ts +0 -25
- package/src/links/httpUtils.ts +0 -94
- package/src/links/transformerLink.ts +0 -70
- package/src/rx/index.ts +0 -2
- package/src/rx/observable.test.ts +0 -83
- package/src/rx/observable.ts +0 -70
- package/src/rx/operators/index.ts +0 -3
- package/src/rx/operators/map.test.ts +0 -92
- package/src/rx/operators/map.ts +0 -25
- package/src/rx/operators/share.test.ts +0 -60
- package/src/rx/operators/share.ts +0 -67
- package/src/rx/operators/tap.ts +0 -26
- package/src/rx/types.ts +0 -69
- package/src/rx/util/identity.ts +0 -3
- package/src/rx/util/observableToPromise.ts +0 -49
- package/src/rx/util/pipe.ts +0 -22
package/src/rx/types.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export interface Unsubscribable {
|
|
2
|
-
unsubscribe(): void;
|
|
3
|
-
}
|
|
4
|
-
export type UnsubscribeFn = () => void;
|
|
5
|
-
export interface Subscribable<TValue, TError> {
|
|
6
|
-
subscribe(observer: Partial<Observer<TValue, TError>>): Unsubscribable;
|
|
7
|
-
}
|
|
8
|
-
export interface Observable<TValue, TError>
|
|
9
|
-
extends Subscribable<TValue, TError> {
|
|
10
|
-
pipe(): Observable<TValue, TError>;
|
|
11
|
-
pipe<V1, E1>(
|
|
12
|
-
op1: OperatorFunction<TValue, TError, V1, E1>,
|
|
13
|
-
): Observable<V1, E1>;
|
|
14
|
-
pipe<V1, E1, V2, E2>(
|
|
15
|
-
op1: OperatorFunction<TValue, TError, V1, E1>,
|
|
16
|
-
op2: OperatorFunction<V1, E1, V2, E2>,
|
|
17
|
-
): Observable<V2, E2>;
|
|
18
|
-
pipe<V1, E1, V2, E2, V3, E3>(
|
|
19
|
-
op1: OperatorFunction<TValue, TError, V1, E1>,
|
|
20
|
-
op2: OperatorFunction<V1, E1, V2, E2>,
|
|
21
|
-
op3: OperatorFunction<V2, E2, V3, E3>,
|
|
22
|
-
): Observable<V2, E2>;
|
|
23
|
-
pipe<V1, E1, V2, E2, V3, E3, V4, E4>(
|
|
24
|
-
op1: OperatorFunction<TValue, TError, V1, E1>,
|
|
25
|
-
op2: OperatorFunction<V1, E1, V2, E2>,
|
|
26
|
-
op3: OperatorFunction<V2, E2, V3, E3>,
|
|
27
|
-
op4: OperatorFunction<V3, E3, V4, E4>,
|
|
28
|
-
): Observable<V2, E2>;
|
|
29
|
-
pipe<V1, E1, V2, E2, V3, E3, V4, E4, V5, E5>(
|
|
30
|
-
op1: OperatorFunction<TValue, TError, V1, E1>,
|
|
31
|
-
op2: OperatorFunction<V1, E1, V2, E2>,
|
|
32
|
-
op3: OperatorFunction<V2, E2, V3, E3>,
|
|
33
|
-
op4: OperatorFunction<V3, E3, V4, E4>,
|
|
34
|
-
op5: OperatorFunction<V4, E4, V5, E5>,
|
|
35
|
-
): Observable<V2, E2>;
|
|
36
|
-
}
|
|
37
|
-
export interface SubscriptionLike extends Unsubscribable {
|
|
38
|
-
unsubscribe(): void;
|
|
39
|
-
readonly closed: boolean;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface Observer<TValue, TError> {
|
|
43
|
-
next: (value: TValue) => void;
|
|
44
|
-
error: (err: TError) => void;
|
|
45
|
-
complete: () => void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type TeardownLogic =
|
|
49
|
-
// | SubscriptionLike
|
|
50
|
-
Unsubscribable | UnsubscribeFn | void;
|
|
51
|
-
|
|
52
|
-
export type UnaryFunction<T, R> = (source: T) => R;
|
|
53
|
-
|
|
54
|
-
export type OperatorFunction<
|
|
55
|
-
TValueBefore,
|
|
56
|
-
TErrorBefore,
|
|
57
|
-
TValueAfter,
|
|
58
|
-
TErrorAfter,
|
|
59
|
-
> = UnaryFunction<
|
|
60
|
-
Subscribable<TValueBefore, TErrorBefore>,
|
|
61
|
-
Subscribable<TValueAfter, TErrorAfter>
|
|
62
|
-
>;
|
|
63
|
-
|
|
64
|
-
export type MonoTypeOperatorFunction<TValue, TError> = OperatorFunction<
|
|
65
|
-
TValue,
|
|
66
|
-
TError,
|
|
67
|
-
TValue,
|
|
68
|
-
TError
|
|
69
|
-
>;
|
package/src/rx/util/identity.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Observable } from '../types';
|
|
2
|
-
|
|
3
|
-
export class ObservableAbortError extends Error {
|
|
4
|
-
constructor(message: string) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.name = 'ObservableAbortError';
|
|
7
|
-
Object.setPrototypeOf(this, ObservableAbortError.prototype);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** @internal */
|
|
12
|
-
export function observableToPromise<TValue>(
|
|
13
|
-
observable: Observable<TValue, unknown>,
|
|
14
|
-
) {
|
|
15
|
-
let abort: () => void;
|
|
16
|
-
const promise = new Promise<TValue>((resolve, reject) => {
|
|
17
|
-
let isDone = false;
|
|
18
|
-
function onDone() {
|
|
19
|
-
if (isDone) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
isDone = true;
|
|
23
|
-
reject(new ObservableAbortError('This operation was cancelled.'));
|
|
24
|
-
obs$.unsubscribe();
|
|
25
|
-
}
|
|
26
|
-
const obs$ = observable.subscribe({
|
|
27
|
-
next(data) {
|
|
28
|
-
isDone = true;
|
|
29
|
-
resolve(data);
|
|
30
|
-
onDone();
|
|
31
|
-
},
|
|
32
|
-
error(data) {
|
|
33
|
-
isDone = true;
|
|
34
|
-
reject(data);
|
|
35
|
-
onDone();
|
|
36
|
-
},
|
|
37
|
-
complete() {
|
|
38
|
-
isDone = true;
|
|
39
|
-
onDone();
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
abort = onDone;
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
promise,
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
47
|
-
abort: abort!,
|
|
48
|
-
};
|
|
49
|
-
}
|
package/src/rx/util/pipe.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { identity } from './identity';
|
|
2
|
-
import { UnaryFunction } from '../types';
|
|
3
|
-
|
|
4
|
-
/** @internal */
|
|
5
|
-
export function pipeFromArray<T, R>(
|
|
6
|
-
fns: Array<UnaryFunction<T, R>>,
|
|
7
|
-
): UnaryFunction<T, R> {
|
|
8
|
-
if (fns.length === 0) {
|
|
9
|
-
return identity as UnaryFunction<any, any>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (fns.length === 1) {
|
|
13
|
-
return fns[0];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return function piped(input: T): R {
|
|
17
|
-
return fns.reduce(
|
|
18
|
-
(prev: any, fn: UnaryFunction<T, R>) => fn(prev),
|
|
19
|
-
input as any,
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
}
|