From cfd0a6c7a0a3e4874dbc3241d7ca1a112266e088 Mon Sep 17 00:00:00 2001 From: OrJDev Date: Tue, 1 Nov 2022 10:11:13 +0200 Subject: [PATCH] rename react to solid --- package.json | 2 +- src/createTRPCSolid.ts | 16 ++++++++-------- src/index.tsx | 2 +- src/interop.ts | 6 +++--- src/shared/hooks/createHooksInternal.tsx | 4 ++-- src/shared/proxy/decorationProxy.ts | 6 +++--- src/shared/proxy/utilsProxy.ts | 8 ++++---- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index f7a49c8..bd36a9c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "SolidJS tRPC", "author": "OrJDev", "license": "MIT", - "version": "0.0.1-rc.1", + "version": "0.0.2-rc.1", "publishConfig": { "access": "public", "tag": "next" diff --git a/src/createTRPCSolid.ts b/src/createTRPCSolid.ts index c0c9a73..81c11a5 100644 --- a/src/createTRPCSolid.ts +++ b/src/createTRPCSolid.ts @@ -12,13 +12,13 @@ import { import { inferObservableValue } from "@trpc/server/observable"; import { createFlatProxy } from "@trpc/server/shared"; import { - CreateReactUtilsProxy, - createReactProxyDecoration, - createReactQueryUtilsProxy, + CreateSolidUtilsProxy, + createSolidProxyDecoration, + createSolidQueryUtilsProxy, } from "./shared"; import { CreateClient, - CreateReactQueryHooks, + CreateSolidQueryHooks, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, @@ -118,7 +118,7 @@ export type DecoratedProcedureRecord< }; export type CreateTRPCSolid = { - useContext(): CreateReactUtilsProxy; + useContext(): CreateSolidUtilsProxy; Provider: TRPCProvider; createClient: CreateClient; useDehydratedState: UseDehydratedState; @@ -130,7 +130,7 @@ export type CreateTRPCSolid = { export function createHooksInternalProxy< TRouter extends AnyRouter, TSSRContext = unknown ->(trpc: CreateReactQueryHooks) { +>(trpc: CreateSolidQueryHooks) { type CreateHooksInternalProxy = CreateTRPCSolid; return createFlatProxy((key) => { @@ -138,7 +138,7 @@ export function createHooksInternalProxy< return () => { const context = trpc.useContext(); // create a stable reference of the utils context - return (createReactQueryUtilsProxy as any)(context as any); + return (createSolidQueryUtilsProxy as any)(context as any); }; } @@ -146,7 +146,7 @@ export function createHooksInternalProxy< return (trpc as any)[key]; } - return createReactProxyDecoration(key as string, trpc); + return createSolidProxyDecoration(key as string, trpc); }); } diff --git a/src/index.tsx b/src/index.tsx index 4c0199d..92e8f59 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,4 +1,4 @@ export * from "@trpc/client"; export { createTRPCSolid, type CreateTRPCSolid } from "./createTRPCSolid"; -export { createReactQueryHooks } from "./interop"; +export { createSolidQueryHooks } from "./interop"; diff --git a/src/interop.ts b/src/interop.ts index dcc1391..50981e0 100644 --- a/src/interop.ts +++ b/src/interop.ts @@ -3,19 +3,19 @@ import { AnyRouter } from "@trpc/server"; import { CreateTRPCSolid, createHooksInternalProxy } from "./createTRPCSolid"; import { CreateTRPCSolidOptions } from "./shared"; import { - CreateReactQueryHooks, + CreateSolidQueryHooks, createHooksInternal, } from "./shared/hooks/createHooksInternal"; /** * @deprecated use `createTRPCSolid` instead */ -export function createReactQueryHooks< +export function createSolidQueryHooks< TRouter extends AnyRouter, TSSRContext = unknown >( opts?: CreateTRPCSolidOptions -): CreateReactQueryHooks & { +): CreateSolidQueryHooks & { proxy: CreateTRPCSolid; } { const trpc = createHooksInternal(opts); diff --git a/src/shared/hooks/createHooksInternal.tsx b/src/shared/hooks/createHooksInternal.tsx index 7bc2f34..9081c3e 100644 --- a/src/shared/hooks/createHooksInternal.tsx +++ b/src/shared/hooks/createHooksInternal.tsx @@ -644,10 +644,10 @@ type fooType = GnClass< >["fn"]; /** - * Infer the type of a `createReactQueryHooks` function + * Infer the type of a `createSolidQueryHooks` function * @internal */ -export type CreateReactQueryHooks< +export type CreateSolidQueryHooks< TRouter extends AnyRouter, TSSRContext = unknown > = returnTypeInferer>; diff --git a/src/shared/proxy/decorationProxy.ts b/src/shared/proxy/decorationProxy.ts index f6278d4..057374d 100644 --- a/src/shared/proxy/decorationProxy.ts +++ b/src/shared/proxy/decorationProxy.ts @@ -1,16 +1,16 @@ import { AnyRouter } from "@trpc/server"; import { createRecursiveProxy } from "@trpc/server/shared"; import { getQueryKey } from "../../internals/getQueryKey"; -import { CreateReactQueryHooks } from "../hooks/createHooksInternal"; +import { type CreateSolidQueryHooks } from "../hooks/createHooksInternal"; /** * Create proxy for decorating procedures * @internal */ -export function createReactProxyDecoration< +export function createSolidProxyDecoration< TRouter extends AnyRouter, TSSRContext = unknown ->(name: string, hooks: CreateReactQueryHooks) { +>(name: string, hooks: CreateSolidQueryHooks) { return createRecursiveProxy((opts) => { const args = opts.args; diff --git a/src/shared/proxy/utilsProxy.ts b/src/shared/proxy/utilsProxy.ts index 1f6bece..b75f984 100644 --- a/src/shared/proxy/utilsProxy.ts +++ b/src/shared/proxy/utilsProxy.ts @@ -189,7 +189,7 @@ export type DecoratedProcedureUtilsRecord = { type AnyDecoratedProcedure = DecorateProcedure; -export type CreateReactUtilsProxy< +export type CreateSolidUtilsProxy< TRouter extends AnyRouter, TSSRContext > = DecoratedProcedureUtilsRecord & @@ -198,16 +198,16 @@ export type CreateReactUtilsProxy< /** * @internal */ -export function createReactQueryUtilsProxy< +export function createSolidQueryUtilsProxy< TRouter extends AnyRouter, TSSRContext >(context: TRPCContextState) { - type CreateReactUtilsProxyReturnType = CreateReactUtilsProxy< + type CreateSolidUtilsProxyReturnType = CreateSolidUtilsProxy< TRouter, TSSRContext >; - return createFlatProxy((key) => { + return createFlatProxy((key) => { const contextName = key as typeof contextProps[number]; if (contextProps.includes(contextName)) { return context[contextName];