rename react to solid
This commit is contained in:
+1
-1
@@ -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"
|
||||
|
||||
@@ -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<TRouter extends AnyRouter, TSSRContext> = {
|
||||
useContext(): CreateReactUtilsProxy<TRouter, TSSRContext>;
|
||||
useContext(): CreateSolidUtilsProxy<TRouter, TSSRContext>;
|
||||
Provider: TRPCProvider<TRouter, TSSRContext>;
|
||||
createClient: CreateClient<TRouter>;
|
||||
useDehydratedState: UseDehydratedState<TRouter>;
|
||||
@@ -130,7 +130,7 @@ export type CreateTRPCSolid<TRouter extends AnyRouter, TSSRContext> = {
|
||||
export function createHooksInternalProxy<
|
||||
TRouter extends AnyRouter,
|
||||
TSSRContext = unknown
|
||||
>(trpc: CreateReactQueryHooks<TRouter, TSSRContext>) {
|
||||
>(trpc: CreateSolidQueryHooks<TRouter, TSSRContext>) {
|
||||
type CreateHooksInternalProxy = CreateTRPCSolid<TRouter, TSSRContext>;
|
||||
|
||||
return createFlatProxy<CreateHooksInternalProxy>((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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export * from "@trpc/client";
|
||||
|
||||
export { createTRPCSolid, type CreateTRPCSolid } from "./createTRPCSolid";
|
||||
export { createReactQueryHooks } from "./interop";
|
||||
export { createSolidQueryHooks } from "./interop";
|
||||
|
||||
+3
-3
@@ -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<TRouter>
|
||||
): CreateReactQueryHooks<TRouter, TSSRContext> & {
|
||||
): CreateSolidQueryHooks<TRouter, TSSRContext> & {
|
||||
proxy: CreateTRPCSolid<TRouter, TSSRContext>;
|
||||
} {
|
||||
const trpc = createHooksInternal<TRouter, TSSRContext>(opts);
|
||||
|
||||
@@ -644,10 +644,10 @@ type fooType<TRouter extends AnyRouter, TSSRContext = unknown> = 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<fooType<TRouter, TSSRContext>>;
|
||||
|
||||
@@ -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<TRouter, TSSRContext>) {
|
||||
>(name: string, hooks: CreateSolidQueryHooks<TRouter, TSSRContext>) {
|
||||
return createRecursiveProxy((opts) => {
|
||||
const args = opts.args;
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ export type DecoratedProcedureUtilsRecord<TRouter extends AnyRouter> = {
|
||||
|
||||
type AnyDecoratedProcedure = DecorateProcedure<any, any>;
|
||||
|
||||
export type CreateReactUtilsProxy<
|
||||
export type CreateSolidUtilsProxy<
|
||||
TRouter extends AnyRouter,
|
||||
TSSRContext
|
||||
> = DecoratedProcedureUtilsRecord<TRouter> &
|
||||
@@ -198,16 +198,16 @@ export type CreateReactUtilsProxy<
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function createReactQueryUtilsProxy<
|
||||
export function createSolidQueryUtilsProxy<
|
||||
TRouter extends AnyRouter,
|
||||
TSSRContext
|
||||
>(context: TRPCContextState<AnyRouter, unknown>) {
|
||||
type CreateReactUtilsProxyReturnType = CreateReactUtilsProxy<
|
||||
type CreateSolidUtilsProxyReturnType = CreateSolidUtilsProxy<
|
||||
TRouter,
|
||||
TSSRContext
|
||||
>;
|
||||
|
||||
return createFlatProxy<CreateReactUtilsProxyReturnType>((key) => {
|
||||
return createFlatProxy<CreateSolidUtilsProxyReturnType>((key) => {
|
||||
const contextName = key as typeof contextProps[number];
|
||||
if (contextProps.includes(contextName)) {
|
||||
return context[contextName];
|
||||
|
||||
Reference in New Issue
Block a user