@trpc/next 11.0.0-alpha-tmp.233 → 11.0.0-alpha-tmp-v11-trpc-sveltekit.191
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 +4 -4
- package/dist/app-dir/client.d.ts +3 -3
- package/dist/app-dir/client.d.ts.map +1 -1
- package/dist/app-dir/client.js +1 -2
- package/dist/app-dir/client.mjs +2 -3
- package/dist/app-dir/create-action-hook.d.ts +5 -4
- package/dist/app-dir/create-action-hook.d.ts.map +1 -1
- package/dist/app-dir/links/nextCache.d.ts +2 -2
- package/dist/app-dir/links/nextCache.d.ts.map +1 -1
- package/dist/app-dir/links/nextHttp.d.ts +2 -2
- package/dist/app-dir/links/nextHttp.d.ts.map +1 -1
- package/dist/app-dir/server.d.ts +4 -4
- package/dist/app-dir/server.d.ts.map +1 -1
- package/dist/app-dir/shared.d.ts +2 -2
- package/dist/app-dir/shared.d.ts.map +1 -1
- package/dist/app-dir/types.d.ts +2 -2
- package/dist/app-dir/types.d.ts.map +1 -1
- package/dist/bundle-analysis.json +24 -24
- package/dist/createTRPCNext.d.ts +7 -6
- package/dist/createTRPCNext.d.ts.map +1 -1
- package/dist/withTRPC.d.ts +4 -4
- package/dist/withTRPC.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/app-dir/client.ts +4 -3
- package/src/app-dir/create-action-hook.tsx +8 -8
- package/src/app-dir/links/nextCache.ts +4 -2
- package/src/app-dir/links/nextHttp.ts +3 -4
- package/src/app-dir/server.ts +10 -9
- package/src/app-dir/shared.ts +3 -3
- package/src/app-dir/types.ts +2 -2
- package/src/createTRPCNext.tsx +13 -9
- package/src/withTRPC.tsx +9 -15
package/README.md
CHANGED
|
@@ -24,16 +24,16 @@ Full documentation for `@trpc/next` can be found [here](https://trpc.io/docs/cli
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# npm
|
|
27
|
-
npm install @trpc/next @trpc/react-query @tanstack/react-query
|
|
27
|
+
npm install @trpc/next@next @trpc/react-query@next @tanstack/react-query
|
|
28
28
|
|
|
29
29
|
# Yarn
|
|
30
|
-
yarn add @trpc/next @trpc/react-query @tanstack/react-query
|
|
30
|
+
yarn add @trpc/next@next @trpc/react-query@next @tanstack/react-query
|
|
31
31
|
|
|
32
32
|
# pnpm
|
|
33
|
-
pnpm add @trpc/next @trpc/react-query @tanstack/react-query
|
|
33
|
+
pnpm add @trpc/next@next @trpc/react-query@next @tanstack/react-query
|
|
34
34
|
|
|
35
35
|
# Bun
|
|
36
|
-
bun add @trpc/next @trpc/react-query @tanstack/react-query
|
|
36
|
+
bun add @trpc/next@next @trpc/react-query@next @tanstack/react-query
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Basic Example
|
package/dist/app-dir/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CreateTRPCClient } from '@trpc/client';
|
|
2
|
-
import { AnyRouter } from '@trpc/core';
|
|
3
|
-
import { CreateTRPCNextAppRouterOptions } from './shared';
|
|
1
|
+
import type { CreateTRPCClient } from '@trpc/client';
|
|
2
|
+
import type { AnyRouter } from '@trpc/core';
|
|
3
|
+
import type { CreateTRPCNextAppRouterOptions } from './shared';
|
|
4
4
|
export { experimental_createActionHook, experimental_serverActionLink, type UseTRPCActionResult, } from './create-action-hook';
|
|
5
5
|
export declare function experimental_createTRPCNextAppDirClient<TRouter extends AnyRouter>(opts: CreateTRPCNextAppRouterOptions<TRouter>): CreateTRPCClient<TRouter>;
|
|
6
6
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/app-dir/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/app-dir/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,EAEL,6BAA6B,EAE7B,6BAA6B,EAE7B,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAS9B,wBAAgB,uCAAuC,CACrD,OAAO,SAAS,SAAS,EACzB,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC,6BAwC9C"}
|
package/dist/app-dir/client.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var client = require('@trpc/client');
|
|
6
6
|
var core = require('@trpc/core');
|
|
7
|
-
var shared$1 = require('@trpc/client/shared');
|
|
8
7
|
var observable = require('@trpc/core/observable');
|
|
9
8
|
var React = require('react');
|
|
10
9
|
var shared = require('../shared-a452b80f.js');
|
|
@@ -14,7 +13,7 @@ function experimental_serverActionLink() {
|
|
|
14
13
|
return (runtime)=>({ op })=>observable.observable((observer)=>{
|
|
15
14
|
const context = op.context;
|
|
16
15
|
context._action(shared.isFormData(op.input) ? op.input : runtime.transformer.serialize(op.input)).then((data)=>{
|
|
17
|
-
const transformed =
|
|
16
|
+
const transformed = core.transformResult(data, runtime.transformer);
|
|
18
17
|
if (!transformed.ok) {
|
|
19
18
|
observer.error(client.TRPCClientError.from(transformed.error, {}));
|
|
20
19
|
return;
|
package/dist/app-dir/client.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TRPCClientError, createTRPCUntypedClient, clientCallTypeToProcedureType } from '@trpc/client';
|
|
2
|
-
import { createRecursiveProxy } from '@trpc/core';
|
|
3
|
-
import { transformResult } from '@trpc/client/shared';
|
|
2
|
+
import { transformResult, createRecursiveProxy } from '@trpc/core';
|
|
4
3
|
import { observable } from '@trpc/core/observable';
|
|
5
4
|
import { useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
6
5
|
import { i as isFormData } from '../shared-2f1ecbeb.mjs';
|
|
@@ -10,7 +9,7 @@ function experimental_serverActionLink() {
|
|
|
10
9
|
return (runtime)=>({ op })=>observable((observer)=>{
|
|
11
10
|
const context = op.context;
|
|
12
11
|
context._action(isFormData(op.input) ? op.input : runtime.transformer.serialize(op.input)).then((data)=>{
|
|
13
|
-
const transformed = transformResult(data, runtime);
|
|
12
|
+
const transformed = transformResult(data, runtime.transformer);
|
|
14
13
|
if (!transformed.ok) {
|
|
15
14
|
observer.error(TRPCClientError.from(transformed.error, {}));
|
|
16
15
|
return;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CreateTRPCClientOptions,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { CreateTRPCClientOptions, TRPCLink } from '@trpc/client';
|
|
2
|
+
import { TRPCClientError } from '@trpc/client';
|
|
3
|
+
import type { AnyRouter, MaybePromise, ProcedureOptions, Simplify } from '@trpc/core';
|
|
4
|
+
import type { TRPCActionHandler } from './server';
|
|
5
|
+
import type { ActionHandlerDef } from './shared';
|
|
5
6
|
type MutationArgs<TDef extends ActionHandlerDef> = TDef['input'] extends void ? [input?: undefined | void, opts?: ProcedureOptions] : [input: FormData | TDef['input'], opts?: ProcedureOptions];
|
|
6
7
|
interface UseTRPCActionBaseResult<TDef extends ActionHandlerDef> {
|
|
7
8
|
mutate: (...args: MutationArgs<TDef>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-action-hook.d.ts","sourceRoot":"","sources":["../../src/app-dir/create-action-hook.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-action-hook.d.ts","sourceRoot":"","sources":["../../src/app-dir/create-action-hook.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,QAAQ,EAET,MAAM,cAAc,CAAC;AACtB,OAAO,EAA2B,eAAe,EAAE,MAAM,cAAc,CAAC;AAExE,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uBAAuB,CAAC,IAAI,CAAC;IACrC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,0BAA0B,CAAC,IAAI,SAAS,gBAAgB,CAChE,SAAQ,uBAAuB,CAAC,IAAI,CAAC;IACrC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;CACnB;AAGD,MAAM,MAAM,mBAAmB,CAAC,IAAI,SAAS,gBAAgB,IACzD,wBAAwB,CAAC,IAAI,CAAC,GAC9B,uBAAuB,CAAC,IAAI,CAAC,GAC7B,0BAA0B,CAAC,IAAI,CAAC,GAChC,0BAA0B,CAAC,IAAI,CAAC,CAAC;AAOrC,wBAAgB,6BAA6B,CAC3C,OAAO,SAAS,SAAS,GAAG,SAAS,KAClC,QAAQ,CAAC,OAAO,CAAC,CA6BrB;AAED,UAAU,oBAAoB,CAAC,IAAI,SAAS,gBAAgB;IAC1D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAClE,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC/E;AAGD,wBAAgB,6BAA6B,CAAC,OAAO,SAAS,SAAS,EACrE,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,oKA6FvC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TRPCLink } from '@trpc/client';
|
|
2
|
-
import { AnyRouter, inferRouterContext } from '@trpc/core';
|
|
1
|
+
import type { TRPCLink } from '@trpc/client';
|
|
2
|
+
import type { AnyRouter, inferRouterContext } from '@trpc/core';
|
|
3
3
|
type NextCacheLinkOptions<TRouter extends AnyRouter> = {
|
|
4
4
|
router: TRouter;
|
|
5
5
|
createContext: () => Promise<inferRouterContext<TRouter>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextCache.d.ts","sourceRoot":"","sources":["../../../src/app-dir/links/nextCache.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"nextCache.d.ts","sourceRoot":"","sources":["../../../src/app-dir/links/nextCache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAMhE,KAAK,oBAAoB,CAAC,OAAO,SAAS,SAAS,IAAI;IACrD,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC7B,CAAC;AAGF,wBAAgB,0BAA0B,CAAC,OAAO,SAAS,SAAS,EAClE,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAClC,QAAQ,CAAC,OAAO,CAAC,CAyDnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HTTPBatchLinkOptions, HTTPLinkOptions, TRPCLink } from '@trpc/client';
|
|
2
|
-
import { AnyRouter } from '@trpc/core';
|
|
1
|
+
import type { HTTPBatchLinkOptions, HTTPLinkOptions, TRPCLink } from '@trpc/client';
|
|
2
|
+
import type { AnyRouter } from '@trpc/core';
|
|
3
3
|
interface NextLinkBaseOptions {
|
|
4
4
|
revalidate?: number | false;
|
|
5
5
|
batch?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextHttp.d.ts","sourceRoot":"","sources":["../../../src/app-dir/links/nextHttp.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"nextHttp.d.ts","sourceRoot":"","sources":["../../../src/app-dir/links/nextHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,UAAU,mBAAmB;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,qBACR,SAAQ,mBAAmB,EACzB,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,UAAU,oBACR,SAAQ,mBAAmB,EACzB,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACrC,KAAK,EAAE,IAAI,CAAC;CACb;AAGD,wBAAgB,yBAAyB,CAAC,OAAO,SAAS,SAAS,EACjE,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,GACjD,QAAQ,CAAC,OAAO,CAAC,CAyCnB"}
|
package/dist/app-dir/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AnyProcedure, AnyRootConfig, AnyRouter, MaybePromise, Simplify } from '@trpc/core';
|
|
2
|
-
import { TRPCResponse } from '@trpc/core/rpc';
|
|
3
|
-
import { ActionHandlerDef, CreateTRPCNextAppRouterOptions, inferActionDef } from './shared';
|
|
4
|
-
import { NextAppDirDecoratedProcedureRecord } from './types';
|
|
1
|
+
import type { AnyProcedure, AnyRootConfig, AnyRouter, MaybePromise, Simplify } from '@trpc/core';
|
|
2
|
+
import type { TRPCResponse } from '@trpc/core/rpc';
|
|
3
|
+
import type { ActionHandlerDef, CreateTRPCNextAppRouterOptions, inferActionDef } from './shared';
|
|
4
|
+
import type { NextAppDirDecoratedProcedureRecord } from './types';
|
|
5
5
|
export declare function experimental_createTRPCNextAppDirServer<TRouter extends AnyRouter>(opts: CreateTRPCNextAppRouterOptions<TRouter>): NextAppDirDecoratedProcedureRecord<TRouter["_def"]["_config"], TRouter["_def"]["record"]>;
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EAGT,YAAY,EACZ,QAAQ,EACT,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD,OAAO,KAAK,EACV,gBAAgB,EAChB,8BAA8B,EAC9B,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,SAAS,CAAC;AAGlE,wBAAgB,uCAAuC,CACrD,OAAO,SAAS,SAAS,EACzB,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC,6FA2B9C;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,IAAI,SAAS,gBAAgB,IAAI,CAC7D,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAE/D,wBAAgB,sCAAsC,CACpD,SAAS,SAAS;IAChB,OAAO,EAAE,aAAa,CAAC;CACxB,EAED,CAAC,EAAE,SAAS,EACZ,IAAI,EAAE;IACJ,aAAa,EAAE,MAAM,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;;;;GAgEF;AAGD,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,OAAO,qBAiBjE"}
|
package/dist/app-dir/shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CreateTRPCClientOptions, Resolver, TRPCUntypedClient } from '@trpc/client';
|
|
2
|
-
import { AnyProcedure, AnyQueryProcedure, AnyRootConfig, AnyRouter, Filter, inferHandlerInput, ProtectedIntersection } from '@trpc/core';
|
|
1
|
+
import type { CreateTRPCClientOptions, Resolver, TRPCUntypedClient } from '@trpc/client';
|
|
2
|
+
import type { AnyProcedure, AnyQueryProcedure, AnyRootConfig, AnyRouter, Filter, inferHandlerInput, ProtectedIntersection } from '@trpc/core';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/app-dir/shared.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/app-dir/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,QAAQ,EACR,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAGpB;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,SAAS,IAAI;KACzD,IAAI,IAAI,MAAM,MAAM,CACnB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,iBAAiB,GAAG,SAAS,CAC9B,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GACjD,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC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,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAM5D;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,EAAE,GAAG,CAAC;CACjB;AAGD;;GAEG;AACH,MAAM,MAAM,cAAc,CACxB,OAAO,SAAS,aAAa,EAC7B,KAAK,SAAS,YAAY,IACxB;IACF,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;IACrC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;CAC7C,CAAC"}
|
package/dist/app-dir/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Resolver } from '@trpc/client';
|
|
2
|
-
import { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRootConfig, AnyRouter, AnySubscriptionProcedure, ProcedureArgs, ProcedureRouterRecord } from '@trpc/core';
|
|
1
|
+
import type { Resolver } from '@trpc/client';
|
|
2
|
+
import type { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRootConfig, AnyRouter, AnySubscriptionProcedure, ProcedureArgs, ProcedureRouterRecord } from '@trpc/core';
|
|
3
3
|
export type DecorateProcedureServer<TConfig extends AnyRootConfig, TProcedure extends AnyProcedure> = TProcedure extends AnyQueryProcedure ? {
|
|
4
4
|
query: Resolver<TConfig, TProcedure>;
|
|
5
5
|
revalidate: (input?: ProcedureArgs<TProcedure['_def']>[0]) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/app-dir/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":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,CAAC,CAAC,GACnD,KAAK;CACV,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction":
|
|
2
|
+
"bundleSize": 22154,
|
|
3
|
+
"bundleOrigSize": 32285,
|
|
4
|
+
"bundleReduction": 31.38,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/withTRPC.tsx",
|
|
8
8
|
"size": 8009,
|
|
9
|
-
"origSize":
|
|
9
|
+
"origSize": 9372,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"withTRPC"
|
|
12
12
|
],
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"/src/createTRPCNext.tsx",
|
|
16
16
|
"/src/index.ts"
|
|
17
17
|
],
|
|
18
|
-
"percent": 36.
|
|
19
|
-
"reduction":
|
|
18
|
+
"percent": 36.15,
|
|
19
|
+
"reduction": 14.54
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"id": "/src/app-dir/server.ts",
|
|
23
23
|
"size": 3691,
|
|
24
|
-
"origSize":
|
|
24
|
+
"origSize": 4872,
|
|
25
25
|
"renderedExports": [
|
|
26
26
|
"experimental_createTRPCNextAppDirServer",
|
|
27
27
|
"experimental_createServerActionHandler",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
],
|
|
30
30
|
"removedExports": [],
|
|
31
31
|
"dependents": [],
|
|
32
|
-
"percent": 16.
|
|
33
|
-
"reduction":
|
|
32
|
+
"percent": 16.66,
|
|
33
|
+
"reduction": 24.24
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"id": "/src/app-dir/create-action-hook.tsx",
|
|
37
|
-
"size":
|
|
38
|
-
"origSize":
|
|
37
|
+
"size": 3318,
|
|
38
|
+
"origSize": 5723,
|
|
39
39
|
"renderedExports": [
|
|
40
40
|
"experimental_serverActionLink",
|
|
41
41
|
"experimental_createActionHook"
|
|
@@ -44,49 +44,49 @@
|
|
|
44
44
|
"dependents": [
|
|
45
45
|
"/src/app-dir/client.ts"
|
|
46
46
|
],
|
|
47
|
-
"percent": 14.
|
|
48
|
-
"reduction":
|
|
47
|
+
"percent": 14.98,
|
|
48
|
+
"reduction": 42.02
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"id": "/src/app-dir/links/nextCache.ts",
|
|
52
52
|
"size": 2486,
|
|
53
|
-
"origSize":
|
|
53
|
+
"origSize": 2767,
|
|
54
54
|
"renderedExports": [
|
|
55
55
|
"experimental_nextCacheLink"
|
|
56
56
|
],
|
|
57
57
|
"removedExports": [],
|
|
58
58
|
"dependents": [],
|
|
59
|
-
"percent": 11.
|
|
60
|
-
"reduction":
|
|
59
|
+
"percent": 11.22,
|
|
60
|
+
"reduction": 10.16
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"id": "/src/app-dir/client.ts",
|
|
64
64
|
"size": 1260,
|
|
65
|
-
"origSize":
|
|
65
|
+
"origSize": 1834,
|
|
66
66
|
"renderedExports": [
|
|
67
67
|
"experimental_createTRPCNextAppDirClient"
|
|
68
68
|
],
|
|
69
69
|
"removedExports": [],
|
|
70
70
|
"dependents": [],
|
|
71
71
|
"percent": 5.69,
|
|
72
|
-
"reduction":
|
|
72
|
+
"reduction": 31.3
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"id": "/src/app-dir/links/nextHttp.ts",
|
|
76
76
|
"size": 1192,
|
|
77
|
-
"origSize":
|
|
77
|
+
"origSize": 1750,
|
|
78
78
|
"renderedExports": [
|
|
79
79
|
"experimental_nextHttpLink"
|
|
80
80
|
],
|
|
81
81
|
"removedExports": [],
|
|
82
82
|
"dependents": [],
|
|
83
83
|
"percent": 5.38,
|
|
84
|
-
"reduction":
|
|
84
|
+
"reduction": 31.89
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"id": "/src/createTRPCNext.tsx",
|
|
88
88
|
"size": 1045,
|
|
89
|
-
"origSize":
|
|
89
|
+
"origSize": 2631,
|
|
90
90
|
"renderedExports": [
|
|
91
91
|
"createTRPCNext"
|
|
92
92
|
],
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"/src/index.ts"
|
|
96
96
|
],
|
|
97
97
|
"percent": 4.72,
|
|
98
|
-
"reduction":
|
|
98
|
+
"reduction": 60.28
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
"id": "/src/app-dir/formDataToObject.ts",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
{
|
|
115
115
|
"id": "/src/app-dir/shared.ts",
|
|
116
116
|
"size": 335,
|
|
117
|
-
"origSize":
|
|
117
|
+
"origSize": 2448,
|
|
118
118
|
"renderedExports": [
|
|
119
119
|
"generateCacheTag",
|
|
120
120
|
"isFormData"
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"/src/app-dir/links/nextHttp.ts"
|
|
130
130
|
],
|
|
131
131
|
"percent": 1.51,
|
|
132
|
-
"reduction": 86.
|
|
132
|
+
"reduction": 86.32
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"id": "/src/index.ts",
|
package/dist/createTRPCNext.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AnyRouter, ProtectedIntersection } from '@trpc/core';
|
|
2
|
-
import { CreateReactUtils, DecoratedProcedureRecord, TRPCUseQueries, TRPCUseSuspenseQueries } from '@trpc/react-query/shared';
|
|
3
|
-
import { NextPageContext } from 'next/types';
|
|
4
|
-
import {
|
|
1
|
+
import type { AnyRouter, ProtectedIntersection } from '@trpc/core';
|
|
2
|
+
import type { CreateReactUtils, DecoratedProcedureRecord, TRPCUseQueries, TRPCUseSuspenseQueries } from '@trpc/react-query/shared';
|
|
3
|
+
import type { NextPageContext } from 'next/types';
|
|
4
|
+
import type { WithTRPCNoSSROptions, WithTRPCSSROptions } from './withTRPC';
|
|
5
|
+
import { withTRPC } from './withTRPC';
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -9,11 +10,11 @@ export interface CreateTRPCNextBase<TRouter extends AnyRouter, TSSRContext exten
|
|
|
9
10
|
/**
|
|
10
11
|
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
11
12
|
*
|
|
12
|
-
* @
|
|
13
|
+
* @link https://trpc.io/docs/v11/client/react/useUtils
|
|
13
14
|
*/
|
|
14
15
|
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
15
16
|
/**
|
|
16
|
-
* @
|
|
17
|
+
* @link https://trpc.io/docs/v11/client/react/useUtils
|
|
17
18
|
*/
|
|
18
19
|
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
19
20
|
withTRPC: ReturnType<typeof withTRPC<TRouter, TSSRContext>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCNext.d.ts","sourceRoot":"","sources":["../src/createTRPCNext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"createTRPCNext.d.ts","sourceRoot":"","sources":["../src/createTRPCNext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,kBAAkB,CACjC,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe;IAEnC;;;;OAIG;IACH,UAAU,IAAI,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACrD;;OAEG;IACH,QAAQ,IAAI,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnD,QAAQ,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5D,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACpC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,CACxB,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,EACnC,MAAM,IACJ,qBAAqB,CACvB,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,EACxC,wBAAwB,CACtB,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAC1B,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,MAAM,CACP,CACF,CAAC;AAEF,wBAAgB,cAAc,CAC5B,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,GAAG,eAAe,EACrD,MAAM,GAAG,IAAI,EAEb,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAChE,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CA+B9C"}
|
package/dist/withTRPC.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CreateTRPCClientOptions } from '@trpc/client';
|
|
1
|
+
import type { CreateTRPCClientOptions } from '@trpc/client';
|
|
2
2
|
import type { AnyRouter } from '@trpc/core';
|
|
3
3
|
import type { ResponseMeta } from '@trpc/core/http';
|
|
4
|
-
import { TRPCClientError } from '@trpc/react-query';
|
|
5
|
-
import { CreateTRPCReactOptions, CreateTRPCReactQueryClientConfig } from '@trpc/react-query/shared';
|
|
6
|
-
import { NextComponentType, NextPageContext } from 'next/dist/shared/lib/utils';
|
|
4
|
+
import type { TRPCClientError } from '@trpc/react-query';
|
|
5
|
+
import type { CreateTRPCReactOptions, CreateTRPCReactQueryClientConfig } from '@trpc/react-query/shared';
|
|
6
|
+
import type { NextComponentType, NextPageContext } from 'next/dist/shared/lib/utils';
|
|
7
7
|
export type WithTRPCConfig<TRouter extends AnyRouter> = CreateTRPCClientOptions<TRouter> & CreateTRPCReactQueryClientConfig & {
|
|
8
8
|
abortOnUnmount?: boolean;
|
|
9
9
|
};
|
package/dist/withTRPC.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTRPC.d.ts","sourceRoot":"","sources":["../src/withTRPC.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withTRPC.d.ts","sourceRoot":"","sources":["../src/withTRPC.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAqB,MAAM,cAAc,CAAC;AAE/E,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EACV,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAGV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AA0BpC,MAAM,MAAM,cAAc,CAAC,OAAO,SAAS,SAAS,IAClD,uBAAuB,CAAC,OAAO,CAAC,GAC9B,gCAAgC,GAAG;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEN,UAAU,eAAe,CAAC,OAAO,SAAS,SAAS,CACjD,SAAQ,sBAAsB,CAAC,OAAO,CAAC;IACvC,MAAM,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,CAAC,EAAE,eAAe,CAAA;KAAE,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,eAAe,CAAA;KAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACpB,GAAG,EAAE,eAAe,CAAC;QACrB,YAAY,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;KAC1C,KAAK,YAAY,CAAC;CACpB;AACD,MAAM,WAAW,oBAAoB,CAAC,OAAO,SAAS,SAAS,CAC7D,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,GAAG,CAAC,EAAE,KAAK,CAAC;CACb;AAED,wBAAgB,QAAQ,CACtB,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,GAAG,eAAe,EACrD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,eAU9C,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAG,iBAAiB,CAqMxE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/next",
|
|
3
|
-
"version": "11.0.0-alpha-tmp.
|
|
3
|
+
"version": "11.0.0-alpha-tmp-v11-trpc-sveltekit.191+6bef08e75",
|
|
4
4
|
"description": "The tRPC Next.js library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dev": "pnpm build --watch",
|
|
28
28
|
"codegen-entrypoints": "tsx entrypoints.script.ts",
|
|
29
29
|
"ts-watch": "tsc --project tsconfig.watch.json --watch",
|
|
30
|
-
"lint": "eslint --cache --ext \".js,.ts,.tsx\" --ignore-path ../../.gitignore
|
|
30
|
+
"lint": "eslint --cache --ext \".js,.ts,.tsx\" --ignore-path ../../.gitignore src"
|
|
31
31
|
},
|
|
32
32
|
"exports": {
|
|
33
33
|
"./package.json": "./package.json",
|
|
@@ -66,20 +66,20 @@
|
|
|
66
66
|
"!**/*.test.*"
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@trpc/core": "11.0.0-alpha-tmp.
|
|
69
|
+
"@trpc/core": "11.0.0-alpha-tmp-v11-trpc-sveltekit.191+6bef08e75"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@tanstack/react-query": "^5.0.0",
|
|
73
|
-
"@trpc/client": "11.0.0-alpha-tmp.
|
|
74
|
-
"@trpc/react-query": "11.0.0-alpha-tmp.
|
|
73
|
+
"@trpc/client": "11.0.0-alpha-tmp-v11-trpc-sveltekit.191+6bef08e75",
|
|
74
|
+
"@trpc/react-query": "11.0.0-alpha-tmp-v11-trpc-sveltekit.191+6bef08e75",
|
|
75
75
|
"next": "*",
|
|
76
76
|
"react": ">=16.8.0",
|
|
77
77
|
"react-dom": ">=16.8.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@tanstack/react-query": "^5.0.0",
|
|
81
|
-
"@trpc/client": "11.0.0-alpha-tmp.
|
|
82
|
-
"@trpc/react-query": "11.0.0-alpha-tmp.
|
|
81
|
+
"@trpc/client": "11.0.0-alpha-tmp-v11-trpc-sveltekit.191+6bef08e75",
|
|
82
|
+
"@trpc/react-query": "11.0.0-alpha-tmp-v11-trpc-sveltekit.191+6bef08e75",
|
|
83
83
|
"@types/express": "^4.17.17",
|
|
84
84
|
"@types/node": "^20.10.0",
|
|
85
85
|
"@types/react": "^18.2.33",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"funding": [
|
|
100
100
|
"https://trpc.io/sponsor"
|
|
101
101
|
],
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "6bef08e7503e2c8bb65cfe6064197f60045a1ffe"
|
|
103
103
|
}
|
package/src/app-dir/client.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { CreateTRPCClient } from '@trpc/client';
|
|
1
2
|
import {
|
|
2
3
|
clientCallTypeToProcedureType,
|
|
3
|
-
CreateTRPCClient,
|
|
4
4
|
createTRPCUntypedClient,
|
|
5
5
|
} from '@trpc/client';
|
|
6
|
-
import { AnyRouter
|
|
7
|
-
import {
|
|
6
|
+
import type { AnyRouter } from '@trpc/core';
|
|
7
|
+
import { createRecursiveProxy } from '@trpc/core';
|
|
8
|
+
import type { CreateTRPCNextAppRouterOptions } from './shared';
|
|
8
9
|
|
|
9
10
|
export {
|
|
10
11
|
// ts-prune-ignore-next
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
CreateTRPCClientOptions,
|
|
3
|
-
createTRPCUntypedClient,
|
|
4
|
-
TRPCClientError,
|
|
5
3
|
TRPCLink,
|
|
6
4
|
TRPCRequestOptions,
|
|
7
5
|
} from '@trpc/client';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { createTRPCUntypedClient, TRPCClientError } from '@trpc/client';
|
|
7
|
+
import { transformResult } from '@trpc/core';
|
|
8
|
+
import type {
|
|
10
9
|
AnyRouter,
|
|
11
10
|
MaybePromise,
|
|
12
11
|
ProcedureOptions,
|
|
@@ -14,8 +13,9 @@ import {
|
|
|
14
13
|
} from '@trpc/core';
|
|
15
14
|
import { observable } from '@trpc/core/observable';
|
|
16
15
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
|
-
import { TRPCActionHandler } from './server';
|
|
18
|
-
import { ActionHandlerDef
|
|
16
|
+
import type { TRPCActionHandler } from './server';
|
|
17
|
+
import type { ActionHandlerDef } from './shared';
|
|
18
|
+
import { isFormData } from './shared';
|
|
19
19
|
|
|
20
20
|
type MutationArgs<TDef extends ActionHandlerDef> = TDef['input'] extends void
|
|
21
21
|
? [input?: undefined | void, opts?: ProcedureOptions]
|
|
@@ -81,7 +81,7 @@ export function experimental_serverActionLink<
|
|
|
81
81
|
: runtime.transformer.serialize(op.input),
|
|
82
82
|
)
|
|
83
83
|
.then((data) => {
|
|
84
|
-
const transformed = transformResult(data, runtime);
|
|
84
|
+
const transformed = transformResult(data, runtime.transformer);
|
|
85
85
|
|
|
86
86
|
if (!transformed.ok) {
|
|
87
87
|
observer.error(TRPCClientError.from(transformed.error, {}));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// import "server-only";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { TRPCLink } from '@trpc/client';
|
|
4
|
+
import { TRPCClientError } from '@trpc/client';
|
|
5
|
+
import type { AnyRouter, inferRouterContext } from '@trpc/core';
|
|
6
|
+
import { callProcedure } from '@trpc/core';
|
|
5
7
|
import { observable } from '@trpc/core/observable';
|
|
6
8
|
import { unstable_cache } from 'next/cache';
|
|
7
9
|
import { generateCacheTag } from '../shared';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
httpBatchLink,
|
|
1
|
+
import type {
|
|
3
2
|
HTTPBatchLinkOptions,
|
|
4
|
-
httpLink,
|
|
5
3
|
HTTPLinkOptions,
|
|
6
4
|
TRPCLink,
|
|
7
5
|
} from '@trpc/client';
|
|
8
|
-
import {
|
|
6
|
+
import { httpBatchLink, httpLink } from '@trpc/client';
|
|
7
|
+
import type { AnyRouter } from '@trpc/core';
|
|
9
8
|
import { generateCacheTag } from '../shared';
|
|
10
9
|
|
|
11
10
|
interface NextLinkBaseOptions {
|
package/src/app-dir/server.ts
CHANGED
|
@@ -3,32 +3,33 @@ import {
|
|
|
3
3
|
clientCallTypeToProcedureType,
|
|
4
4
|
createTRPCUntypedClient,
|
|
5
5
|
} from '@trpc/client';
|
|
6
|
-
import {
|
|
6
|
+
import type {
|
|
7
7
|
AnyProcedure,
|
|
8
8
|
AnyRootConfig,
|
|
9
9
|
AnyRouter,
|
|
10
10
|
CombinedDataTransformer,
|
|
11
|
-
createRecursiveProxy,
|
|
12
|
-
getErrorShape,
|
|
13
|
-
getTRPCErrorFromUnknown,
|
|
14
11
|
inferProcedureInput,
|
|
15
12
|
MaybePromise,
|
|
16
13
|
Simplify,
|
|
14
|
+
} from '@trpc/core';
|
|
15
|
+
import {
|
|
16
|
+
createRecursiveProxy,
|
|
17
|
+
getErrorShape,
|
|
18
|
+
getTRPCErrorFromUnknown,
|
|
17
19
|
transformTRPCResponse,
|
|
18
20
|
TRPCError,
|
|
19
21
|
} from '@trpc/core';
|
|
20
|
-
import { TRPCResponse } from '@trpc/core/rpc';
|
|
22
|
+
import type { TRPCResponse } from '@trpc/core/rpc';
|
|
21
23
|
import { revalidateTag } from 'next/cache';
|
|
22
24
|
import { cache } from 'react';
|
|
23
25
|
import { formDataToObject } from './formDataToObject';
|
|
24
|
-
import {
|
|
26
|
+
import type {
|
|
25
27
|
ActionHandlerDef,
|
|
26
28
|
CreateTRPCNextAppRouterOptions,
|
|
27
|
-
generateCacheTag,
|
|
28
29
|
inferActionDef,
|
|
29
|
-
isFormData,
|
|
30
30
|
} from './shared';
|
|
31
|
-
import {
|
|
31
|
+
import { generateCacheTag, isFormData } from './shared';
|
|
32
|
+
import type { NextAppDirDecoratedProcedureRecord } from './types';
|
|
32
33
|
|
|
33
34
|
// ts-prune-ignore-next
|
|
34
35
|
export function experimental_createTRPCNextAppDirServer<
|
package/src/app-dir/shared.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
CreateTRPCClientOptions,
|
|
3
3
|
Resolver,
|
|
4
4
|
TRPCUntypedClient,
|
|
5
5
|
} from '@trpc/client';
|
|
6
|
-
import {
|
|
6
|
+
import type {
|
|
7
7
|
AnyProcedure,
|
|
8
8
|
AnyQueryProcedure,
|
|
9
9
|
AnyRootConfig,
|
|
10
10
|
AnyRouter,
|
|
11
|
-
createRecursiveProxy,
|
|
12
11
|
Filter,
|
|
13
12
|
inferHandlerInput,
|
|
14
13
|
ProtectedIntersection,
|
|
15
14
|
} from '@trpc/core';
|
|
15
|
+
import { createRecursiveProxy } from '@trpc/core';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
package/src/app-dir/types.ts
CHANGED
package/src/createTRPCNext.tsx
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
/* istanbul ignore file -- @preserve */
|
|
2
2
|
// We're testing this through E2E-testing
|
|
3
|
-
import { AnyRouter,
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
createReactQueryUtils,
|
|
3
|
+
import type { AnyRouter, ProtectedIntersection } from '@trpc/core';
|
|
4
|
+
import { createFlatProxy } from '@trpc/core';
|
|
5
|
+
import type {
|
|
7
6
|
CreateReactUtils,
|
|
8
|
-
createRootHooks,
|
|
9
7
|
DecoratedProcedureRecord,
|
|
10
8
|
TRPCUseQueries,
|
|
11
9
|
TRPCUseSuspenseQueries,
|
|
12
10
|
} from '@trpc/react-query/shared';
|
|
13
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
createReactDecoration,
|
|
13
|
+
createReactQueryUtils,
|
|
14
|
+
createRootHooks,
|
|
15
|
+
} from '@trpc/react-query/shared';
|
|
16
|
+
import type { NextPageContext } from 'next/types';
|
|
14
17
|
import { useMemo } from 'react';
|
|
15
|
-
import {
|
|
18
|
+
import type { WithTRPCNoSSROptions, WithTRPCSSROptions } from './withTRPC';
|
|
19
|
+
import { withTRPC } from './withTRPC';
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* @internal
|
|
@@ -24,11 +28,11 @@ export interface CreateTRPCNextBase<
|
|
|
24
28
|
/**
|
|
25
29
|
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
26
30
|
*
|
|
27
|
-
* @
|
|
31
|
+
* @link https://trpc.io/docs/v11/client/react/useUtils
|
|
28
32
|
*/
|
|
29
33
|
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
30
34
|
/**
|
|
31
|
-
* @
|
|
35
|
+
* @link https://trpc.io/docs/v11/client/react/useUtils
|
|
32
36
|
*/
|
|
33
37
|
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
34
38
|
withTRPC: ReturnType<typeof withTRPC<TRouter, TSSRContext>>;
|
package/src/withTRPC.tsx
CHANGED
|
@@ -2,35 +2,29 @@
|
|
|
2
2
|
* Heavily based on urql's ssr
|
|
3
3
|
* https://github.com/FormidableLabs/urql/blob/main/packages/next-urql/src/with-urql-client.ts
|
|
4
4
|
*/
|
|
5
|
+
import type { DehydratedState, QueryClient } from '@tanstack/react-query';
|
|
5
6
|
import {
|
|
6
7
|
dehydrate,
|
|
7
|
-
DehydratedState,
|
|
8
8
|
HydrationBoundary,
|
|
9
|
-
QueryClient,
|
|
10
9
|
QueryClientProvider,
|
|
11
10
|
} from '@tanstack/react-query';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
TRPCUntypedClient,
|
|
16
|
-
} from '@trpc/client';
|
|
17
|
-
import type { AnyRouter } from '@trpc/core';
|
|
18
|
-
import { Dict, Maybe } from '@trpc/core';
|
|
11
|
+
import type { CreateTRPCClientOptions, TRPCUntypedClient } from '@trpc/client';
|
|
12
|
+
import { createTRPCUntypedClient } from '@trpc/client';
|
|
13
|
+
import type { AnyRouter, Dict, Maybe } from '@trpc/core';
|
|
19
14
|
import type { ResponseMeta } from '@trpc/core/http';
|
|
20
|
-
import { TRPCClientError, TRPCClientErrorLike } from '@trpc/react-query';
|
|
21
|
-
import {
|
|
22
|
-
createRootHooks,
|
|
15
|
+
import type { TRPCClientError, TRPCClientErrorLike } from '@trpc/react-query';
|
|
16
|
+
import type {
|
|
23
17
|
CreateTRPCReactOptions,
|
|
24
18
|
CreateTRPCReactQueryClientConfig,
|
|
25
|
-
getQueryClient,
|
|
26
19
|
} from '@trpc/react-query/shared';
|
|
27
|
-
import {
|
|
20
|
+
import { createRootHooks, getQueryClient } from '@trpc/react-query/shared';
|
|
21
|
+
import type {
|
|
28
22
|
AppContextType,
|
|
29
23
|
AppPropsType,
|
|
30
24
|
NextComponentType,
|
|
31
25
|
NextPageContext,
|
|
32
26
|
} from 'next/dist/shared/lib/utils';
|
|
33
|
-
import { NextRouter } from 'next/router';
|
|
27
|
+
import type { NextRouter } from 'next/router';
|
|
34
28
|
import React, { createElement, useState } from 'react';
|
|
35
29
|
|
|
36
30
|
function transformQueryOrMutationCacheErrors<
|