@trpc/next 10.0.0-proxy-alpha.69 → 10.0.0-proxy-alpha.70

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
@@ -36,11 +36,11 @@ pnpm add @trpc/next@next @trpc/react@next @tanstack/react-query
36
36
  Setup tRPC in `utils/trpc.ts`.
37
37
 
38
38
  ```ts
39
- import { setupTRPC } from '@trpc/next';
39
+ import { createTRPCNext } from '@trpc/next';
40
40
  // Import the router type from your server file
41
41
  import type { AppRouter } from '../pages/api/[trpc].ts';
42
42
 
43
- export const trpc = setupTRPC<AppRouter>({
43
+ export const trpc = createTRPCNext<AppRouter>({
44
44
  config() {
45
45
  return {
46
46
  url: 'http://localhost:3000/api/trpc',
@@ -2,8 +2,8 @@ import { DecoratedProcedureRecord, DecoratedProcedureUtilsRecord } from '@trpc/r
2
2
  import { AnyRouter } from '@trpc/server';
3
3
  import { NextPageContext } from 'next/types';
4
4
  import { WithTRPCNoSSROptions, WithTRPCSSROptions } from './withTRPC';
5
- export declare function setupTRPC<TRouter extends AnyRouter, TSSRContext extends NextPageContext = NextPageContext>(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>): {
5
+ export declare function createTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext = NextPageContext>(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>): {
6
6
  useContext(): DecoratedProcedureUtilsRecord<TRouter>;
7
7
  withTRPC: (AppOrPage: import("next/types").NextComponentType<any, any, any>) => import("next/types").NextComponentType<NextPageContext, {}, {}>;
8
8
  } & DecoratedProcedureRecord<TRouter["_def"]["record"], "">;
9
- //# sourceMappingURL=setupNext.d.ts.map
9
+ //# sourceMappingURL=createTRPCNext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTRPCNext.d.ts","sourceRoot":"","sources":["../src/createTRPCNext.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAI9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAY,MAAM,YAAY,CAAC;AAEhF,wBAAgB,cAAc,CAC5B,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,GAAG,eAAe,EACrD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC;kBAoCjD,8BAA8B,OAAO,CAAC;;4DAGvD"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './withTRPC';
2
- export * from './setupNext';
2
+ export * from './createTRPCNext';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -184,8 +184,8 @@ function withTRPC(opts) {
184
184
  };
185
185
  }
186
186
 
187
- function setupTRPC(opts) {
188
- const hooks = react.createReactQueryHooks();
187
+ function createTRPCNext(opts) {
188
+ const hooks = shared.createHooksInternal();
189
189
  // TODO: maybe set TSSRContext to `never` when using `WithTRPCNoSSROptions`
190
190
  const _withTRPC = withTRPC(opts);
191
191
  const proxy = new Proxy(()=>{
@@ -215,5 +215,5 @@ function setupTRPC(opts) {
215
215
  return proxy;
216
216
  }
217
217
 
218
- exports.setupTRPC = setupTRPC;
218
+ exports.createTRPCNext = createTRPCNext;
219
219
  exports.withTRPC = withTRPC;
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { QueryClient, QueryClientProvider, Hydrate, dehydrate } from '@tanstack/
2
2
  import { createReactQueryHooks, createTRPCClient } from '@trpc/react';
3
3
  import React, { useState, createElement, useMemo } from 'react';
4
4
  import ssrPrepass from 'react-ssr-prepass';
5
- import { createReactQueryUtilsProxy, createReactProxyDecoration } from '@trpc/react/shared';
5
+ import { createHooksInternal, createReactQueryUtilsProxy, createReactProxyDecoration } from '@trpc/react/shared';
6
6
 
7
7
  function extends_() {
8
8
  extends_ = Object.assign || function (target) {
@@ -175,8 +175,8 @@ function withTRPC(opts) {
175
175
  };
176
176
  }
177
177
 
178
- function setupTRPC(opts) {
179
- const hooks = createReactQueryHooks();
178
+ function createTRPCNext(opts) {
179
+ const hooks = createHooksInternal();
180
180
  // TODO: maybe set TSSRContext to `never` when using `WithTRPCNoSSROptions`
181
181
  const _withTRPC = withTRPC(opts);
182
182
  const proxy = new Proxy(()=>{
@@ -206,4 +206,4 @@ function setupTRPC(opts) {
206
206
  return proxy;
207
207
  }
208
208
 
209
- export { setupTRPC, withTRPC };
209
+ export { createTRPCNext, withTRPC };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/next",
3
- "version": "10.0.0-proxy-alpha.69",
3
+ "version": "10.0.0-proxy-alpha.70",
4
4
  "description": "tRPC Next lib",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -36,9 +36,9 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@tanstack/react-query": "^4.0.10",
39
- "@trpc/client": "10.0.0-proxy-alpha.69",
40
- "@trpc/react": "10.0.0-proxy-alpha.69",
41
- "@trpc/server": "10.0.0-proxy-alpha.69",
39
+ "@trpc/client": "10.0.0-proxy-alpha.70",
40
+ "@trpc/react": "10.0.0-proxy-alpha.70",
41
+ "@trpc/server": "10.0.0-proxy-alpha.70",
42
42
  "next": "*",
43
43
  "react": ">=16.8.0",
44
44
  "react-dom": ">=16.8.0"
@@ -48,9 +48,9 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@tanstack/react-query": "^4.0.10",
51
- "@trpc/client": "10.0.0-proxy-alpha.69",
52
- "@trpc/react": "10.0.0-proxy-alpha.69",
53
- "@trpc/server": "10.0.0-proxy-alpha.69",
51
+ "@trpc/client": "10.0.0-proxy-alpha.70",
52
+ "@trpc/react": "10.0.0-proxy-alpha.70",
53
+ "@trpc/server": "10.0.0-proxy-alpha.70",
54
54
  "@types/express": "^4.17.12",
55
55
  "express": "^4.17.1",
56
56
  "next": "^12.1.6",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "15cb2f57ef631ec895ef13821ec8b336c89f3986"
64
+ "gitHead": "f61dfbb2485fe7332ca65ddc1040d8f900534a4f"
65
65
  }
@@ -1,7 +1,7 @@
1
- import { createReactQueryHooks } from '@trpc/react';
2
1
  import {
3
2
  DecoratedProcedureRecord,
4
3
  DecoratedProcedureUtilsRecord,
4
+ createHooksInternal,
5
5
  createReactProxyDecoration,
6
6
  createReactQueryUtilsProxy,
7
7
  } from '@trpc/react/shared';
@@ -10,11 +10,11 @@ import { NextPageContext } from 'next/types';
10
10
  import { useMemo } from 'react';
11
11
  import { WithTRPCNoSSROptions, WithTRPCSSROptions, withTRPC } from './withTRPC';
12
12
 
13
- export function setupTRPC<
13
+ export function createTRPCNext<
14
14
  TRouter extends AnyRouter,
15
15
  TSSRContext extends NextPageContext = NextPageContext,
16
16
  >(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>) {
17
- const hooks = createReactQueryHooks<TRouter, TSSRContext>();
17
+ const hooks = createHooksInternal<TRouter, TSSRContext>();
18
18
 
19
19
  // TODO: maybe set TSSRContext to `never` when using `WithTRPCNoSSROptions`
20
20
  const _withTRPC = withTRPC<TRouter, TSSRContext>(opts);
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './withTRPC';
2
- export * from './setupNext';
2
+ export * from './createTRPCNext';
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupNext.d.ts","sourceRoot":"","sources":["../src/setupNext.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAG9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAY,MAAM,YAAY,CAAC;AAEhF,wBAAgB,SAAS,CACvB,OAAO,SAAS,SAAS,EACzB,WAAW,SAAS,eAAe,GAAG,eAAe,EACrD,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC;kBAoCjD,8BAA8B,OAAO,CAAC;;4DAGvD"}