rename react to solid
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"description": "SolidJS tRPC",
|
"description": "SolidJS tRPC",
|
||||||
"author": "OrJDev",
|
"author": "OrJDev",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "0.0.1-rc.1",
|
"version": "0.0.2-rc.1",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public",
|
"access": "public",
|
||||||
"tag": "next"
|
"tag": "next"
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ import {
|
|||||||
import { inferObservableValue } from "@trpc/server/observable";
|
import { inferObservableValue } from "@trpc/server/observable";
|
||||||
import { createFlatProxy } from "@trpc/server/shared";
|
import { createFlatProxy } from "@trpc/server/shared";
|
||||||
import {
|
import {
|
||||||
CreateReactUtilsProxy,
|
CreateSolidUtilsProxy,
|
||||||
createReactProxyDecoration,
|
createSolidProxyDecoration,
|
||||||
createReactQueryUtilsProxy,
|
createSolidQueryUtilsProxy,
|
||||||
} from "./shared";
|
} from "./shared";
|
||||||
import {
|
import {
|
||||||
CreateClient,
|
CreateClient,
|
||||||
CreateReactQueryHooks,
|
CreateSolidQueryHooks,
|
||||||
TRPCProvider,
|
TRPCProvider,
|
||||||
UseDehydratedState,
|
UseDehydratedState,
|
||||||
UseTRPCInfiniteQueryOptions,
|
UseTRPCInfiniteQueryOptions,
|
||||||
@@ -118,7 +118,7 @@ export type DecoratedProcedureRecord<
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type CreateTRPCSolid<TRouter extends AnyRouter, TSSRContext> = {
|
export type CreateTRPCSolid<TRouter extends AnyRouter, TSSRContext> = {
|
||||||
useContext(): CreateReactUtilsProxy<TRouter, TSSRContext>;
|
useContext(): CreateSolidUtilsProxy<TRouter, TSSRContext>;
|
||||||
Provider: TRPCProvider<TRouter, TSSRContext>;
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
||||||
createClient: CreateClient<TRouter>;
|
createClient: CreateClient<TRouter>;
|
||||||
useDehydratedState: UseDehydratedState<TRouter>;
|
useDehydratedState: UseDehydratedState<TRouter>;
|
||||||
@@ -130,7 +130,7 @@ export type CreateTRPCSolid<TRouter extends AnyRouter, TSSRContext> = {
|
|||||||
export function createHooksInternalProxy<
|
export function createHooksInternalProxy<
|
||||||
TRouter extends AnyRouter,
|
TRouter extends AnyRouter,
|
||||||
TSSRContext = unknown
|
TSSRContext = unknown
|
||||||
>(trpc: CreateReactQueryHooks<TRouter, TSSRContext>) {
|
>(trpc: CreateSolidQueryHooks<TRouter, TSSRContext>) {
|
||||||
type CreateHooksInternalProxy = CreateTRPCSolid<TRouter, TSSRContext>;
|
type CreateHooksInternalProxy = CreateTRPCSolid<TRouter, TSSRContext>;
|
||||||
|
|
||||||
return createFlatProxy<CreateHooksInternalProxy>((key) => {
|
return createFlatProxy<CreateHooksInternalProxy>((key) => {
|
||||||
@@ -138,7 +138,7 @@ export function createHooksInternalProxy<
|
|||||||
return () => {
|
return () => {
|
||||||
const context = trpc.useContext();
|
const context = trpc.useContext();
|
||||||
// create a stable reference of the utils context
|
// 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 (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 * from "@trpc/client";
|
||||||
|
|
||||||
export { createTRPCSolid, type CreateTRPCSolid } from "./createTRPCSolid";
|
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 { CreateTRPCSolid, createHooksInternalProxy } from "./createTRPCSolid";
|
||||||
import { CreateTRPCSolidOptions } from "./shared";
|
import { CreateTRPCSolidOptions } from "./shared";
|
||||||
import {
|
import {
|
||||||
CreateReactQueryHooks,
|
CreateSolidQueryHooks,
|
||||||
createHooksInternal,
|
createHooksInternal,
|
||||||
} from "./shared/hooks/createHooksInternal";
|
} from "./shared/hooks/createHooksInternal";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use `createTRPCSolid` instead
|
* @deprecated use `createTRPCSolid` instead
|
||||||
*/
|
*/
|
||||||
export function createReactQueryHooks<
|
export function createSolidQueryHooks<
|
||||||
TRouter extends AnyRouter,
|
TRouter extends AnyRouter,
|
||||||
TSSRContext = unknown
|
TSSRContext = unknown
|
||||||
>(
|
>(
|
||||||
opts?: CreateTRPCSolidOptions<TRouter>
|
opts?: CreateTRPCSolidOptions<TRouter>
|
||||||
): CreateReactQueryHooks<TRouter, TSSRContext> & {
|
): CreateSolidQueryHooks<TRouter, TSSRContext> & {
|
||||||
proxy: CreateTRPCSolid<TRouter, TSSRContext>;
|
proxy: CreateTRPCSolid<TRouter, TSSRContext>;
|
||||||
} {
|
} {
|
||||||
const trpc = createHooksInternal<TRouter, TSSRContext>(opts);
|
const trpc = createHooksInternal<TRouter, TSSRContext>(opts);
|
||||||
|
|||||||
@@ -644,10 +644,10 @@ type fooType<TRouter extends AnyRouter, TSSRContext = unknown> = GnClass<
|
|||||||
>["fn"];
|
>["fn"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Infer the type of a `createReactQueryHooks` function
|
* Infer the type of a `createSolidQueryHooks` function
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export type CreateReactQueryHooks<
|
export type CreateSolidQueryHooks<
|
||||||
TRouter extends AnyRouter,
|
TRouter extends AnyRouter,
|
||||||
TSSRContext = unknown
|
TSSRContext = unknown
|
||||||
> = returnTypeInferer<fooType<TRouter, TSSRContext>>;
|
> = returnTypeInferer<fooType<TRouter, TSSRContext>>;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { AnyRouter } from "@trpc/server";
|
import { AnyRouter } from "@trpc/server";
|
||||||
import { createRecursiveProxy } from "@trpc/server/shared";
|
import { createRecursiveProxy } from "@trpc/server/shared";
|
||||||
import { getQueryKey } from "../../internals/getQueryKey";
|
import { getQueryKey } from "../../internals/getQueryKey";
|
||||||
import { CreateReactQueryHooks } from "../hooks/createHooksInternal";
|
import { type CreateSolidQueryHooks } from "../hooks/createHooksInternal";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create proxy for decorating procedures
|
* Create proxy for decorating procedures
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export function createReactProxyDecoration<
|
export function createSolidProxyDecoration<
|
||||||
TRouter extends AnyRouter,
|
TRouter extends AnyRouter,
|
||||||
TSSRContext = unknown
|
TSSRContext = unknown
|
||||||
>(name: string, hooks: CreateReactQueryHooks<TRouter, TSSRContext>) {
|
>(name: string, hooks: CreateSolidQueryHooks<TRouter, TSSRContext>) {
|
||||||
return createRecursiveProxy((opts) => {
|
return createRecursiveProxy((opts) => {
|
||||||
const args = opts.args;
|
const args = opts.args;
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ export type DecoratedProcedureUtilsRecord<TRouter extends AnyRouter> = {
|
|||||||
|
|
||||||
type AnyDecoratedProcedure = DecorateProcedure<any, any>;
|
type AnyDecoratedProcedure = DecorateProcedure<any, any>;
|
||||||
|
|
||||||
export type CreateReactUtilsProxy<
|
export type CreateSolidUtilsProxy<
|
||||||
TRouter extends AnyRouter,
|
TRouter extends AnyRouter,
|
||||||
TSSRContext
|
TSSRContext
|
||||||
> = DecoratedProcedureUtilsRecord<TRouter> &
|
> = DecoratedProcedureUtilsRecord<TRouter> &
|
||||||
@@ -198,16 +198,16 @@ export type CreateReactUtilsProxy<
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export function createReactQueryUtilsProxy<
|
export function createSolidQueryUtilsProxy<
|
||||||
TRouter extends AnyRouter,
|
TRouter extends AnyRouter,
|
||||||
TSSRContext
|
TSSRContext
|
||||||
>(context: TRPCContextState<AnyRouter, unknown>) {
|
>(context: TRPCContextState<AnyRouter, unknown>) {
|
||||||
type CreateReactUtilsProxyReturnType = CreateReactUtilsProxy<
|
type CreateSolidUtilsProxyReturnType = CreateSolidUtilsProxy<
|
||||||
TRouter,
|
TRouter,
|
||||||
TSSRContext
|
TSSRContext
|
||||||
>;
|
>;
|
||||||
|
|
||||||
return createFlatProxy<CreateReactUtilsProxyReturnType>((key) => {
|
return createFlatProxy<CreateSolidUtilsProxyReturnType>((key) => {
|
||||||
const contextName = key as typeof contextProps[number];
|
const contextName = key as typeof contextProps[number];
|
||||||
if (contextProps.includes(contextName)) {
|
if (contextProps.includes(contextName)) {
|
||||||
return context[contextName];
|
return context[contextName];
|
||||||
|
|||||||
Reference in New Issue
Block a user