@trpc/client 10.0.0-proxy-alpha.55 → 10.0.0-proxy-alpha.58
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/README.md +1 -2
- package/dist/createTRPCClientProxy.d.ts +4 -4
- package/dist/createTRPCClientProxy.d.ts.map +1 -1
- package/dist/getFetch.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/dist/internals/fetchHelpers.d.ts.map +1 -1
- package/dist/links/types.d.ts +1 -1
- package/dist/links/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/createTRPCClientProxy.ts +5 -4
- package/src/getFetch.ts +6 -4
- package/src/internals/fetchHelpers.ts +2 -3
- package/src/links/types.ts +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AnyRouter, OmitNeverKeys, Procedure, ProcedureArgs, ProcedureRouterRecord, inferProcedureOutput } from '@trpc/server';
|
|
2
2
|
import type { Unsubscribable, inferObservableValue } from '@trpc/server/observable';
|
|
3
|
-
import type { TRPCResultMessage } from '@trpc/server/rpc';
|
|
4
3
|
import { TRPCClientError } from './TRPCClientError';
|
|
5
4
|
import { CreateTRPCClientOptions } from './createTRPCClient';
|
|
6
5
|
import { TRPCClient as Client, TRPCSubscriptionObserver } from './internals/TRPCClient';
|
|
6
|
+
export declare type inferRouterProxyClient<TRouter extends AnyRouter> = DecoratedProcedureRecord<TRouter['_def']['record'], TRouter>;
|
|
7
7
|
declare type Resolver<TProcedure extends Procedure<any>> = (...args: ProcedureArgs<TProcedure['_def']>) => Promise<inferProcedureOutput<TProcedure>>;
|
|
8
8
|
declare type SubscriptionResolver<TProcedure extends Procedure<any>, TRouter extends AnyRouter> = (...args: [
|
|
9
9
|
input: ProcedureArgs<TProcedure['_def']>[0],
|
|
10
|
-
opts: ProcedureArgs<TProcedure['_def']>[1] & Partial<TRPCSubscriptionObserver<
|
|
10
|
+
opts: ProcedureArgs<TProcedure['_def']>[1] & Partial<TRPCSubscriptionObserver<inferObservableValue<inferProcedureOutput<TProcedure>>, TRPCClientError<TRouter>>>
|
|
11
11
|
]) => Unsubscribable;
|
|
12
12
|
declare type DecorateProcedure<TProcedure extends Procedure<any>, TRouter extends AnyRouter> = OmitNeverKeys<{
|
|
13
13
|
query: TProcedure extends {
|
|
@@ -31,7 +31,7 @@ declare type DecoratedProcedureRecord<TProcedures extends ProcedureRouterRecord,
|
|
|
31
31
|
* @deprecated use `createTRPCProxyClient` instead
|
|
32
32
|
* @internal
|
|
33
33
|
*/
|
|
34
|
-
export declare function createTRPCClientProxy<TRouter extends AnyRouter>(client: Client<TRouter>):
|
|
35
|
-
export declare function createTRPCProxyClient<TRouter extends AnyRouter>(opts: CreateTRPCClientOptions<TRouter>):
|
|
34
|
+
export declare function createTRPCClientProxy<TRouter extends AnyRouter>(client: Client<TRouter>): inferRouterProxyClient<TRouter>;
|
|
35
|
+
export declare function createTRPCProxyClient<TRouter extends AnyRouter>(opts: CreateTRPCClientOptions<TRouter>): inferRouterProxyClient<TRouter>;
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=createTRPCClientProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCClientProxy.d.ts","sourceRoot":"","sources":["../src/createTRPCClientProxy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,aAAa,EACb,qBAAqB,EAErB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"createTRPCClientProxy.d.ts","sourceRoot":"","sources":["../src/createTRPCClientProxy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,aAAa,EACb,qBAAqB,EAErB,oBAAoB,EACrB,MAAM,cA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C,CAAC,EAAE,OAAO,KAAK,GAAG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getFetch.d.ts","sourceRoot":"","sources":["../src/getFetch.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,GAAG,OAAO,KAAK,CAcvD"}
|
package/dist/index.js
CHANGED
|
@@ -16,11 +16,10 @@ function getWindow() {
|
|
|
16
16
|
if (typeof window !== 'undefined') {
|
|
17
17
|
return window;
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return globalThis;
|
|
20
20
|
}
|
|
21
21
|
function getAbortController(ac) {
|
|
22
|
-
|
|
23
|
-
return (ac ?? win.AbortController) ?? undefined;
|
|
22
|
+
return (ac ?? getWindow().AbortController) ?? undefined;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
function getFetch(f) {
|
|
@@ -28,8 +27,9 @@ function getFetch(f) {
|
|
|
28
27
|
return f;
|
|
29
28
|
}
|
|
30
29
|
const win = getWindow();
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const globalFetch = win.fetch;
|
|
31
|
+
if (globalFetch) {
|
|
32
|
+
return typeof globalFetch.bind === 'function' ? globalFetch.bind(win) : globalFetch;
|
|
33
33
|
}
|
|
34
34
|
throw new Error('No fetch implementation found');
|
|
35
35
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -15,11 +15,10 @@ function getWindow() {
|
|
|
15
15
|
if (typeof window !== 'undefined') {
|
|
16
16
|
return window;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return globalThis;
|
|
19
19
|
}
|
|
20
20
|
function getAbortController(ac) {
|
|
21
|
-
|
|
22
|
-
return (ac ?? win.AbortController) ?? undefined;
|
|
21
|
+
return (ac ?? getWindow().AbortController) ?? undefined;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
function getFetch(f) {
|
|
@@ -27,8 +26,9 @@ function getFetch(f) {
|
|
|
27
26
|
return f;
|
|
28
27
|
}
|
|
29
28
|
const win = getWindow();
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const globalFetch = win.fetch;
|
|
30
|
+
if (globalFetch) {
|
|
31
|
+
return typeof globalFetch.bind === 'function' ? globalFetch.bind(win) : globalFetch;
|
|
32
32
|
}
|
|
33
33
|
throw new Error('No fetch implementation found');
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchHelpers.d.ts","sourceRoot":"","sources":["../../../../packages/client/src/internals/fetchHelpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,sBAKxB;AACD,wBAAgB,kBAAkB,CAChC,EAAE,CAAC,EAAE,OAAO,eAAe,GAC1B,OAAO,eAAe,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"fetchHelpers.d.ts","sourceRoot":"","sources":["../../../../packages/client/src/internals/fetchHelpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,sBAKxB;AACD,wBAAgB,kBAAkB,CAChC,EAAE,CAAC,EAAE,OAAO,eAAe,GAC1B,OAAO,eAAe,GAAG,SAAS,CAEpC"}
|
package/dist/links/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare type Operation<TInput = unknown> = {
|
|
|
15
15
|
path: string;
|
|
16
16
|
context: OperationContext;
|
|
17
17
|
};
|
|
18
|
-
export declare type HTTPHeaders = Record<string, string | string[]>;
|
|
18
|
+
export declare type HTTPHeaders = Record<string, string | string[] | undefined>;
|
|
19
19
|
/**
|
|
20
20
|
* The default `fetch` implementation has an overloaded signature. By convention this library
|
|
21
21
|
* only uses the overload taking a string and options object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../packages/client/src/links/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,C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S,SAAS,EACzB,MAAM,GAAG,OAAO,EAChB,OAAO,GAAG,OAAO,IACf,CAAC,IAAI,EAAE;IACT,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtB,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;CAC9E,KAAK,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAElD,oBAAY,QAAQ,CAAC,OAAO,SAAS,SAAS,IAAI,CAChD,IAAI,EAAE,iBAAiB,KACpB,aAAa,CAAC,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "10.0.0-proxy-alpha.
|
|
3
|
+
"version": "10.0.0-proxy-alpha.58",
|
|
4
4
|
"description": "tRPC Client lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"ts-watch": "tsc --project tsconfig.watch.json"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@trpc/server": "10.0.0-proxy-alpha.
|
|
66
|
+
"@trpc/server": "10.0.0-proxy-alpha.58"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@trpc/server": "10.0.0-proxy-alpha.
|
|
69
|
+
"@trpc/server": "10.0.0-proxy-alpha.58"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "2024f3e073f2ec3002f34d47d7f19df89ca2f478"
|
|
75
75
|
}
|
|
@@ -23,6 +23,9 @@ import {
|
|
|
23
23
|
TRPCSubscriptionObserver,
|
|
24
24
|
} from './internals/TRPCClient';
|
|
25
25
|
|
|
26
|
+
export type inferRouterProxyClient<TRouter extends AnyRouter> =
|
|
27
|
+
DecoratedProcedureRecord<TRouter['_def']['record'], TRouter>;
|
|
28
|
+
|
|
26
29
|
type Resolver<TProcedure extends Procedure<any>> = (
|
|
27
30
|
...args: ProcedureArgs<TProcedure['_def']>
|
|
28
31
|
) => Promise<inferProcedureOutput<TProcedure>>;
|
|
@@ -36,9 +39,7 @@ type SubscriptionResolver<
|
|
|
36
39
|
opts: ProcedureArgs<TProcedure['_def']>[1] &
|
|
37
40
|
Partial<
|
|
38
41
|
TRPCSubscriptionObserver<
|
|
39
|
-
|
|
40
|
-
inferObservableValue<inferProcedureOutput<TProcedure>>
|
|
41
|
-
>,
|
|
42
|
+
inferObservableValue<inferProcedureOutput<TProcedure>>,
|
|
42
43
|
TRPCClientError<TRouter>
|
|
43
44
|
>
|
|
44
45
|
>,
|
|
@@ -101,7 +102,7 @@ export function createTRPCClientProxy<TRouter extends AnyRouter>(
|
|
|
101
102
|
const fullPath = pathCopy.join('.');
|
|
102
103
|
return (client as any)[procedureType](fullPath, ...args);
|
|
103
104
|
});
|
|
104
|
-
return proxy as
|
|
105
|
+
return proxy as inferRouterProxyClient<TRouter>;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
export function createTRPCProxyClient<TRouter extends AnyRouter>(
|
package/src/getFetch.ts
CHANGED
|
@@ -4,11 +4,13 @@ export function getFetch(f?: typeof fetch): typeof fetch {
|
|
|
4
4
|
if (f) {
|
|
5
5
|
return f;
|
|
6
6
|
}
|
|
7
|
+
|
|
7
8
|
const win = getWindow();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const globalFetch = win.fetch;
|
|
10
|
+
if (globalFetch) {
|
|
11
|
+
return typeof globalFetch.bind === 'function'
|
|
12
|
+
? globalFetch.bind(win)
|
|
13
|
+
: globalFetch;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
throw new Error('No fetch implementation found');
|
|
@@ -2,11 +2,10 @@ export function getWindow() {
|
|
|
2
2
|
if (typeof window !== 'undefined') {
|
|
3
3
|
return window;
|
|
4
4
|
}
|
|
5
|
-
return
|
|
5
|
+
return globalThis;
|
|
6
6
|
}
|
|
7
7
|
export function getAbortController(
|
|
8
8
|
ac?: typeof AbortController,
|
|
9
9
|
): typeof AbortController | undefined {
|
|
10
|
-
|
|
11
|
-
return ac ?? win.AbortController ?? undefined;
|
|
10
|
+
return ac ?? getWindow().AbortController ?? undefined;
|
|
12
11
|
}
|
package/src/links/types.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type Operation<TInput = unknown> = {
|
|
|
19
19
|
context: OperationContext;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export type HTTPHeaders = Record<string, string | string[]>;
|
|
22
|
+
export type HTTPHeaders = Record<string, string | string[] | undefined>;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The default `fetch` implementation has an overloaded signature. By convention this library
|