@trpc/next 11.0.0-alpha-tmp-nosideeffects.257 → 11.0.0-alpha-tmp-02-08-tmp.274

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 CHANGED
@@ -55,7 +55,7 @@ export const trpc = createTRPCNext<AppRouter>({
55
55
  ],
56
56
  };
57
57
  },
58
- ssr: true,
58
+ ssr: false,
59
59
  });
60
60
  ```
61
61
 
@@ -1,7 +1,7 @@
1
1
  import type { CreateTRPCClientOptions, TRPCLink } from '@trpc/client';
2
2
  import { TRPCClientError } from '@trpc/client';
3
3
  import type { TransformerOptions } from '@trpc/client/unstable-internals';
4
- import type { InferrableClientTypes, inferRootTypes, MaybePromise, ProcedureOptions, Simplify, TypeError } from '@trpc/server/unstable-core-do-not-import';
4
+ import type { inferClientTypes, InferrableClientTypes, MaybePromise, ProcedureOptions, Simplify, TypeError } from '@trpc/server/unstable-core-do-not-import';
5
5
  import type { TRPCActionHandler } from './server';
6
6
  import type { ActionHandlerDef } from './shared';
7
7
  type MutationArgs<TDef extends ActionHandlerDef> = TDef['input'] extends void ? [input?: undefined | void, opts?: ProcedureOptions] : [input: FormData | TDef['input'], opts?: ProcedureOptions];
@@ -32,7 +32,7 @@ interface UseTRPCActionLoadingResult<TDef extends ActionHandlerDef> extends UseT
32
32
  export type UseTRPCActionResult<TDef extends ActionHandlerDef> = UseTRPCActionErrorResult<TDef> | UseTRPCActionIdleResult<TDef> | UseTRPCActionLoadingResult<TDef> | UseTRPCActionSuccessResult<TDef>;
33
33
  export declare function experimental_serverActionLink<TInferrable extends InferrableClientTypes>(...args: InferrableClientTypes extends TInferrable ? [
34
34
  TypeError<'Generic parameter missing in `experimental_createActionHook<HERE>()` or experimental_serverActionLink<HERE>()'>
35
- ] : inferRootTypes<TInferrable>['transformer'] extends true ? [
35
+ ] : inferClientTypes<TInferrable>['transformer'] extends true ? [
36
36
  opts: TransformerOptions<{
37
37
  transformer: true;
38
38
  }>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AI,CAAC,GAChC,0BAA0B,CAAC,IAAI,CAAC,CAAC;AAOrC,wBAAgB,6BAA6B,CAC3C,WAAW,SAAS,qBAAqB,EAEzC,GAAG,IAAI,EAAE,qBAAqB,SAAS,WAAW,GAC9C;IACE,SAAS,CAAC,+GAA+G,CAAC;CAC3H,GACD,gBAAgB,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,SAAS,IAAI,GACzD;IACE,IAAI,EAAE,kBAAkB,CAAC;QACvB,WAAW,EAAE,IAAI,CAAC;KACnB,CAAC;CACH,GACD;IACE,IAAI,CAAC,EAAE,kBAAkB,CAAC;QACxB,WAAW,EAAE,KAAK,CAAC;KACpB,CAAC;CACH,GACJ,QAAQ,CAAC,WAAW,CAAC,CA+BvB;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;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,SAAS,qBAAqB,EAEzC,IAAI,EAAE,qBAAqB,SAAS,WAAW,GAC3C,SAAS,CAAC,sEAAsE,CAAC,GACjF,uBAAuB,CAAC,WAAW,CAAC,oKA+FzC"}
@@ -1,12 +1,12 @@
1
1
  import type { TRPCLink } from '@trpc/client';
2
2
  import { type TransformerOptions } from '@trpc/client/unstable-internals';
3
- import type { AnyRouter, inferRootTypes, inferRouterContext } from '@trpc/server/unstable-core-do-not-import';
3
+ import type { AnyRouter, inferClientTypes, inferRouterContext } from '@trpc/server/unstable-core-do-not-import';
4
4
  type NextCacheLinkOptions<TRouter extends AnyRouter> = {
5
5
  router: TRouter;
6
6
  createContext: () => Promise<inferRouterContext<TRouter>>;
7
7
  /** how many seconds the cache should hold before revalidating */
8
8
  revalidate?: number | false;
9
- } & TransformerOptions<inferRootTypes<TRouter>>;
9
+ } & TransformerOptions<inferClientTypes<TRouter>>;
10
10
  export declare function experimental_nextCacheLink<TRouter extends AnyRouter>(opts: NextCacheLinkOptions<TRouter>): TRPCLink<TRouter>;
11
11
  export {};
12
12
  //# sourceMappingURL=nextCache.d.ts.map
@@ -1 +1 @@
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,EAEL,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,kBAAkB,EACnB,MAAM,0CAA0C,CAAC;AAKlD,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,GAAG,kBAAkB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAGhD,wBAAgB,0BAA0B,CAAC,OAAO,SAAS,SAAS,EAClE,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAClC,QAAQ,CAAC,OAAO,CAAC,CA0DnB"}
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,EAEL,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,0CAA0C,CAAC;AAKlD,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,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAGlD,wBAAgB,0BAA0B,CAAC,OAAO,SAAS,SAAS,EAClE,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAClC,QAAQ,CAAC,OAAO,CAAC,CA0DnB"}
@@ -1,4 +1,4 @@
1
- import type { AnyProcedure, AnyRootTypes, AnyRouter, inferProcedureInput, inferRootTypes, MaybePromise, RootConfig, Simplify, TRPCResponse } from '@trpc/server/unstable-core-do-not-import';
1
+ import type { AnyProcedure, AnyRootTypes, AnyRouter, inferClientTypes, inferProcedureInput, MaybePromise, RootConfig, Simplify, TRPCResponse } from '@trpc/server/unstable-core-do-not-import';
2
2
  import type { ActionHandlerDef, CreateTRPCNextAppRouterOptions, inferActionDef } from './shared';
3
3
  import type { NextAppDirDecorateRouterRecord } from './types';
4
4
  export declare function experimental_createTRPCNextAppDirServer<TRouter extends AnyRouter>(opts: CreateTRPCNextAppRouterOptions<TRouter>): NextAppDirDecorateRouterRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>;
@@ -18,7 +18,7 @@ export declare function experimental_createServerActionHandler<TInstance extends
18
18
  }): <TProc extends AnyProcedure>(proc: TProc) => TRPCActionHandler<{
19
19
  input: inferProcedureInput<TProc>;
20
20
  output: TProc["_def"]["_output_out"];
21
- errorShape: inferRootTypes<TInstance>["errorShape"];
21
+ errorShape: inferClientTypes<TInstance>["errorShape"];
22
22
  }>;
23
23
  export declare function experimental_revalidateEndpoint(req: Request): Promise<Response>;
24
24
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACb,MAAM,0CAA0C,CAAC;AAWlD,OAAO,KAAK,EACV,gBAAgB,EAChB,8BAA8B,EAC9B,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAG9D,wBAAgB,uCAAuC,CACrD,OAAO,SAAS,SAAS,EACzB,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC,mGA2B9C;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,UAAU,CAAC,YAAY,CAAC,CAAC;CACnC,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;;;;GAoEF;AAGD,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,OAAO,qBAiBjE"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app-dir/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACb,MAAM,0CAA0C,CAAC;AAWlD,OAAO,KAAK,EACV,gBAAgB,EAChB,8BAA8B,EAC9B,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAG9D,wBAAgB,uCAAuC,CACrD,OAAO,SAAS,SAAS,EACzB,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC,mGA2B9C;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,UAAU,CAAC,YAAY,CAAC,CAAC;CACnC,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;;;;GAoEF;AAGD,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,OAAO,qBAiBjE"}
@@ -1,10 +1,15 @@
1
1
  import type { CreateTRPCClientOptions, Resolver, TRPCUntypedClient } from '@trpc/client';
2
- import type { AnyClientRootTypes, AnyProcedure, AnyQueryProcedure, AnyRootTypes, AnyRouter, inferProcedureInput, ProtectedIntersection, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
2
+ import type { AnyClientTypes, AnyProcedure, AnyQueryProcedure, AnyRootTypes, AnyRouter, inferProcedureInput, inferTransformedProcedureOutput, ProtectedIntersection, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
3
3
  /**
4
4
  * @internal
5
5
  */
6
6
  export type UseProcedureRecord<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = {
7
- [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? UseProcedureRecord<TRoot, $Value> : $Value extends AnyQueryProcedure ? Resolver<TRoot, $Value> : never : never;
7
+ [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? UseProcedureRecord<TRoot, $Value> : $Value extends AnyQueryProcedure ? Resolver<{
8
+ input: inferProcedureInput<$Value>;
9
+ output: inferTransformedProcedureOutput<TRoot, $Value>;
10
+ errorShape: TRoot['errorShape'];
11
+ transformer: TRoot['transformer'];
12
+ }> : never : never;
8
13
  };
9
14
  export declare function createUseProxy<TRouter extends AnyRouter>(client: TRPCUntypedClient<TRouter>): UseProcedureRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>;
10
15
  type NextAppRouterUse<TRouter extends AnyRouter> = {
@@ -39,7 +44,7 @@ export interface ActionHandlerDef {
39
44
  /**
40
45
  * @internal
41
46
  */
42
- export type inferActionDef<TRoot extends AnyClientRootTypes, TProc extends AnyProcedure> = {
47
+ export type inferActionDef<TRoot extends AnyClientTypes, TProc extends AnyProcedure> = {
43
48
  input: inferProcedureInput<TProc>;
44
49
  output: TProc['_def']['_output_out'];
45
50
  errorShape: TRoot['errorShape'];
@@ -1 +1 @@
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,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACb,MAAM,0CAA0C,CAAC;AAGlD;;GAEG;AACH,MAAM,MAAM,k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nyRootTypes, AnySubscriptionProcedure, inferProcedureInput, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
3
- export type DecorateProcedureServer<TRoot extends AnyRootTypes, TProcedure extends AnyProcedure> = TProcedure extends AnyQueryProcedure ? {
4
- query: Resolver<TRoot, TProcedure>;
5
- revalidate: (input?: inferProcedureInput<TProcedure>) => Promise<{
2
+ import type { AnyProcedure, AnyRootTypes, inferProcedureInput, inferTransformedProcedureOutput, ProcedureType, RouterRecord } from '@trpc/server/unstable-core-do-not-import';
3
+ type ResolverDef = {
4
+ input: any;
5
+ output: any;
6
+ transformer: boolean;
7
+ errorShape: any;
8
+ };
9
+ export type DecorateProcedureServer<TType extends ProcedureType, TDef extends ResolverDef> = TType extends 'query' ? {
10
+ query: Resolver<TDef>;
11
+ revalidate: (input?: TDef['input']) => Promise<{
6
12
  revalidated: false;
7
13
  error: string;
8
14
  } | {
9
15
  revalidated: true;
10
16
  }>;
11
- } : TProcedure extends AnyMutationProcedure ? {
12
- mutate: Resolver<TRoot, TProcedure>;
13
- } : TProcedure extends AnySubscriptionProcedure ? {
14
- subscribe: Resolver<TRoot, TProcedure>;
17
+ } : TType extends 'mutation' ? {
18
+ mutate: Resolver<TDef>;
19
+ } : TType extends 'subscription' ? {
20
+ subscribe: Resolver<TDef>;
15
21
  } : never;
16
22
  export type NextAppDirDecorateRouterRecord<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = {
17
- [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? NextAppDirDecorateRouterRecord<TRoot, $Value> : $Value extends AnyProcedure ? DecorateProcedureServer<TRoot, $Value> : never : never;
23
+ [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? NextAppDirDecorateRouterRecord<TRoot, $Value> : $Value extends AnyProcedure ? DecorateProcedureServer<$Value['_def']['type'], {
24
+ input: inferProcedureInput<$Value>;
25
+ output: inferTransformedProcedureOutput<TRoot, $Value>;
26
+ errorShape: TRoot['errorShape'];
27
+ transformer: TRoot['transformer'];
28
+ }> : never : never;
18
29
  };
30
+ export {};
19
31
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/app-dir/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACb,MAAM,0CAA0C,CAAC;AAElD,MAAM,MAAM,uBAAuB,CACjC,KAAK,SAAS,YAAY,EAC1B,UAAU,SAAS,YAAY,IAC7B,UAAU,SAAS,iBAAiB,GACpC;IACE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACnC,UAAU,EAAE,CACV,KAAK,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,KACpC,OAAO,CACV;QAAE,WAAW,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,WAAW,EAAE,IAAI,CAAA;KAAE,CAC9D,CAAC;CACH,GACD,UAAU,SAAS,oBAAoB,GACvC;IACE,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CACrC,GACD,UAAU,SAAS,wBAAwB,GAC3C;IACE,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CACxC,GACD,KAAK,CAAC;AAEV,MAAM,MAAM,8BAA8B,CACxC,KAAK,SAAS,YAAY,EAC1B,OAAO,SAAS,YAAY,IAC1B;KACD,IAAI,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,MAAM,MAAM,GACvD,MAAM,SAAS,YAAY,GACzB,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,GAC7C,MAAM,SAAS,YAAY,GAC3B,uBA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EAAE,MAAM,CAAC,GAC7C,MAAM,SAAS,YAAY,GAC3B,uBAAuB,CACrB,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EACtB;QACE,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,EAAE,+BAA+B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACvD,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QAChC,WAAW,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;KACnC,CACF,GACD,KAAK,GACP,KAAK;CACV,CAAC"}
@@ -0,0 +1,158 @@
1
+ {
2
+ "bundleSize": 22012,
3
+ "bundleOrigSize": 36230,
4
+ "bundleReduction": 39.24,
5
+ "modules": [
6
+ {
7
+ "id": "/src/ssrPrepass.ts",
8
+ "size": 5062,
9
+ "origSize": 5853,
10
+ "renderedExports": [
11
+ "ssrPrepass"
12
+ ],
13
+ "removedExports": [],
14
+ "dependents": [],
15
+ "percent": 23,
16
+ "reduction": 13.51
17
+ },
18
+ {
19
+ "id": "/src/app-dir/server.ts",
20
+ "size": 3822,
21
+ "origSize": 4925,
22
+ "renderedExports": [
23
+ "experimental_createTRPCNextAppDirServer",
24
+ "experimental_createServerActionHandler",
25
+ "experimental_revalidateEndpoint"
26
+ ],
27
+ "removedExports": [],
28
+ "dependents": [],
29
+ "percent": 17.36,
30
+ "reduction": 22.4
31
+ },
32
+ {
33
+ "id": "/src/app-dir/create-action-hook.tsx",
34
+ "size": 3436,
35
+ "origSize": 6779,
36
+ "renderedExports": [
37
+ "experimental_serverActionLink",
38
+ "experimental_createActionHook"
39
+ ],
40
+ "removedExports": [],
41
+ "dependents": [
42
+ "/src/app-dir/client.ts"
43
+ ],
44
+ "percent": 15.61,
45
+ "reduction": 49.31
46
+ },
47
+ {
48
+ "id": "/src/app-dir/links/nextCache.ts",
49
+ "size": 2571,
50
+ "origSize": 3044,
51
+ "renderedExports": [
52
+ "experimental_nextCacheLink"
53
+ ],
54
+ "removedExports": [],
55
+ "dependents": [],
56
+ "percent": 11.68,
57
+ "reduction": 15.54
58
+ },
59
+ {
60
+ "id": "/src/withTRPC.tsx",
61
+ "size": 2424,
62
+ "origSize": 5148,
63
+ "renderedExports": [
64
+ "withTRPC"
65
+ ],
66
+ "removedExports": [],
67
+ "dependents": [
68
+ "/src/index.ts",
69
+ "/src/createTRPCNext.tsx"
70
+ ],
71
+ "percent": 11.01,
72
+ "reduction": 52.91
73
+ },
74
+ {
75
+ "id": "/src/app-dir/client.ts",
76
+ "size": 1279,
77
+ "origSize": 1894,
78
+ "renderedExports": [
79
+ "experimental_createTRPCNextAppDirClient"
80
+ ],
81
+ "removedExports": [],
82
+ "dependents": [],
83
+ "percent": 5.81,
84
+ "reduction": 32.47
85
+ },
86
+ {
87
+ "id": "/src/app-dir/links/nextHttp.ts",
88
+ "size": 1192,
89
+ "origSize": 1973,
90
+ "renderedExports": [
91
+ "experimental_nextHttpLink"
92
+ ],
93
+ "removedExports": [],
94
+ "dependents": [],
95
+ "percent": 5.42,
96
+ "reduction": 39.58
97
+ },
98
+ {
99
+ "id": "/src/createTRPCNext.tsx",
100
+ "size": 1073,
101
+ "origSize": 2651,
102
+ "renderedExports": [
103
+ "createTRPCNext"
104
+ ],
105
+ "removedExports": [],
106
+ "dependents": [
107
+ "/src/index.ts"
108
+ ],
109
+ "percent": 4.87,
110
+ "reduction": 59.52
111
+ },
112
+ {
113
+ "id": "/src/app-dir/formDataToObject.ts",
114
+ "size": 818,
115
+ "origSize": 826,
116
+ "renderedExports": [
117
+ "formDataToObject"
118
+ ],
119
+ "removedExports": [],
120
+ "dependents": [
121
+ "/src/app-dir/server.ts"
122
+ ],
123
+ "percent": 3.72,
124
+ "reduction": 0.97
125
+ },
126
+ {
127
+ "id": "/src/app-dir/shared.ts",
128
+ "size": 335,
129
+ "origSize": 3075,
130
+ "renderedExports": [
131
+ "generateCacheTag",
132
+ "isFormData"
133
+ ],
134
+ "removedExports": [
135
+ "createUseProxy"
136
+ ],
137
+ "dependents": [
138
+ "/src/app-dir/server.ts",
139
+ "/src/app-dir/links/nextCache.ts",
140
+ "/src/app-dir/links/nextHttp.ts",
141
+ "/src/app-dir/create-action-hook.tsx"
142
+ ],
143
+ "percent": 1.52,
144
+ "reduction": 89.11
145
+ },
146
+ {
147
+ "id": "/src/index.ts",
148
+ "size": 0,
149
+ "origSize": 62,
150
+ "renderedExports": [],
151
+ "removedExports": [],
152
+ "dependents": [],
153
+ "percent": 0,
154
+ "reduction": 100
155
+ }
156
+ ],
157
+ "moduleCount": 11
158
+ }
@@ -24,6 +24,6 @@ export interface CreateTRPCNextBase<TRouter extends AnyRouter, TSSRContext exten
24
24
  /**
25
25
  * @internal
26
26
  */
27
- export type CreateTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext, TFlags> = ProtectedIntersection<CreateTRPCNextBase<TRouter, TSSRContext>, DecorateRouterRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record'], TFlags>>;
28
- export declare function createTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext = NextPageContext, TFlags = null>(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>): CreateTRPCNext<TRouter, TSSRContext, TFlags>;
27
+ export type CreateTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext> = ProtectedIntersection<CreateTRPCNextBase<TRouter, TSSRContext>, DecorateRouterRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>>;
28
+ export declare function createTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext = NextPageContext>(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>): CreateTRPCNext<TRouter, TSSRContext>;
29
29
  //# sourceMappingURL=createTRPCNext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTRPCNext.d.ts","sourceRoot":"","sources":["../src/createTRPCNext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,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c,CAC5B,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,GAAG,eAAe,EAErD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAChE,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CA+BtC"}
@@ -0,0 +1,3 @@
1
+ import type { TRPCPrepassHelper } from './withTRPC';
2
+ export declare const ssrPrepass: TRPCPrepassHelper;
3
+ //# sourceMappingURL=ssrPrepass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssrPrepass.d.ts","sourceRoot":"","sources":["../src/ssrPrepass.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AAyBtE,eAAO,MAAM,UAAU,EAAE,iBA0IxB,CAAC"}
@@ -0,0 +1,139 @@
1
+ 'use strict';
2
+
3
+ var reactQuery = require('@tanstack/react-query');
4
+ var client = require('@trpc/client');
5
+ var unstableInternals = require('@trpc/client/unstable-internals');
6
+ var shared = require('@trpc/react-query/shared');
7
+ var React = require('react');
8
+
9
+ function transformQueryOrMutationCacheErrors(result) {
10
+ const error = result.state.error;
11
+ if (error instanceof Error && error.name === 'TRPCClientError') {
12
+ const newError = {
13
+ message: error.message,
14
+ data: error.data,
15
+ shape: error.shape
16
+ };
17
+ return {
18
+ ...result,
19
+ state: {
20
+ ...result.state,
21
+ error: newError
22
+ }
23
+ };
24
+ }
25
+ return result;
26
+ }
27
+ const ssrPrepass = (opts)=>{
28
+ const { parent , WithTRPC , AppOrPage } = opts;
29
+ const transformer = unstableInternals.getTransformer(parent.transformer);
30
+ WithTRPC.getInitialProps = async (appOrPageCtx)=>{
31
+ const shouldSsr = async ()=>{
32
+ if (typeof window !== 'undefined') {
33
+ return false;
34
+ }
35
+ if (typeof parent.ssr === 'function') {
36
+ try {
37
+ return await parent.ssr({
38
+ ctx: appOrPageCtx.ctx
39
+ });
40
+ } catch (e) {
41
+ return false;
42
+ }
43
+ }
44
+ return parent.ssr;
45
+ };
46
+ const ssrEnabled = await shouldSsr();
47
+ const AppTree = appOrPageCtx.AppTree;
48
+ // Determine if we are wrapping an App component or a Page component.
49
+ const isApp = !!appOrPageCtx.Component;
50
+ const ctx = isApp ? appOrPageCtx.ctx : appOrPageCtx;
51
+ // Run the wrapped component's getInitialProps function.
52
+ let pageProps = {};
53
+ if (AppOrPage.getInitialProps) {
54
+ const originalProps = await AppOrPage.getInitialProps(appOrPageCtx);
55
+ const originalPageProps = isApp ? originalProps.pageProps ?? {} : originalProps;
56
+ pageProps = {
57
+ ...originalPageProps,
58
+ ...pageProps
59
+ };
60
+ }
61
+ const getAppTreeProps = (props)=>isApp ? {
62
+ pageProps: props
63
+ } : props;
64
+ if (typeof window !== 'undefined' || !ssrEnabled) {
65
+ return getAppTreeProps(pageProps);
66
+ }
67
+ const config = parent.config({
68
+ ctx
69
+ });
70
+ const trpcClient = client.createTRPCUntypedClient(config);
71
+ const queryClient = shared.getQueryClient(config);
72
+ const trpcProp = {
73
+ config,
74
+ trpcClient,
75
+ queryClient,
76
+ ssrState: 'prepass',
77
+ ssrContext: ctx
78
+ };
79
+ const prepassProps = {
80
+ pageProps,
81
+ trpc: trpcProp
82
+ };
83
+ const reactDomServer = await import('react-dom/server');
84
+ // Run the prepass step on AppTree. This will run all trpc queries on the server.
85
+ // multiple prepass ensures that we can do batching on the server
86
+ while(true){
87
+ // render full tree
88
+ reactDomServer.renderToString(React.createElement(AppTree, prepassProps));
89
+ if (!queryClient.isFetching()) {
90
+ break;
91
+ }
92
+ // wait until the query cache has settled it's promises
93
+ await new Promise((resolve)=>{
94
+ const unsub = queryClient.getQueryCache().subscribe((event)=>{
95
+ if (event?.query.getObserversCount() === 0) {
96
+ resolve();
97
+ unsub();
98
+ }
99
+ });
100
+ });
101
+ }
102
+ const dehydratedCache = reactQuery.dehydrate(queryClient, {
103
+ shouldDehydrateQuery (query) {
104
+ // filter out queries that are marked as trpc: { ssr: false } or are not enabled, but make sure errors are dehydrated
105
+ const isExcludedFromSSr = query.state.fetchStatus === 'idle' && query.state.status === 'pending';
106
+ return !isExcludedFromSSr;
107
+ }
108
+ });
109
+ // since error instances can't be serialized, let's make them into `TRPCClientErrorLike`-objects
110
+ const dehydratedCacheWithErrors = {
111
+ ...dehydratedCache,
112
+ queries: dehydratedCache.queries.map(transformQueryOrMutationCacheErrors),
113
+ mutations: dehydratedCache.mutations.map(transformQueryOrMutationCacheErrors)
114
+ };
115
+ // dehydrate query client's state and add it to the props
116
+ pageProps['trpcState'] = transformer.input.serialize(dehydratedCacheWithErrors);
117
+ const appTreeProps = getAppTreeProps(pageProps);
118
+ const meta = parent.responseMeta?.({
119
+ ctx,
120
+ clientErrors: [
121
+ ...dehydratedCache.queries,
122
+ ...dehydratedCache.mutations
123
+ ].map((v)=>v.state.error).flatMap((err)=>err instanceof Error && err.name === 'TRPCClientError' ? [
124
+ err
125
+ ] : [])
126
+ }) ?? {};
127
+ for (const [key, value] of Object.entries(meta.headers ?? {})){
128
+ if (typeof value === 'string') {
129
+ ctx.res?.setHeader(key, value);
130
+ }
131
+ }
132
+ if (meta.status && ctx.res) {
133
+ ctx.res.statusCode = meta.status;
134
+ }
135
+ return appTreeProps;
136
+ };
137
+ };
138
+
139
+ exports.ssrPrepass = ssrPrepass;
@@ -0,0 +1,137 @@
1
+ import { dehydrate } from '@tanstack/react-query';
2
+ import { createTRPCUntypedClient } from '@trpc/client';
3
+ import { getTransformer } from '@trpc/client/unstable-internals';
4
+ import { getQueryClient } from '@trpc/react-query/shared';
5
+ import { createElement } from 'react';
6
+
7
+ function transformQueryOrMutationCacheErrors(result) {
8
+ const error = result.state.error;
9
+ if (error instanceof Error && error.name === 'TRPCClientError') {
10
+ const newError = {
11
+ message: error.message,
12
+ data: error.data,
13
+ shape: error.shape
14
+ };
15
+ return {
16
+ ...result,
17
+ state: {
18
+ ...result.state,
19
+ error: newError
20
+ }
21
+ };
22
+ }
23
+ return result;
24
+ }
25
+ const ssrPrepass = (opts)=>{
26
+ const { parent , WithTRPC , AppOrPage } = opts;
27
+ const transformer = getTransformer(parent.transformer);
28
+ WithTRPC.getInitialProps = async (appOrPageCtx)=>{
29
+ const shouldSsr = async ()=>{
30
+ if (typeof window !== 'undefined') {
31
+ return false;
32
+ }
33
+ if (typeof parent.ssr === 'function') {
34
+ try {
35
+ return await parent.ssr({
36
+ ctx: appOrPageCtx.ctx
37
+ });
38
+ } catch (e) {
39
+ return false;
40
+ }
41
+ }
42
+ return parent.ssr;
43
+ };
44
+ const ssrEnabled = await shouldSsr();
45
+ const AppTree = appOrPageCtx.AppTree;
46
+ // Determine if we are wrapping an App component or a Page component.
47
+ const isApp = !!appOrPageCtx.Component;
48
+ const ctx = isApp ? appOrPageCtx.ctx : appOrPageCtx;
49
+ // Run the wrapped component's getInitialProps function.
50
+ let pageProps = {};
51
+ if (AppOrPage.getInitialProps) {
52
+ const originalProps = await AppOrPage.getInitialProps(appOrPageCtx);
53
+ const originalPageProps = isApp ? originalProps.pageProps ?? {} : originalProps;
54
+ pageProps = {
55
+ ...originalPageProps,
56
+ ...pageProps
57
+ };
58
+ }
59
+ const getAppTreeProps = (props)=>isApp ? {
60
+ pageProps: props
61
+ } : props;
62
+ if (typeof window !== 'undefined' || !ssrEnabled) {
63
+ return getAppTreeProps(pageProps);
64
+ }
65
+ const config = parent.config({
66
+ ctx
67
+ });
68
+ const trpcClient = createTRPCUntypedClient(config);
69
+ const queryClient = getQueryClient(config);
70
+ const trpcProp = {
71
+ config,
72
+ trpcClient,
73
+ queryClient,
74
+ ssrState: 'prepass',
75
+ ssrContext: ctx
76
+ };
77
+ const prepassProps = {
78
+ pageProps,
79
+ trpc: trpcProp
80
+ };
81
+ const reactDomServer = await import('react-dom/server');
82
+ // Run the prepass step on AppTree. This will run all trpc queries on the server.
83
+ // multiple prepass ensures that we can do batching on the server
84
+ while(true){
85
+ // render full tree
86
+ reactDomServer.renderToString(createElement(AppTree, prepassProps));
87
+ if (!queryClient.isFetching()) {
88
+ break;
89
+ }
90
+ // wait until the query cache has settled it's promises
91
+ await new Promise((resolve)=>{
92
+ const unsub = queryClient.getQueryCache().subscribe((event)=>{
93
+ if (event?.query.getObserversCount() === 0) {
94
+ resolve();
95
+ unsub();
96
+ }
97
+ });
98
+ });
99
+ }
100
+ const dehydratedCache = dehydrate(queryClient, {
101
+ shouldDehydrateQuery (query) {
102
+ // filter out queries that are marked as trpc: { ssr: false } or are not enabled, but make sure errors are dehydrated
103
+ const isExcludedFromSSr = query.state.fetchStatus === 'idle' && query.state.status === 'pending';
104
+ return !isExcludedFromSSr;
105
+ }
106
+ });
107
+ // since error instances can't be serialized, let's make them into `TRPCClientErrorLike`-objects
108
+ const dehydratedCacheWithErrors = {
109
+ ...dehydratedCache,
110
+ queries: dehydratedCache.queries.map(transformQueryOrMutationCacheErrors),
111
+ mutations: dehydratedCache.mutations.map(transformQueryOrMutationCacheErrors)
112
+ };
113
+ // dehydrate query client's state and add it to the props
114
+ pageProps['trpcState'] = transformer.input.serialize(dehydratedCacheWithErrors);
115
+ const appTreeProps = getAppTreeProps(pageProps);
116
+ const meta = parent.responseMeta?.({
117
+ ctx,
118
+ clientErrors: [
119
+ ...dehydratedCache.queries,
120
+ ...dehydratedCache.mutations
121
+ ].map((v)=>v.state.error).flatMap((err)=>err instanceof Error && err.name === 'TRPCClientError' ? [
122
+ err
123
+ ] : [])
124
+ }) ?? {};
125
+ for (const [key, value] of Object.entries(meta.headers ?? {})){
126
+ if (typeof value === 'string') {
127
+ ctx.res?.setHeader(key, value);
128
+ }
129
+ }
130
+ if (meta.status && ctx.res) {
131
+ ctx.res.statusCode = meta.status;
132
+ }
133
+ return appTreeProps;
134
+ };
135
+ };
136
+
137
+ export { ssrPrepass };