@trpc/react-query 11.25.2 → 11.25.3-canary.13.g1341462e1
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/dist/{getQueryKey-CWSorJjT.mjs → getQueryKey-BNW1XTCT.mjs} +17 -25
- package/dist/{getQueryKey-CWSorJjT.mjs.map → getQueryKey-BNW1XTCT.mjs.map} +1 -1
- package/dist/{getQueryKey-B3wY6Hsc.d.mts → getQueryKey-BOSmwokO.d.mts} +9 -43
- package/dist/getQueryKey-BOSmwokO.d.mts.map +1 -0
- package/dist/{getQueryKey-DASF3nl1.cjs → getQueryKey-CypUmkSM.cjs} +17 -26
- package/dist/{getQueryKey-CkLbRjaS.d.cts → getQueryKey-Hao5B9db.d.cts} +9 -43
- package/dist/getQueryKey-Hao5B9db.d.cts.map +1 -0
- package/dist/index.cjs +4 -6
- package/dist/index.d.cts +1 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -6
- package/dist/index.mjs.map +1 -1
- package/dist/rsc.cjs +2 -3
- package/dist/rsc.d.cts +4 -6
- package/dist/rsc.d.cts.map +1 -1
- package/dist/rsc.d.mts +4 -6
- package/dist/rsc.d.mts.map +1 -1
- package/dist/rsc.mjs +2 -3
- package/dist/rsc.mjs.map +1 -1
- package/dist/server/index.cjs +3 -4
- package/dist/server/index.d.cts +2 -3
- package/dist/server/index.d.cts.map +1 -1
- package/dist/server/index.d.mts +2 -3
- package/dist/server/index.d.mts.map +1 -1
- package/dist/server/index.mjs +3 -4
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.d.cts +1 -1
- package/dist/shared/index.d.mts +1 -1
- package/dist/shared/index.mjs +1 -2
- package/dist/{shared-v3jJm-s7.cjs → shared-B3bWC0Fi.cjs} +12 -22
- package/dist/{shared-DyU-Vz6d.mjs → shared-joRrXBzs.mjs} +13 -23
- package/dist/{shared-DyU-Vz6d.mjs.map → shared-joRrXBzs.mjs.map} +1 -1
- package/package.json +23 -23
- package/src/rsc.tsx +3 -3
- package/src/server/index.ts +7 -0
- package/src/server/ssgProxy.ts +5 -5
- package/dist/getQueryKey-B3wY6Hsc.d.mts.map +0 -1
- package/dist/getQueryKey-CkLbRjaS.d.cts.map +0 -1
package/dist/server/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require_shared = require("../shared-B3bWC0Fi.cjs");
|
|
3
|
+
const require_getQueryKey = require("../getQueryKey-CypUmkSM.cjs");
|
|
4
4
|
let _trpc_client = require("@trpc/client");
|
|
5
5
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
6
|
let _trpc_server_unstable_core_do_not_import = require("@trpc/server/unstable-core-do-not-import");
|
|
7
7
|
let _trpc_client_unstable_internals = require("@trpc/client/unstable-internals");
|
|
8
|
-
|
|
8
|
+
// src/server/ssgProxy.ts
|
|
9
9
|
const _excluded = ["promise"];
|
|
10
10
|
/**
|
|
11
11
|
* Creates helpers that fetch or prefetch queries on the server, for
|
|
@@ -139,5 +139,4 @@ function createServerSideHelpers(opts) {
|
|
|
139
139
|
return proxy[key];
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
//#endregion
|
|
143
142
|
exports.createServerSideHelpers = createServerSideHelpers;
|
package/dist/server/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { D as DecorateQueryProcedure, b as CreateTRPCReactQueryClientConfig } from "../getQueryKey-
|
|
1
|
+
import { D as DecorateQueryProcedure, b as CreateTRPCReactQueryClientConfig } from "../getQueryKey-Hao5B9db.cjs";
|
|
2
2
|
import { TRPCClient, TRPCUntypedClient } from "@trpc/client";
|
|
3
3
|
import { AnyQueryProcedure, AnyRootTypes, AnyRouter, ProtectedIntersection, RouterRecord, inferClientTypes, inferRouterContext } from "@trpc/server/unstable-core-do-not-import";
|
|
4
4
|
import { DehydrateOptions, DehydratedState, QueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { TransformerOptions } from "@trpc/client/unstable-internals";
|
|
6
|
-
//#region src/server/ssgProxy.d.ts
|
|
7
6
|
type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {
|
|
8
7
|
/**
|
|
9
8
|
* Call this router directly, without HTTP.
|
|
@@ -39,5 +38,5 @@ export declare function createServerSideHelpers<TRouter extends AnyRouter>(opts:
|
|
|
39
38
|
queryClient: QueryClient;
|
|
40
39
|
dehydrate: (opts?: DehydrateOptions) => DehydratedState;
|
|
41
40
|
}, DecoratedProcedureSSGRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>>;
|
|
42
|
-
|
|
41
|
+
export type { CreateSSGHelpersExternal, CreateSSGHelpersInternal, CreateServerSideHelpersOptions, DecoratedProcedureSSGRecord, SSGFns };
|
|
43
42
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/server/ssgProxy.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/server/ssgProxy.ts"],"mappings":";;;;;KAyCY,yBAAyB,gBAAgB;;;;EAInD,QAAQ;;;;EAIR,KAAK,mBAAmB;IACtB,mBAAmB,iBAAiB;UAEvB,yBAAyB,gBAAgB;;;;EAIxD,QAAQ,WAAW,WAAW,kBAAkB;;KAGtC,+BAA+B,gBAAgB,aACzD,oCACG,yBAAyB,WAAW,yBAAyB;KAEtD;;;;KAWA,4BACV,cAAc,cACd,gBAAgB,mBAEf,cAAc,UAAU,QAAQ,qBAAoB,UACjD,eAAe,oBACb,KAAK,uBAAuB,OAAO,SAAS,UAC5C,eAAe,eACb,4BAA4B,OAAO;;;;;;;;;;wBAgB7B,wBAAwB,gBAAgB,WACtD,MAAM,+BAA+B,WAAQ;EAuE5B,aAAA;EACF,YAAC,OAAO,qBAAqB;GAyF7C,4BAAA,sCAAA"}
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { D as DecorateQueryProcedure, b as CreateTRPCReactQueryClientConfig } from "../getQueryKey-
|
|
1
|
+
import { D as DecorateQueryProcedure, b as CreateTRPCReactQueryClientConfig } from "../getQueryKey-BOSmwokO.mjs";
|
|
2
2
|
import { TRPCClient, TRPCUntypedClient } from "@trpc/client";
|
|
3
3
|
import { DehydrateOptions, DehydratedState, QueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { AnyQueryProcedure, AnyRootTypes, AnyRouter, ProtectedIntersection, RouterRecord, inferClientTypes, inferRouterContext } from "@trpc/server/unstable-core-do-not-import";
|
|
5
5
|
import { TransformerOptions } from "@trpc/client/unstable-internals";
|
|
6
|
-
//#region src/server/ssgProxy.d.ts
|
|
7
6
|
type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {
|
|
8
7
|
/**
|
|
9
8
|
* Call this router directly, without HTTP.
|
|
@@ -39,5 +38,5 @@ export declare function createServerSideHelpers<TRouter extends AnyRouter>(opts:
|
|
|
39
38
|
queryClient: QueryClient;
|
|
40
39
|
dehydrate: (opts?: DehydrateOptions) => DehydratedState;
|
|
41
40
|
}, DecoratedProcedureSSGRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>>;
|
|
42
|
-
|
|
41
|
+
export type { CreateSSGHelpersExternal, CreateSSGHelpersInternal, CreateServerSideHelpersOptions, DecoratedProcedureSSGRecord, SSGFns };
|
|
43
42
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/server/ssgProxy.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/server/ssgProxy.ts"],"mappings":";;;;;KAyCY,yBAAyB,gBAAgB;;;;EAInD,QAAQ;;;;EAIR,KAAK,mBAAmB;IACtB,mBAAmB,iBAAiB;UAEvB,yBAAyB,gBAAgB;;;;EAIxD,QAAQ,WAAW,WAAW,kBAAkB;;KAGtC,+BAA+B,gBAAgB,aACzD,oCACG,yBAAyB,WAAW,yBAAyB;KAEtD;;;;KAWA,4BACV,cAAc,cACd,gBAAgB,mBAEf,cAAc,UAAU,QAAQ,qBAAoB,UACjD,eAAe,oBACb,KAAK,uBAAuB,OAAO,SAAS,UAC5C,eAAe,eACb,4BAA4B,OAAO;;;;;;;;;;wBAgB7B,wBAAwB,gBAAgB,WACtD,MAAM,+BAA+B,WAAQ;EAuE5B,aAAA;EACF,YAAC,OAAO,qBAAqB;GAyF7C,4BAAA,sCAAA"}
|
package/dist/server/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as getQueryType, i as getClientArgs, t as getQueryClient } from "../shared-joRrXBzs.mjs";
|
|
2
|
+
import { a as _objectSpread2, i as getQueryKeyInternal, o as _objectWithoutProperties } from "../getQueryKey-BNW1XTCT.mjs";
|
|
3
3
|
import { TRPCUntypedClient, getUntypedClient } from "@trpc/client";
|
|
4
4
|
import { dehydrate } from "@tanstack/react-query";
|
|
5
5
|
import { callProcedure, createFlatProxy, createRecursiveProxy, run } from "@trpc/server/unstable-core-do-not-import";
|
|
6
6
|
import { getTransformer } from "@trpc/client/unstable-internals";
|
|
7
|
-
|
|
7
|
+
// src/server/ssgProxy.ts
|
|
8
8
|
const _excluded = ["promise"];
|
|
9
9
|
/**
|
|
10
10
|
* Creates helpers that fetch or prefetch queries on the server, for
|
|
@@ -138,7 +138,6 @@ function createServerSideHelpers(opts) {
|
|
|
138
138
|
return proxy[key];
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { createServerSideHelpers };
|
|
143
142
|
|
|
144
143
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/server/ssgProxy.ts"],"sourcesContent":["import type {\n DehydratedState,\n DehydrateOptions,\n QueryClient,\n QueryFunctionContext,\n} from '@tanstack/react-query';\nimport { dehydrate } from '@tanstack/react-query';\nimport type { TRPCClient } from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { CoercedTransformerParameters } from '@trpc/client/unstable-internals';\nimport {\n getTransformer,\n type TransformerOptions,\n} from '@trpc/client/unstable-internals';\nimport type {\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferClientTypes,\n inferRouterContext,\n Maybe,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n callProcedure,\n createFlatProxy,\n createRecursiveProxy,\n run,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { getClientArgs } from '../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../internals/getQueryKey';\nimport { getQueryKeyInternal } from '../internals/getQueryKey';\nimport type {\n CreateTRPCReactQueryClientConfig,\n DecorateQueryProcedure,\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n} from '../shared';\nimport { getQueryClient, getQueryType } from '../shared';\n\ntype CreateSSGHelpersInternal<TRouter extends AnyRouter> = {\n /**\n * Call this router directly, without HTTP.\n */\n router: TRouter;\n /**\n * The context to call procedures with.\n */\n ctx: inferRouterContext<TRouter>;\n} & TransformerOptions<inferClientTypes<TRouter>>;\n\ninterface CreateSSGHelpersExternal<TRouter extends AnyRouter> {\n /**\n * Call procedures through this tRPC client.\n */\n client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;\n}\n\ntype CreateServerSideHelpersOptions<TRouter extends AnyRouter> =\n CreateTRPCReactQueryClientConfig &\n (CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);\n\ntype SSGFns =\n | 'queryOptions'\n | 'infiniteQueryOptions'\n | 'fetch'\n | 'fetchInfinite'\n | 'prefetch'\n | 'prefetchInfinite';\n\n/**\n * @internal\n */\ntype DecoratedProcedureSSGRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? Pick<DecorateQueryProcedure<TRoot, $Value>, SSGFns>\n : $Value extends RouterRecord\n ? DecoratedProcedureSSGRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype AnyDecoratedProcedure = Pick<DecorateQueryProcedure<any, any>, SSGFns>;\n\n/**\n * Creates helpers that fetch or prefetch queries on the server, for\n * server-side rendering and static generation.\n *\n * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in\n * the next major version. Use `@trpc/tanstack-react-query` instead.\n * @see https://trpc.io/docs/client/tanstack-react-query/migrating\n * @see https://trpc.io/docs/client/nextjs/pages-router/server-side-helpers\n */\nexport function createServerSideHelpers<TRouter extends AnyRouter>(\n opts: CreateServerSideHelpersOptions<TRouter>,\n) {\n const queryClient = getQueryClient(opts);\n const transformer = getTransformer(\n (opts as CoercedTransformerParameters).transformer,\n );\n\n const resolvedOpts: {\n serialize: (obj: unknown) => any;\n query: (queryOpts: { path: string; input: unknown }) => Promise<unknown>;\n } = (() => {\n if ('router' in opts) {\n const { ctx, router } = opts;\n return {\n serialize: (obj) => transformer.output.serialize(obj),\n query: (queryOpts) => {\n return callProcedure({\n router,\n path: queryOpts.path,\n getRawInput: async () => queryOpts.input,\n ctx,\n type: 'query',\n signal: undefined,\n batchIndex: 0,\n });\n },\n };\n }\n\n const { client } = opts;\n const untypedClient =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return {\n query: (queryOpts) =>\n untypedClient.query(queryOpts.path, queryOpts.input),\n serialize: (obj) => transformer.output.serialize(obj),\n };\n })();\n\n function _dehydrate(\n opts: DehydrateOptions = {\n shouldDehydrateQuery(query) {\n if (query.state.status === 'pending') {\n return false;\n }\n // makes sure to serialize errors\n return true;\n },\n },\n ): DehydratedState {\n const before = run(() => {\n const dehydrated = dehydrate(queryClient, opts);\n\n return {\n ...dehydrated,\n queries: dehydrated.queries.map((query) => {\n if (query.promise) {\n const { promise: _, ...rest } = query;\n return rest;\n }\n return query;\n }),\n };\n });\n const after = resolvedOpts.serialize(before);\n return after;\n }\n\n type CreateSSGHelpers = ProtectedIntersection<\n {\n queryClient: QueryClient;\n dehydrate: (opts?: DehydrateOptions) => DehydratedState;\n },\n DecoratedProcedureSSGRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >;\n const proxy = createRecursiveProxy<CreateSSGHelpers>((opts) => {\n const args = opts.args;\n const input = args[0];\n const arrayPath = [...opts.path];\n const utilName = arrayPath.pop() as keyof AnyDecoratedProcedure;\n\n const queryFn = () =>\n resolvedOpts.query({ path: arrayPath.join('.'), input });\n\n const infiniteQueryFn = ({\n pageParam,\n direction,\n }: QueryFunctionContext<TRPCQueryKey, unknown>) => {\n const initialCursor = (args[1] as Maybe<{ initialCursor?: unknown }>)\n ?.initialCursor;\n const [path, infiniteInput] = getClientArgs(\n [arrayPath, { input }],\n undefined,\n { pageParam: pageParam ?? initialCursor, direction },\n );\n return resolvedOpts.query({ path, input: infiniteInput });\n };\n\n const queryKey = getQueryKeyInternal(\n arrayPath,\n input,\n getQueryType(utilName),\n );\n\n const helperMap: Record<keyof AnyDecoratedProcedure, () => unknown> = {\n queryOptions: () => {\n const args1 = args[1] as Maybe<any>;\n return { ...args1, queryKey, queryFn };\n },\n infiniteQueryOptions: () => {\n const args1 = args[1] as Maybe<any>;\n return {\n ...args1,\n queryKey,\n queryFn: infiniteQueryFn,\n initialPageParam: args1?.initialCursor ?? null,\n };\n },\n fetch: () => {\n const args1 = args[1] as Maybe<TRPCFetchQueryOptions<any, any>>;\n return queryClient.fetchQuery({ ...args1, queryKey, queryFn });\n },\n fetchInfinite: () => {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n return queryClient.fetchInfiniteQuery({\n ...args1,\n queryKey,\n queryFn: infiniteQueryFn,\n initialPageParam: args1?.initialCursor ?? null,\n });\n },\n prefetch: () => {\n const args1 = args[1] as Maybe<TRPCFetchQueryOptions<any, any>>;\n return queryClient.prefetchQuery({ ...args1, queryKey, queryFn });\n },\n prefetchInfinite: () => {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n return queryClient.prefetchInfiniteQuery({\n ...args1,\n queryKey,\n queryFn: infiniteQueryFn,\n initialPageParam: args1?.initialCursor ?? null,\n });\n },\n };\n\n return helperMap[utilName]();\n });\n return createFlatProxy<CreateSSGHelpers>((key) => {\n if (key === 'queryClient') return queryClient;\n if (key === 'dehydrate') return _dehydrate;\n return proxy[key];\n });\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/server/ssgProxy.ts"],"sourcesContent":["import type {\n DehydratedState,\n DehydrateOptions,\n QueryClient,\n QueryFunctionContext,\n} from '@tanstack/react-query';\nimport { dehydrate } from '@tanstack/react-query';\nimport type { TRPCClient } from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { CoercedTransformerParameters } from '@trpc/client/unstable-internals';\nimport {\n getTransformer,\n type TransformerOptions,\n} from '@trpc/client/unstable-internals';\nimport type {\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferClientTypes,\n inferRouterContext,\n Maybe,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n callProcedure,\n createFlatProxy,\n createRecursiveProxy,\n run,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { getClientArgs } from '../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../internals/getQueryKey';\nimport { getQueryKeyInternal } from '../internals/getQueryKey';\nimport type {\n CreateTRPCReactQueryClientConfig,\n DecorateQueryProcedure,\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n} from '../shared';\nimport { getQueryClient, getQueryType } from '../shared';\n\nexport type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {\n /**\n * Call this router directly, without HTTP.\n */\n router: TRouter;\n /**\n * The context to call procedures with.\n */\n ctx: inferRouterContext<TRouter>;\n} & TransformerOptions<inferClientTypes<TRouter>>;\n\nexport interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {\n /**\n * Call procedures through this tRPC client.\n */\n client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;\n}\n\nexport type CreateServerSideHelpersOptions<TRouter extends AnyRouter> =\n CreateTRPCReactQueryClientConfig &\n (CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);\n\nexport type SSGFns =\n | 'queryOptions'\n | 'infiniteQueryOptions'\n | 'fetch'\n | 'fetchInfinite'\n | 'prefetch'\n | 'prefetchInfinite';\n\n/**\n * @internal\n */\nexport type DecoratedProcedureSSGRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? Pick<DecorateQueryProcedure<TRoot, $Value>, SSGFns>\n : $Value extends RouterRecord\n ? DecoratedProcedureSSGRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype AnyDecoratedProcedure = Pick<DecorateQueryProcedure<any, any>, SSGFns>;\n\n/**\n * Creates helpers that fetch or prefetch queries on the server, for\n * server-side rendering and static generation.\n *\n * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in\n * the next major version. Use `@trpc/tanstack-react-query` instead.\n * @see https://trpc.io/docs/client/tanstack-react-query/migrating\n * @see https://trpc.io/docs/client/nextjs/pages-router/server-side-helpers\n */\nexport function createServerSideHelpers<TRouter extends AnyRouter>(\n opts: CreateServerSideHelpersOptions<TRouter>,\n) {\n const queryClient = getQueryClient(opts);\n const transformer = getTransformer(\n (opts as CoercedTransformerParameters).transformer,\n );\n\n const resolvedOpts: {\n serialize: (obj: unknown) => any;\n query: (queryOpts: { path: string; input: unknown }) => Promise<unknown>;\n } = (() => {\n if ('router' in opts) {\n const { ctx, router } = opts;\n return {\n serialize: (obj) => transformer.output.serialize(obj),\n query: (queryOpts) => {\n return callProcedure({\n router,\n path: queryOpts.path,\n getRawInput: async () => queryOpts.input,\n ctx,\n type: 'query',\n signal: undefined,\n batchIndex: 0,\n });\n },\n };\n }\n\n const { client } = opts;\n const untypedClient =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return {\n query: (queryOpts) =>\n untypedClient.query(queryOpts.path, queryOpts.input),\n serialize: (obj) => transformer.output.serialize(obj),\n };\n })();\n\n function _dehydrate(\n opts: DehydrateOptions = {\n shouldDehydrateQuery(query) {\n if (query.state.status === 'pending') {\n return false;\n }\n // makes sure to serialize errors\n return true;\n },\n },\n ): DehydratedState {\n const before = run(() => {\n const dehydrated = dehydrate(queryClient, opts);\n\n return {\n ...dehydrated,\n queries: dehydrated.queries.map((query) => {\n if (query.promise) {\n const { promise: _, ...rest } = query;\n return rest;\n }\n return query;\n }),\n };\n });\n const after = resolvedOpts.serialize(before);\n return after;\n }\n\n type CreateSSGHelpers = ProtectedIntersection<\n {\n queryClient: QueryClient;\n dehydrate: (opts?: DehydrateOptions) => DehydratedState;\n },\n DecoratedProcedureSSGRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >;\n const proxy = createRecursiveProxy<CreateSSGHelpers>((opts) => {\n const args = opts.args;\n const input = args[0];\n const arrayPath = [...opts.path];\n const utilName = arrayPath.pop() as keyof AnyDecoratedProcedure;\n\n const queryFn = () =>\n resolvedOpts.query({ path: arrayPath.join('.'), input });\n\n const infiniteQueryFn = ({\n pageParam,\n direction,\n }: QueryFunctionContext<TRPCQueryKey, unknown>) => {\n const initialCursor = (args[1] as Maybe<{ initialCursor?: unknown }>)\n ?.initialCursor;\n const [path, infiniteInput] = getClientArgs(\n [arrayPath, { input }],\n undefined,\n { pageParam: pageParam ?? initialCursor, direction },\n );\n return resolvedOpts.query({ path, input: infiniteInput });\n };\n\n const queryKey = getQueryKeyInternal(\n arrayPath,\n input,\n getQueryType(utilName),\n );\n\n const helperMap: Record<keyof AnyDecoratedProcedure, () => unknown> = {\n queryOptions: () => {\n const args1 = args[1] as Maybe<any>;\n return { ...args1, queryKey, queryFn };\n },\n infiniteQueryOptions: () => {\n const args1 = args[1] as Maybe<any>;\n return {\n ...args1,\n queryKey,\n queryFn: infiniteQueryFn,\n initialPageParam: args1?.initialCursor ?? null,\n };\n },\n fetch: () => {\n const args1 = args[1] as Maybe<TRPCFetchQueryOptions<any, any>>;\n return queryClient.fetchQuery({ ...args1, queryKey, queryFn });\n },\n fetchInfinite: () => {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n return queryClient.fetchInfiniteQuery({\n ...args1,\n queryKey,\n queryFn: infiniteQueryFn,\n initialPageParam: args1?.initialCursor ?? null,\n });\n },\n prefetch: () => {\n const args1 = args[1] as Maybe<TRPCFetchQueryOptions<any, any>>;\n return queryClient.prefetchQuery({ ...args1, queryKey, queryFn });\n },\n prefetchInfinite: () => {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n return queryClient.prefetchInfiniteQuery({\n ...args1,\n queryKey,\n queryFn: infiniteQueryFn,\n initialPageParam: args1?.initialCursor ?? null,\n });\n },\n };\n\n return helperMap[utilName]();\n });\n return createFlatProxy<CreateSSGHelpers>((key) => {\n if (key === 'queryClient') return queryClient;\n if (key === 'dehydrate') return _dehydrate;\n return proxy[key];\n });\n}\n"],"mappings":"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"}
|
package/dist/shared/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_shared = require("../shared-
|
|
2
|
+
const require_shared = require("../shared-B3bWC0Fi.cjs");
|
|
3
3
|
exports.TRPCContext = require_shared.TRPCContext;
|
|
4
4
|
exports.contextProps = require_shared.contextProps;
|
|
5
5
|
exports.createQueryUtilsProxy = require_shared.createQueryUtilsProxy;
|
package/dist/shared/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-
|
|
1
|
+
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-Hao5B9db.cjs";
|
|
2
2
|
export { CreateClient, CreateQueryUtils, CreateReactUtils, CreateTRPCReactOptions, CreateTRPCReactQueryClientConfig, type DecorateProcedure, DecorateQueryProcedure, type DecorateRouterRecord, DecoratedProcedureUtilsRecord, DecoratedTRPCContextProps, DefinedTRPCInfiniteQueryOptionsIn, DefinedTRPCInfiniteQueryOptionsOut, DefinedTRPCQueryOptionsIn, DefinedTRPCQueryOptionsOut, DefinedUseTRPCQueryOptions, DefinedUseTRPCQueryResult, ExtractCursorType, InferMutationLikeData, InferMutationLikeInput, InferQueryLikeData, InferQueryLikeInput, MutationLike, OutputWithCursor, QueryLike, RouterLike, RouterLikeInner, SSRState, TRPCContext, TRPCContextProps, TRPCContextPropsBase, TRPCContextState, TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions, TRPCHookResult, TRPCProvider, TRPCProviderProps, TRPCQueryBaseOptions, TRPCQueryOptions, TRPCQueryOptionsResult, TRPCQueryUtils, TRPCReactRequestOptions, TRPCSubscriptionBaseResult, TRPCSubscriptionConnectingResult, TRPCSubscriptionErrorResult, TRPCSubscriptionIdleResult, TRPCSubscriptionPendingResult, TRPCSubscriptionResult, type TRPCUseQueries, TRPCUseQueryBaseOptions, type TRPCUseSuspenseQueries, UndefinedTRPCInfiniteQueryOptionsIn, UndefinedTRPCInfiniteQueryOptionsOut, UndefinedTRPCQueryOptionsIn, UndefinedTRPCQueryOptionsOut, UnusedSkipTokenTRPCInfiniteQueryOptionsIn, UnusedSkipTokenTRPCInfiniteQueryOptionsOut, UnusedSkipTokenTRPCQueryOptionsIn, UnusedSkipTokenTRPCQueryOptionsOut, UseMutationOverride, UseQueriesProcedureRecord, UseSuspenseQueriesProcedureRecord, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCInfiniteQuerySuccessResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCPrefetchInfiniteQueryOptions, UseTRPCPrefetchQueryOptions, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCQuerySuccessResult, UseTRPCSubscriptionOptions, UseTRPCSuspenseInfiniteQueryOptions, UseTRPCSuspenseInfiniteQueryResult, UseTRPCSuspenseQueryOptions, UseTRPCSuspenseQueryResult, UtilsLike, contextProps, createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUseQueries, getClientArgs, getQueryClient, getQueryType };
|
package/dist/shared/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-
|
|
1
|
+
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-BOSmwokO.mjs";
|
|
2
2
|
export { CreateClient, CreateQueryUtils, CreateReactUtils, CreateTRPCReactOptions, CreateTRPCReactQueryClientConfig, type DecorateProcedure, DecorateQueryProcedure, type DecorateRouterRecord, DecoratedProcedureUtilsRecord, DecoratedTRPCContextProps, DefinedTRPCInfiniteQueryOptionsIn, DefinedTRPCInfiniteQueryOptionsOut, DefinedTRPCQueryOptionsIn, DefinedTRPCQueryOptionsOut, DefinedUseTRPCQueryOptions, DefinedUseTRPCQueryResult, ExtractCursorType, InferMutationLikeData, InferMutationLikeInput, InferQueryLikeData, InferQueryLikeInput, MutationLike, OutputWithCursor, QueryLike, RouterLike, RouterLikeInner, SSRState, TRPCContext, TRPCContextProps, TRPCContextPropsBase, TRPCContextState, TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions, TRPCHookResult, TRPCProvider, TRPCProviderProps, TRPCQueryBaseOptions, TRPCQueryOptions, TRPCQueryOptionsResult, TRPCQueryUtils, TRPCReactRequestOptions, TRPCSubscriptionBaseResult, TRPCSubscriptionConnectingResult, TRPCSubscriptionErrorResult, TRPCSubscriptionIdleResult, TRPCSubscriptionPendingResult, TRPCSubscriptionResult, type TRPCUseQueries, TRPCUseQueryBaseOptions, type TRPCUseSuspenseQueries, UndefinedTRPCInfiniteQueryOptionsIn, UndefinedTRPCInfiniteQueryOptionsOut, UndefinedTRPCQueryOptionsIn, UndefinedTRPCQueryOptionsOut, UnusedSkipTokenTRPCInfiniteQueryOptionsIn, UnusedSkipTokenTRPCInfiniteQueryOptionsOut, UnusedSkipTokenTRPCQueryOptionsIn, UnusedSkipTokenTRPCQueryOptionsOut, UseMutationOverride, UseQueriesProcedureRecord, UseSuspenseQueriesProcedureRecord, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCInfiniteQuerySuccessResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCPrefetchInfiniteQueryOptions, UseTRPCPrefetchQueryOptions, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCQuerySuccessResult, UseTRPCSubscriptionOptions, UseTRPCSuspenseInfiniteQueryOptions, UseTRPCSuspenseInfiniteQueryResult, UseTRPCSuspenseQueryOptions, UseTRPCSuspenseQueryResult, UtilsLike, contextProps, createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUseQueries, getClientArgs, getQueryClient, getQueryType };
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { TRPCContext, contextProps, createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUseQueries, getClientArgs, getQueryClient, getQueryType };
|
|
1
|
+
export { l as TRPCContext, u as contextProps, o as createQueryUtilsProxy, d as createReactDecoration, s as createReactQueryUtils, n as createRootHooks, a as createUseQueries, i as getClientArgs, t as getQueryClient, c as getQueryType } from "../shared-joRrXBzs.mjs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_getQueryKey = require("./getQueryKey-
|
|
1
|
+
const require_getQueryKey = require("./getQueryKey-CypUmkSM.cjs");
|
|
2
2
|
let _trpc_client = require("@trpc/client");
|
|
3
3
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
4
4
|
let _trpc_server_unstable_core_do_not_import = require("@trpc/server/unstable-core-do-not-import");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_getQueryKey.__toESM(react, 1);
|
|
7
|
-
|
|
7
|
+
// src/shared/proxy/decorationProxy.ts
|
|
8
8
|
/**
|
|
9
9
|
* Create proxy for decorating procedures
|
|
10
10
|
* @internal
|
|
@@ -21,8 +21,7 @@ function createReactDecoration(hooks) {
|
|
|
21
21
|
return hooks[lastArg](pathCopy, input, opts);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
//#region src/internals/context.tsx
|
|
24
|
+
// src/internals/context.tsx
|
|
26
25
|
var _React$createContext;
|
|
27
26
|
/**
|
|
28
27
|
* The keys of {@link TRPCContextPropsBase}.
|
|
@@ -37,8 +36,7 @@ const contextProps = [
|
|
|
37
36
|
* The React context that holds the tRPC client and `QueryClient`.
|
|
38
37
|
*/
|
|
39
38
|
const TRPCContext = (_React$createContext = react.createContext) === null || _React$createContext === void 0 ? void 0 : _React$createContext.call(react, null);
|
|
40
|
-
|
|
41
|
-
//#region src/shared/proxy/utilsProxy.ts
|
|
39
|
+
// src/shared/proxy/utilsProxy.ts
|
|
42
40
|
/**
|
|
43
41
|
* Maps a `useUtils` helper name to the kind of query it works on.
|
|
44
42
|
*/
|
|
@@ -129,8 +127,7 @@ function createReactQueryUtils(context) {
|
|
|
129
127
|
function createQueryUtilsProxy(context) {
|
|
130
128
|
return createRecursiveUtilsProxy(context);
|
|
131
129
|
}
|
|
132
|
-
|
|
133
|
-
//#region src/shared/proxy/useQueriesProxy.ts
|
|
130
|
+
// src/shared/proxy/useQueriesProxy.ts
|
|
134
131
|
/**
|
|
135
132
|
* Create proxy for `useQueries` options
|
|
136
133
|
* @internal
|
|
@@ -149,8 +146,7 @@ function createUseQueries(client) {
|
|
|
149
146
|
}, _opts);
|
|
150
147
|
});
|
|
151
148
|
}
|
|
152
|
-
|
|
153
|
-
//#region src/internals/getClientArgs.ts
|
|
149
|
+
// src/internals/getClientArgs.ts
|
|
154
150
|
/**
|
|
155
151
|
* @internal
|
|
156
152
|
*/
|
|
@@ -168,8 +164,7 @@ function getClientArgs(queryKey, opts, infiniteParams) {
|
|
|
168
164
|
opts === null || opts === void 0 ? void 0 : opts.trpc
|
|
169
165
|
];
|
|
170
166
|
}
|
|
171
|
-
|
|
172
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/asyncIterator.js
|
|
167
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/asyncIterator.js
|
|
173
168
|
function _asyncIterator(r) {
|
|
174
169
|
var n, t, o, e = 2;
|
|
175
170
|
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
|
|
@@ -206,13 +201,12 @@ function AsyncFromSyncIterator(r) {
|
|
|
206
201
|
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
207
202
|
},
|
|
208
203
|
"throw": function _throw(r) {
|
|
209
|
-
var n = this.s["
|
|
204
|
+
var n = this.s["throw"];
|
|
210
205
|
return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
211
206
|
}
|
|
212
207
|
}, new AsyncFromSyncIterator(r);
|
|
213
208
|
}
|
|
214
|
-
|
|
215
|
-
//#region src/internals/trpcResult.ts
|
|
209
|
+
// src/internals/trpcResult.ts
|
|
216
210
|
function createTRPCOptionsResult(value) {
|
|
217
211
|
return { path: value.path.join(".") };
|
|
218
212
|
}
|
|
@@ -254,8 +248,7 @@ async function buildQueryFromAsyncIterable(asyncIterable, queryClient, queryKey)
|
|
|
254
248
|
}
|
|
255
249
|
return aggregate;
|
|
256
250
|
}
|
|
257
|
-
|
|
258
|
-
//#region src/utils/createUtilityFunctions.ts
|
|
251
|
+
// src/utils/createUtilityFunctions.ts
|
|
259
252
|
/**
|
|
260
253
|
* Creates a set of utility functions that can be used to interact with `react-query`
|
|
261
254
|
* @param opts the `TRPCClient` and `QueryClient` to use
|
|
@@ -386,8 +379,7 @@ function createUtilityFunctions(opts) {
|
|
|
386
379
|
}
|
|
387
380
|
};
|
|
388
381
|
}
|
|
389
|
-
|
|
390
|
-
//#region src/shared/hooks/createHooksInternal.tsx
|
|
382
|
+
// src/shared/hooks/createHooksInternal.tsx
|
|
391
383
|
const trackResult = (result, onTrackResult) => {
|
|
392
384
|
return new Proxy(result, { get(target, prop) {
|
|
393
385
|
onTrackResult(prop);
|
|
@@ -740,8 +732,7 @@ function createRootHooks(config) {
|
|
|
740
732
|
useSuspenseInfiniteQuery
|
|
741
733
|
};
|
|
742
734
|
}
|
|
743
|
-
|
|
744
|
-
//#region src/shared/queryClient.ts
|
|
735
|
+
// src/shared/queryClient.ts
|
|
745
736
|
/**
|
|
746
737
|
* @internal
|
|
747
738
|
*/
|
|
@@ -749,7 +740,6 @@ const getQueryClient = (config) => {
|
|
|
749
740
|
var _config$queryClient;
|
|
750
741
|
return (_config$queryClient = config.queryClient) !== null && _config$queryClient !== void 0 ? _config$queryClient : new _tanstack_react_query.QueryClient(config.queryClientConfig);
|
|
751
742
|
};
|
|
752
|
-
//#endregion
|
|
753
743
|
Object.defineProperty(exports, "TRPCContext", {
|
|
754
744
|
enumerable: true,
|
|
755
745
|
get: function() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as _objectSpread2, i as getQueryKeyInternal, n as getMutationKeyInternal } from "./getQueryKey-
|
|
1
|
+
import { a as _objectSpread2, i as getQueryKeyInternal, n as getMutationKeyInternal } from "./getQueryKey-BNW1XTCT.mjs";
|
|
2
2
|
import { TRPCUntypedClient, createTRPCClient, createTRPCClientProxy, getUntypedClient } from "@trpc/client";
|
|
3
3
|
import { QueryClient, hashKey, infiniteQueryOptions, queryOptions, skipToken, useInfiniteQuery, useMutation, usePrefetchInfiniteQuery, usePrefetchQuery, useQueries, useQuery, useSuspenseInfiniteQuery, useSuspenseQueries, useSuspenseQuery } from "@tanstack/react-query";
|
|
4
4
|
import { createFlatProxy, createRecursiveProxy, isAsyncIterable } from "@trpc/server/unstable-core-do-not-import";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
|
|
6
|
+
// src/shared/proxy/decorationProxy.ts
|
|
7
7
|
/**
|
|
8
8
|
* Create proxy for decorating procedures
|
|
9
9
|
* @internal
|
|
@@ -20,8 +20,7 @@ function createReactDecoration(hooks) {
|
|
|
20
20
|
return hooks[lastArg](pathCopy, input, opts);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
//#region src/internals/context.tsx
|
|
23
|
+
// src/internals/context.tsx
|
|
25
24
|
var _React$createContext;
|
|
26
25
|
/**
|
|
27
26
|
* The keys of {@link TRPCContextPropsBase}.
|
|
@@ -36,8 +35,7 @@ const contextProps = [
|
|
|
36
35
|
* The React context that holds the tRPC client and `QueryClient`.
|
|
37
36
|
*/
|
|
38
37
|
const TRPCContext = (_React$createContext = React.createContext) === null || _React$createContext === void 0 ? void 0 : _React$createContext.call(React, null);
|
|
39
|
-
|
|
40
|
-
//#region src/shared/proxy/utilsProxy.ts
|
|
38
|
+
// src/shared/proxy/utilsProxy.ts
|
|
41
39
|
/**
|
|
42
40
|
* Maps a `useUtils` helper name to the kind of query it works on.
|
|
43
41
|
*/
|
|
@@ -128,8 +126,7 @@ function createReactQueryUtils(context) {
|
|
|
128
126
|
function createQueryUtilsProxy(context) {
|
|
129
127
|
return createRecursiveUtilsProxy(context);
|
|
130
128
|
}
|
|
131
|
-
|
|
132
|
-
//#region src/shared/proxy/useQueriesProxy.ts
|
|
129
|
+
// src/shared/proxy/useQueriesProxy.ts
|
|
133
130
|
/**
|
|
134
131
|
* Create proxy for `useQueries` options
|
|
135
132
|
* @internal
|
|
@@ -148,8 +145,7 @@ function createUseQueries(client) {
|
|
|
148
145
|
}, _opts);
|
|
149
146
|
});
|
|
150
147
|
}
|
|
151
|
-
|
|
152
|
-
//#region src/internals/getClientArgs.ts
|
|
148
|
+
// src/internals/getClientArgs.ts
|
|
153
149
|
/**
|
|
154
150
|
* @internal
|
|
155
151
|
*/
|
|
@@ -167,8 +163,7 @@ function getClientArgs(queryKey, opts, infiniteParams) {
|
|
|
167
163
|
opts === null || opts === void 0 ? void 0 : opts.trpc
|
|
168
164
|
];
|
|
169
165
|
}
|
|
170
|
-
|
|
171
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/asyncIterator.js
|
|
166
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/asyncIterator.js
|
|
172
167
|
function _asyncIterator(r) {
|
|
173
168
|
var n, t, o, e = 2;
|
|
174
169
|
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
|
|
@@ -205,13 +200,12 @@ function AsyncFromSyncIterator(r) {
|
|
|
205
200
|
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
206
201
|
},
|
|
207
202
|
"throw": function _throw(r) {
|
|
208
|
-
var n = this.s["
|
|
203
|
+
var n = this.s["throw"];
|
|
209
204
|
return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
210
205
|
}
|
|
211
206
|
}, new AsyncFromSyncIterator(r);
|
|
212
207
|
}
|
|
213
|
-
|
|
214
|
-
//#region src/internals/trpcResult.ts
|
|
208
|
+
// src/internals/trpcResult.ts
|
|
215
209
|
function createTRPCOptionsResult(value) {
|
|
216
210
|
return { path: value.path.join(".") };
|
|
217
211
|
}
|
|
@@ -253,8 +247,7 @@ async function buildQueryFromAsyncIterable(asyncIterable, queryClient, queryKey)
|
|
|
253
247
|
}
|
|
254
248
|
return aggregate;
|
|
255
249
|
}
|
|
256
|
-
|
|
257
|
-
//#region src/utils/createUtilityFunctions.ts
|
|
250
|
+
// src/utils/createUtilityFunctions.ts
|
|
258
251
|
/**
|
|
259
252
|
* Creates a set of utility functions that can be used to interact with `react-query`
|
|
260
253
|
* @param opts the `TRPCClient` and `QueryClient` to use
|
|
@@ -385,8 +378,7 @@ function createUtilityFunctions(opts) {
|
|
|
385
378
|
}
|
|
386
379
|
};
|
|
387
380
|
}
|
|
388
|
-
|
|
389
|
-
//#region src/shared/hooks/createHooksInternal.tsx
|
|
381
|
+
// src/shared/hooks/createHooksInternal.tsx
|
|
390
382
|
const trackResult = (result, onTrackResult) => {
|
|
391
383
|
return new Proxy(result, { get(target, prop) {
|
|
392
384
|
onTrackResult(prop);
|
|
@@ -739,8 +731,7 @@ function createRootHooks(config) {
|
|
|
739
731
|
useSuspenseInfiniteQuery: useSuspenseInfiniteQuery$1
|
|
740
732
|
};
|
|
741
733
|
}
|
|
742
|
-
|
|
743
|
-
//#region src/shared/queryClient.ts
|
|
734
|
+
// src/shared/queryClient.ts
|
|
744
735
|
/**
|
|
745
736
|
* @internal
|
|
746
737
|
*/
|
|
@@ -748,7 +739,6 @@ const getQueryClient = (config) => {
|
|
|
748
739
|
var _config$queryClient;
|
|
749
740
|
return (_config$queryClient = config.queryClient) !== null && _config$queryClient !== void 0 ? _config$queryClient : new QueryClient(config.queryClientConfig);
|
|
750
741
|
};
|
|
751
|
-
//#endregion
|
|
752
742
|
export { createUseQueries as a, getQueryType as c, createReactDecoration as d, getClientArgs as i, TRPCContext as l, createRootHooks as n, createQueryUtilsProxy as o, createUtilityFunctions as r, createReactQueryUtils as s, getQueryClient as t, contextProps as u };
|
|
753
743
|
|
|
754
|
-
//# sourceMappingURL=shared-
|
|
744
|
+
//# sourceMappingURL=shared-joRrXBzs.mjs.map
|