minor changes
This commit is contained in:
Generated
+6
-8
@@ -1,22 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "solid-trpc",
|
"name": "solid-trpc",
|
||||||
"version": "0.0.5",
|
"version": "0.0.8",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "solid-trpc",
|
"name": "solid-trpc",
|
||||||
"version": "0.0.5",
|
"version": "0.0.8",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.18.13",
|
"@babel/core": "^7.18.13",
|
||||||
"@babel/preset-typescript": "^7.18.6",
|
"@babel/preset-typescript": "^7.18.6",
|
||||||
"@rollup/plugin-babel": "5.3.1",
|
"@rollup/plugin-babel": "5.3.1",
|
||||||
"@rollup/plugin-node-resolve": "13.3.0",
|
"@rollup/plugin-node-resolve": "13.3.0",
|
||||||
"@tanstack/query-core": "^4.6.1",
|
|
||||||
"@tanstack/solid-query": "^4.6.1",
|
"@tanstack/solid-query": "^4.6.1",
|
||||||
"@trpc/client": "^9.27.2",
|
"@trpc/client": "9.27.2",
|
||||||
"@trpc/server": "^9.27.2",
|
"@trpc/server": "9.27.2",
|
||||||
"@types/node": "^18.7.14",
|
"@types/node": "^18.7.14",
|
||||||
"babel-preset-solid": "^1.5.3",
|
"babel-preset-solid": "^1.5.3",
|
||||||
"rollup": "^2.79.0",
|
"rollup": "^2.79.0",
|
||||||
@@ -24,10 +23,9 @@
|
|||||||
"typescript": "^4.8.2"
|
"typescript": "^4.8.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tanstack/query-core": "^4.6.1",
|
|
||||||
"@tanstack/solid-query": "^4.6.1",
|
"@tanstack/solid-query": "^4.6.1",
|
||||||
"@trpc/client": "^9.12.0",
|
"@trpc/client": "9.27.2",
|
||||||
"@trpc/server": "^9.12.0",
|
"@trpc/server": "9.27.2",
|
||||||
"solid-js": "^1.5.3"
|
"solid-js": "^1.5.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+7
-8
@@ -3,7 +3,7 @@
|
|||||||
"description": "SolidJS tRPC",
|
"description": "SolidJS tRPC",
|
||||||
"author": "OrJDev",
|
"author": "OrJDev",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "0.0.5",
|
"version": "0.0.8",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
@@ -29,21 +29,20 @@
|
|||||||
"@babel/preset-typescript": "^7.18.6",
|
"@babel/preset-typescript": "^7.18.6",
|
||||||
"@rollup/plugin-babel": "5.3.1",
|
"@rollup/plugin-babel": "5.3.1",
|
||||||
"@rollup/plugin-node-resolve": "13.3.0",
|
"@rollup/plugin-node-resolve": "13.3.0",
|
||||||
"@tanstack/query-core": "^4.6.1",
|
|
||||||
"@tanstack/solid-query": "^4.6.1",
|
"@tanstack/solid-query": "^4.6.1",
|
||||||
"@trpc/client": "^9.27.2",
|
"@trpc/client": "9.27.2",
|
||||||
"@trpc/server": "^9.27.2",
|
"@trpc/server": "9.27.2",
|
||||||
"@types/node": "^18.7.14",
|
"@types/node": "^18.7.14",
|
||||||
"babel-preset-solid": "^1.5.3",
|
"babel-preset-solid": "^1.5.3",
|
||||||
"rollup": "^2.79.0",
|
"rollup": "^2.79.0",
|
||||||
"solid-js": "^1.5.3",
|
"solid-js": "^1.5.3",
|
||||||
"typescript": "^4.8.2"
|
"typescript": "^4.8.2",
|
||||||
|
"zod": "^3.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tanstack/query-core": "^4.6.1",
|
|
||||||
"@tanstack/solid-query": "^4.6.1",
|
"@tanstack/solid-query": "^4.6.1",
|
||||||
"@trpc/client": "^9.12.0",
|
"@trpc/client": "9.27.2",
|
||||||
"@trpc/server": "^9.12.0",
|
"@trpc/server": "9.27.2",
|
||||||
"solid-js": "^1.5.3"
|
"solid-js": "^1.5.3"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
+34
-19
@@ -4,14 +4,16 @@ import {
|
|||||||
TRPCClientErrorLike,
|
TRPCClientErrorLike,
|
||||||
TRPCRequestOptions,
|
TRPCRequestOptions,
|
||||||
createTRPCClient,
|
createTRPCClient,
|
||||||
|
OperationContext,
|
||||||
} from "@trpc/client";
|
} from "@trpc/client";
|
||||||
import type {
|
import {
|
||||||
AnyRouter,
|
AnyRouter,
|
||||||
ProcedureRecord,
|
ProcedureRecord,
|
||||||
inferHandlerInput,
|
inferHandlerInput,
|
||||||
inferProcedureInput,
|
inferProcedureInput,
|
||||||
inferProcedureOutput,
|
inferProcedureOutput,
|
||||||
inferSubscriptionOutput,
|
inferSubscriptionOutput,
|
||||||
|
router,
|
||||||
} from "@trpc/server";
|
} from "@trpc/server";
|
||||||
import {
|
import {
|
||||||
CreateInfiniteQueryOptions,
|
CreateInfiniteQueryOptions,
|
||||||
@@ -38,27 +40,23 @@ export type OutputWithCursor<TData, TCursor extends any = any> = {
|
|||||||
data: TData;
|
data: TData;
|
||||||
};
|
};
|
||||||
|
|
||||||
type OmitContext<T> = Omit<T, "context"> & {
|
type OmitContext<T> = Omit<T, "context"> & { context?: OperationContext };
|
||||||
context?: TRPCRequestOptions["context"];
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface CreateTRPCQueryOptions<TPath, TInput, TOutput, TData, TError>
|
export interface CreateTRPCQueryOptions<TPath, TInput, TOutput, TData, TError>
|
||||||
extends OmitContext<
|
extends OmitContext<
|
||||||
CreateQueryOptions<TOutput, TError, TData, () => [TPath, TInput]>
|
CreateQueryOptions<TOutput, TError, TData, () => [TPath, TInput]>
|
||||||
>,
|
> {}
|
||||||
TRPCRequestOptions {}
|
|
||||||
|
|
||||||
export interface CreateTRPCInfiniteQueryOptions<TPath, TInput, TOutput, TError>
|
export interface CreateTRPCInfiniteQueryOptions<TPath, TInput, TOutput, TError>
|
||||||
extends OmitContext<
|
extends OmitContext<
|
||||||
CreateInfiniteQueryOptions<
|
CreateInfiniteQueryOptions<
|
||||||
TOutput,
|
TOutput,
|
||||||
TError,
|
TError,
|
||||||
TOutput,
|
TOutput,
|
||||||
TOutput,
|
TOutput,
|
||||||
() => [TPath, TInput]
|
() => [TPath, TInput]
|
||||||
>
|
>
|
||||||
>,
|
> {}
|
||||||
TRPCRequestOptions {}
|
|
||||||
|
|
||||||
export interface CreateTRPCMutationOptions<
|
export interface CreateTRPCMutationOptions<
|
||||||
TInput,
|
TInput,
|
||||||
@@ -134,9 +132,10 @@ export function createSolidQueryHooks<TRouter extends AnyRouter>() {
|
|||||||
) {
|
) {
|
||||||
ctx.prefetchQuery(pathAndInput(), opts as any);
|
ctx.prefetchQuery(pathAndInput(), opts as any);
|
||||||
}
|
}
|
||||||
|
return __createQuery(
|
||||||
return __createQuery(pathAndInput, () =>
|
pathAndInput,
|
||||||
(ctx.client as any).query(...getClientArgs(pathAndInput(), opts))
|
() => (ctx.client as any).query(...getClientArgs(pathAndInput(), opts)),
|
||||||
|
opts as any
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,3 +250,19 @@ export function createSolidQueryHooks<TRouter extends AnyRouter>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export { default as TRPCProvider } from "./provider";
|
export { default as TRPCProvider } from "./provider";
|
||||||
|
|
||||||
|
// // type testing
|
||||||
|
// const r = router().query("hello", {
|
||||||
|
// input: z.object({
|
||||||
|
// num: z.number(),
|
||||||
|
// }),
|
||||||
|
// resolve: ({ input }) => {
|
||||||
|
// return input.num;
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
|
||||||
|
// export type TRouter = typeof r;
|
||||||
|
|
||||||
|
// const res = createSolidQueryHooks<TRouter>()
|
||||||
|
|
||||||
|
// res.createQuery(()=> ['hello', {num: 1}])
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ import {
|
|||||||
RefetchQueryFilters,
|
RefetchQueryFilters,
|
||||||
SetDataOptions,
|
SetDataOptions,
|
||||||
} from "@tanstack/solid-query";
|
} from "@tanstack/solid-query";
|
||||||
import { Updater } from "@tanstack/query-core";
|
import { Updater } from "@tanstack/solid-query";
|
||||||
|
|
||||||
interface TRPCFetchQueryOptions<TInput, TError, TOutput>
|
interface TRPCFetchQueryOptions<TInput, TError, TOutput>
|
||||||
extends FetchQueryOptions<TInput, TError, TOutput>,
|
extends FetchQueryOptions<TInput, TError, TOutput>,
|
||||||
|
|||||||
Reference in New Issue
Block a user