@trpc/next 11.1.2 → 11.1.3-alpha-tmp-tsdown.23
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/app-dir/client/package.json +1 -0
- package/app-dir/links/nextCache/package.json +1 -0
- package/app-dir/links/nextHttp/package.json +1 -0
- package/app-dir/server/package.json +1 -0
- package/dist/_virtual/rolldown_runtime.js +30 -0
- package/dist/app-dir/client.d.mts +13 -0
- package/dist/app-dir/client.d.mts.map +1 -0
- package/dist/app-dir/client.d.ts +12 -5
- package/dist/app-dir/client.d.ts.map +1 -1
- package/dist/app-dir/client.js +25 -43
- package/dist/app-dir/client.mjs +24 -40
- package/dist/app-dir/client.mjs.map +1 -0
- package/dist/app-dir/create-action-hook.d.mts +47 -0
- package/dist/app-dir/create-action-hook.d.mts.map +1 -0
- package/dist/app-dir/create-action-hook.d.ts +33 -36
- package/dist/app-dir/create-action-hook.d.ts.map +1 -1
- package/dist/app-dir/create-action-hook.js +85 -101
- package/dist/app-dir/create-action-hook.mjs +84 -98
- package/dist/app-dir/create-action-hook.mjs.map +1 -0
- package/dist/app-dir/links/nextCache.d.mts +16 -0
- package/dist/app-dir/links/nextCache.d.mts.map +1 -0
- package/dist/app-dir/links/nextCache.d.ts +13 -9
- package/dist/app-dir/links/nextCache.d.ts.map +1 -1
- package/dist/app-dir/links/nextCache.js +44 -58
- package/dist/app-dir/links/nextCache.mjs +43 -55
- package/dist/app-dir/links/nextCache.mjs.map +1 -0
- package/dist/app-dir/links/nextHttp.d.mts +19 -0
- package/dist/app-dir/links/nextHttp.d.mts.map +1 -0
- package/dist/app-dir/links/nextHttp.d.ts +12 -8
- package/dist/app-dir/links/nextHttp.d.ts.map +1 -1
- package/dist/app-dir/links/nextHttp.js +31 -35
- package/dist/app-dir/links/nextHttp.mjs +30 -32
- package/dist/app-dir/links/nextHttp.mjs.map +1 -0
- package/dist/app-dir/server.d.mts +36 -0
- package/dist/app-dir/server.d.mts.map +1 -0
- package/dist/app-dir/server.d.ts +30 -24
- package/dist/app-dir/server.d.ts.map +1 -1
- package/dist/app-dir/server.js +86 -112
- package/dist/app-dir/server.mjs +85 -109
- package/dist/app-dir/server.mjs.map +1 -0
- package/dist/app-dir/shared.d.mts +37 -0
- package/dist/app-dir/shared.d.mts.map +1 -0
- package/dist/app-dir/shared.d.ts +21 -39
- package/dist/app-dir/shared.d.ts.map +1 -1
- package/dist/app-dir/shared.js +12 -13
- package/dist/app-dir/shared.mjs +11 -10
- package/dist/app-dir/shared.mjs.map +1 -0
- package/dist/app-dir/types.d.mts +33 -0
- package/dist/app-dir/types.d.mts.map +1 -0
- package/dist/app-dir/types.d.ts +27 -25
- package/dist/app-dir/types.d.ts.map +1 -1
- package/dist/createTRPCNext.d.mts +38 -0
- package/dist/createTRPCNext.d.mts.map +1 -0
- package/dist/createTRPCNext.d.ts +30 -21
- package/dist/createTRPCNext.d.ts.map +1 -1
- package/dist/createTRPCNext.js +23 -35
- package/dist/createTRPCNext.mjs +22 -32
- package/dist/createTRPCNext.mjs.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -8
- package/dist/index.mjs +4 -2
- package/dist/ssrPrepass.d.mts +10 -0
- package/dist/ssrPrepass.d.mts.map +1 -0
- package/dist/ssrPrepass.d.ts +9 -2
- package/dist/ssrPrepass.d.ts.map +1 -1
- package/dist/ssrPrepass.js +99 -134
- package/dist/ssrPrepass.mjs +98 -131
- package/dist/ssrPrepass.mjs.map +1 -0
- package/dist/withTRPC.d.mts +55 -0
- package/dist/withTRPC.d.mts.map +1 -0
- package/dist/withTRPC.d.ts +47 -46
- package/dist/withTRPC.d.ts.map +1 -1
- package/dist/withTRPC.js +69 -82
- package/dist/withTRPC.mjs +68 -79
- package/dist/withTRPC.mjs.map +1 -0
- package/package.json +63 -33
- package/src/withTRPC.tsx +1 -2
- package/ssrPrepass/package.json +1 -0
- package/dist/index.d.ts.map +0 -1
package/dist/app-dir/server.mjs
CHANGED
|
@@ -1,118 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createRecursiveProxy, formDataToObject,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { generateCacheTag, isFormData } from "./shared.mjs";
|
|
2
|
+
import { cache } from "react";
|
|
3
|
+
import { TRPCError, createRecursiveProxy, formDataToObject, getErrorShape, getTRPCErrorFromUnknown, transformTRPCResponse } from "@trpc/server/unstable-core-do-not-import";
|
|
4
|
+
import { clientCallTypeToProcedureType, createTRPCUntypedClient } from "@trpc/client";
|
|
5
|
+
import { rethrowNextErrors } from "@trpc/server/adapters/next-app-dir";
|
|
6
|
+
import { revalidateTag } from "next/cache";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
// ts-prune-ignore-next
|
|
8
|
+
//#region src/app-dir/server.ts
|
|
10
9
|
function experimental_createTRPCNextAppDirServer(opts) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
return client[procedureType](procedurePath, ...callOpts.args);
|
|
31
|
-
});
|
|
10
|
+
const getClient = cache(() => {
|
|
11
|
+
const config = opts.config();
|
|
12
|
+
return createTRPCUntypedClient(config);
|
|
13
|
+
});
|
|
14
|
+
return createRecursiveProxy((callOpts) => {
|
|
15
|
+
const client = getClient();
|
|
16
|
+
const pathCopy = [...callOpts.path];
|
|
17
|
+
const action = pathCopy.pop();
|
|
18
|
+
const procedurePath = pathCopy.join(".");
|
|
19
|
+
const procedureType = clientCallTypeToProcedureType(action);
|
|
20
|
+
const cacheTag = generateCacheTag(procedurePath, callOpts.args[0]);
|
|
21
|
+
if (action === "revalidate") {
|
|
22
|
+
revalidateTag(cacheTag);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
return client[procedureType](procedurePath, ...callOpts.args);
|
|
26
|
+
});
|
|
32
27
|
}
|
|
33
28
|
function experimental_createServerActionHandler(t, opts) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const shape = getErrorShape({
|
|
84
|
-
config,
|
|
85
|
-
ctx,
|
|
86
|
-
error,
|
|
87
|
-
input: rawInput,
|
|
88
|
-
path: '',
|
|
89
|
-
type: proc._def.type
|
|
90
|
-
});
|
|
91
|
-
return transformTRPCResponse(t._config, {
|
|
92
|
-
error: shape
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
};
|
|
29
|
+
const config = t._config;
|
|
30
|
+
const { normalizeFormData = true, createContext, rethrowNextErrors: shouldRethrowNextErrors = true } = opts;
|
|
31
|
+
const transformer = config.transformer;
|
|
32
|
+
return function createServerAction(proc) {
|
|
33
|
+
return async function actionHandler(rawInput) {
|
|
34
|
+
let ctx = void 0;
|
|
35
|
+
try {
|
|
36
|
+
ctx = await createContext?.() ?? {};
|
|
37
|
+
if (normalizeFormData && isFormData(rawInput)) try {
|
|
38
|
+
rawInput = formDataToObject(rawInput);
|
|
39
|
+
} catch {
|
|
40
|
+
throw new TRPCError({
|
|
41
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
42
|
+
message: "Failed to convert FormData to an object"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else if (rawInput && !isFormData(rawInput)) rawInput = transformer.input.deserialize(rawInput);
|
|
46
|
+
const data = proc._def.experimental_caller ? await proc(rawInput) : await proc({
|
|
47
|
+
input: void 0,
|
|
48
|
+
ctx,
|
|
49
|
+
path: "",
|
|
50
|
+
getRawInput: async () => rawInput,
|
|
51
|
+
type: proc._def.type,
|
|
52
|
+
signal: void 0
|
|
53
|
+
});
|
|
54
|
+
const transformedJSON = transformTRPCResponse(config, { result: { data } });
|
|
55
|
+
return transformedJSON;
|
|
56
|
+
} catch (cause) {
|
|
57
|
+
const error = getTRPCErrorFromUnknown(cause);
|
|
58
|
+
opts.onError?.({
|
|
59
|
+
ctx,
|
|
60
|
+
error,
|
|
61
|
+
input: rawInput,
|
|
62
|
+
path: "",
|
|
63
|
+
type: proc._def.type
|
|
64
|
+
});
|
|
65
|
+
if (shouldRethrowNextErrors) rethrowNextErrors(error);
|
|
66
|
+
const shape = getErrorShape({
|
|
67
|
+
config,
|
|
68
|
+
ctx,
|
|
69
|
+
error,
|
|
70
|
+
input: rawInput,
|
|
71
|
+
path: "",
|
|
72
|
+
type: proc._def.type
|
|
73
|
+
});
|
|
74
|
+
return transformTRPCResponse(t._config, { error: shape });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
97
78
|
}
|
|
98
|
-
// ts-prune-ignore-next
|
|
99
79
|
async function experimental_revalidateEndpoint(req) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return new Response(JSON.stringify({
|
|
111
|
-
revalidated: true,
|
|
112
|
-
now: Date.now()
|
|
113
|
-
}), {
|
|
114
|
-
status: 200
|
|
115
|
-
});
|
|
80
|
+
const { cacheTag } = await req.json();
|
|
81
|
+
if (typeof cacheTag !== "string") return new Response(JSON.stringify({
|
|
82
|
+
revalidated: false,
|
|
83
|
+
error: "cacheTag must be a string"
|
|
84
|
+
}), { status: 400 });
|
|
85
|
+
revalidateTag(cacheTag);
|
|
86
|
+
return new Response(JSON.stringify({
|
|
87
|
+
revalidated: true,
|
|
88
|
+
now: Date.now()
|
|
89
|
+
}), { status: 200 });
|
|
116
90
|
}
|
|
117
91
|
|
|
92
|
+
//#endregion
|
|
118
93
|
export { experimental_createServerActionHandler, experimental_createTRPCNextAppDirServer, experimental_revalidateEndpoint };
|
|
94
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["opts: CreateTRPCNextAppRouterOptions<TRouter>","t: TInstance","opts: CreateContextCallback<\n TInstance['_config']['$types']['ctx'],\n () => MaybePromise<TInstance['_config']['$types']['ctx']>\n > & {\n /**\n * Transform form data to a `Record` before passing it to the procedure\n * @default true\n */\n normalizeFormData?: boolean;\n /**\n * Called when an error occurs in the handler\n */\n onError?: (\n opts: ErrorHandlerOptions<TInstance['_config']['$types']['ctx']>,\n ) => void;\n\n /**\n * Rethrow errors that should be handled by Next.js\n * @default true\n */\n rethrowNextErrors?: boolean;\n }","proc: TProc","rawInput: FormData | inferProcedureInput<TProc>","ctx: TInstance['_config']['$types']['ctx'] | undefined","req: Request"],"sources":["../../src/app-dir/server.ts"],"sourcesContent":["/// <reference types=\"next\" />\nimport {\n clientCallTypeToProcedureType,\n createTRPCUntypedClient,\n} from '@trpc/client';\nimport type { CreateContextCallback } from '@trpc/server';\nimport { rethrowNextErrors } from '@trpc/server/adapters/next-app-dir';\nimport type {\n AnyProcedure,\n AnyRootTypes,\n AnyRouter,\n ErrorHandlerOptions,\n inferClientTypes,\n inferProcedureInput,\n MaybePromise,\n RootConfig,\n Simplify,\n TRPCResponse,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n createRecursiveProxy,\n formDataToObject,\n getErrorShape,\n getTRPCErrorFromUnknown,\n transformTRPCResponse,\n TRPCError,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { revalidateTag } from 'next/cache';\nimport { cache } from 'react';\nimport type {\n ActionHandlerDef,\n CreateTRPCNextAppRouterOptions,\n inferActionDef,\n} from './shared';\nimport { generateCacheTag, isFormData } from './shared';\nimport type { NextAppDirDecorateRouterRecord } from './types';\n\nexport type { ActionHandlerDef };\n\n// ts-prune-ignore-next\nexport function experimental_createTRPCNextAppDirServer<\n TRouter extends AnyRouter,\n>(opts: CreateTRPCNextAppRouterOptions<TRouter>) {\n const getClient = cache(() => {\n const config = opts.config();\n return createTRPCUntypedClient(config);\n });\n\n return createRecursiveProxy<\n NextAppDirDecorateRouterRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >((callOpts) => {\n // lazily initialize client\n const client = getClient();\n\n const pathCopy = [...callOpts.path];\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const action = pathCopy.pop()!;\n const procedurePath = pathCopy.join('.');\n const procedureType = clientCallTypeToProcedureType(action);\n const cacheTag = generateCacheTag(procedurePath, callOpts.args[0]);\n\n if (action === 'revalidate') {\n revalidateTag(cacheTag);\n return;\n }\n\n return (client[procedureType] as any)(procedurePath, ...callOpts.args);\n });\n}\n\n/**\n * @internal\n */\nexport type TRPCActionHandler<TDef extends ActionHandlerDef> = (\n input: FormData | TDef['input'],\n) => Promise<TRPCResponse<TDef['output'], TDef['errorShape']>>;\n\nexport function experimental_createServerActionHandler<\n TInstance extends {\n _config: RootConfig<AnyRootTypes>;\n },\n>(\n t: TInstance,\n opts: CreateContextCallback<\n TInstance['_config']['$types']['ctx'],\n () => MaybePromise<TInstance['_config']['$types']['ctx']>\n > & {\n /**\n * Transform form data to a `Record` before passing it to the procedure\n * @default true\n */\n normalizeFormData?: boolean;\n /**\n * Called when an error occurs in the handler\n */\n onError?: (\n opts: ErrorHandlerOptions<TInstance['_config']['$types']['ctx']>,\n ) => void;\n\n /**\n * Rethrow errors that should be handled by Next.js\n * @default true\n */\n rethrowNextErrors?: boolean;\n },\n) {\n const config = t._config;\n const {\n normalizeFormData = true,\n createContext,\n rethrowNextErrors: shouldRethrowNextErrors = true,\n } = opts;\n\n const transformer = config.transformer;\n\n // TODO allow this to take a `TRouter` in addition to a `AnyProcedure`\n return function createServerAction<TProc extends AnyProcedure>(\n proc: TProc,\n ): TRPCActionHandler<\n Simplify<inferActionDef<inferClientTypes<TInstance>, TProc>>\n > {\n return async function actionHandler(\n rawInput: FormData | inferProcedureInput<TProc>,\n ) {\n let ctx: TInstance['_config']['$types']['ctx'] | undefined = undefined;\n try {\n ctx = (await createContext?.()) ?? {};\n if (normalizeFormData && isFormData(rawInput)) {\n // Normalizes FormData so we can use `z.object({})` etc on the server\n try {\n rawInput = formDataToObject(rawInput);\n } catch {\n throw new TRPCError({\n code: 'INTERNAL_SERVER_ERROR',\n message: 'Failed to convert FormData to an object',\n });\n }\n } else if (rawInput && !isFormData(rawInput)) {\n rawInput = transformer.input.deserialize(rawInput);\n }\n\n const data = proc._def.experimental_caller\n ? await proc(rawInput as any)\n : await proc({\n input: undefined,\n ctx,\n path: '',\n getRawInput: async () => rawInput,\n type: proc._def.type,\n // is it possible to get the AbortSignal from the request?\n signal: undefined,\n });\n\n const transformedJSON = transformTRPCResponse(config, {\n result: {\n data,\n },\n });\n return transformedJSON;\n } catch (cause) {\n const error = getTRPCErrorFromUnknown(cause);\n\n opts.onError?.({\n ctx,\n error,\n input: rawInput,\n path: '',\n type: proc._def.type,\n });\n\n if (shouldRethrowNextErrors) {\n rethrowNextErrors(error);\n }\n\n const shape = getErrorShape({\n config,\n ctx,\n error,\n input: rawInput,\n path: '',\n type: proc._def.type,\n });\n\n return transformTRPCResponse(t._config, {\n error: shape,\n });\n }\n } as TRPCActionHandler<\n inferActionDef<TInstance['_config']['$types'], TProc>\n >;\n };\n}\n\n// ts-prune-ignore-next\nexport async function experimental_revalidateEndpoint(req: Request) {\n const { cacheTag } = await req.json();\n\n if (typeof cacheTag !== 'string') {\n return new Response(\n JSON.stringify({\n revalidated: false,\n error: 'cacheTag must be a string',\n }),\n { status: 400 },\n );\n }\n\n revalidateTag(cacheTag);\n return new Response(JSON.stringify({ revalidated: true, now: Date.now() }), {\n status: 200,\n });\n}\n"],"mappings":";;;;;;;;AAwCA,SAAgB,wCAEdA,MAA+C;CAC/C,MAAM,YAAY,MAAM,MAAM;EAC5B,MAAM,SAAS,KAAK,QAAQ;AAC5B,SAAO,wBAAwB,OAAO;CACvC,EAAC;AAEF,QAAO,qBAKL,CAAC,aAAa;EAEd,MAAM,SAAS,WAAW;EAE1B,MAAM,WAAW,CAAC,GAAG,SAAS,IAAK;EAEnC,MAAM,SAAS,SAAS,KAAK;EAC7B,MAAM,gBAAgB,SAAS,KAAK,IAAI;EACxC,MAAM,gBAAgB,8BAA8B,OAAO;EAC3D,MAAM,WAAW,iBAAiB,eAAe,SAAS,KAAK,GAAG;AAElE,MAAI,WAAW,cAAc;AAC3B,iBAAc,SAAS;AACvB;EACD;AAED,SAAO,AAAC,OAAO,eAAuB,eAAe,GAAG,SAAS,KAAK;CACvE,EAAC;AACH;AASD,SAAgB,uCAKdC,GACAC,MAsBA;CACA,MAAM,SAAS,EAAE;CACjB,MAAM,EACJ,oBAAoB,MACpB,eACA,mBAAmB,0BAA0B,MAC9C,GAAG;CAEJ,MAAM,cAAc,OAAO;AAG3B,QAAO,SAAS,mBACdC,MAGA;AACA,SAAO,eAAe,cACpBC,UACA;GACA,IAAIC;AACJ,OAAI;AACF,UAAO,MAAM,iBAAiB,IAAK,CAAE;AACrC,QAAI,qBAAqB,WAAW,SAAS,CAE3C,KAAI;AACF,gBAAW,iBAAiB,SAAS;IACtC,QAAO;AACN,WAAM,IAAI,UAAU;MAClB,MAAM;MACN,SAAS;KACV;IACF;aACQ,aAAa,WAAW,SAAS,CAC1C,YAAW,YAAY,MAAM,YAAY,SAAS;IAGpD,MAAM,OAAO,KAAK,KAAK,sBACnB,MAAM,KAAK,SAAgB,GAC3B,MAAM,KAAK;KACT;KACA;KACA,MAAM;KACN,aAAa,YAAY;KACzB,MAAM,KAAK,KAAK;KAEhB;IACD,EAAC;IAEN,MAAM,kBAAkB,sBAAsB,QAAQ,EACpD,QAAQ,EACN,KACD,EACF,EAAC;AACF,WAAO;GACR,SAAQ,OAAO;IACd,MAAM,QAAQ,wBAAwB,MAAM;AAE5C,SAAK,UAAU;KACb;KACA;KACA,OAAO;KACP,MAAM;KACN,MAAM,KAAK,KAAK;IACjB,EAAC;AAEF,QAAI,wBACF,mBAAkB,MAAM;IAG1B,MAAM,QAAQ,cAAc;KAC1B;KACA;KACA;KACA,OAAO;KACP,MAAM;KACN,MAAM,KAAK,KAAK;IACjB,EAAC;AAEF,WAAO,sBAAsB,EAAE,SAAS,EACtC,OAAO,MACR,EAAC;GACH;EACF;CAGF;AACF;AAGD,eAAsB,gCAAgCC,KAAc;CAClE,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,MAAM;AAErC,YAAW,aAAa,SACtB,QAAO,IAAI,SACT,KAAK,UAAU;EACb,aAAa;EACb,OAAO;CACR,EAAC,EACF,EAAE,QAAQ,IAAK;AAInB,eAAc,SAAS;AACvB,QAAO,IAAI,SAAS,KAAK,UAAU;EAAE,aAAa;EAAM,KAAK,KAAK,KAAK;CAAE,EAAC,EAAE,EAC1E,QAAQ,IACT;AACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AnyClientTypes, AnyProcedure, AnyRootTypes, AnyRouter, ProtectedIntersection, RouterRecord, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
2
|
+
import { CreateTRPCClientOptions, Resolver, TRPCClient, TRPCUntypedClient } from "@trpc/client";
|
|
3
|
+
import { inferProcedureOutput } from "@trpc/server";
|
|
4
|
+
|
|
5
|
+
//#region src/app-dir/shared.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
interface CreateTRPCNextAppRouterOptions<TRouter extends AnyRouter> {
|
|
14
|
+
config: () => CreateTRPCClientOptions<TRouter>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
interface ActionHandlerDef {
|
|
24
|
+
input?: any;
|
|
25
|
+
output?: any;
|
|
26
|
+
errorShape: any;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
type inferActionDef<TRoot extends AnyClientTypes, TProc extends AnyProcedure> = {
|
|
32
|
+
input: inferProcedureInput<TProc>;
|
|
33
|
+
output: inferProcedureOutput<TProc>;
|
|
34
|
+
errorShape: TRoot['errorShape'];
|
|
35
|
+
}; //#endregion
|
|
36
|
+
export { ActionHandlerDef, CreateTRPCNextAppRouterOptions, inferActionDef };
|
|
37
|
+
//# sourceMappingURL=shared.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.mts","names":[],"sources":["../../src/app-dir/shared.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;AAsIc,UAxCG,8BAwCH,CAAA,gBAxCkD,SAwClD,CAAA,CAAA;EAAK,MAAA,EAAA,GAAA,GAvCH,uBAuCG,CAvCqB,OAuCrB,CAAA;;;;;;;;;UAhBF,gBAAA;;;;;;;;KAUL,6BACI,8BACA;SAEP,oBAAoB;UACnB,qBAAqB;cACjB"}
|
package/dist/app-dir/shared.d.ts
CHANGED
|
@@ -1,55 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { CreateTRPCClientOptions, Resolver, TRPCClient, TRPCUntypedClient } from "@trpc/client";
|
|
2
|
+
import { AnyClientTypes, AnyProcedure, AnyRootTypes, AnyRouter, ProtectedIntersection, RouterRecord, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
3
|
+
import { inferProcedureOutput } from "@trpc/server";
|
|
4
|
+
|
|
5
|
+
//#region src/app-dir/shared.d.ts
|
|
5
6
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyQueryProcedure ? Resolver<{
|
|
10
|
-
input: inferProcedureInput<$Value>;
|
|
11
|
-
output: inferTransformedProcedureOutput<TRoot, $Value>;
|
|
12
|
-
errorShape: TRoot['errorShape'];
|
|
13
|
-
transformer: TRoot['transformer'];
|
|
14
|
-
}> : $Value extends RouterRecord ? UseProcedureRecord<TRoot, $Value> : never : never;
|
|
15
|
-
};
|
|
16
|
-
export declare function createUseProxy<TRouter extends AnyRouter>(client: TRPCUntypedClient<TRouter> | TRPCClient<TRouter>): UseProcedureRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>;
|
|
17
|
-
type NextAppRouterUse<TRouter extends AnyRouter> = {
|
|
18
|
-
<TData extends Promise<unknown>[]>(cb: (t: UseProcedureRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>) => [...TData]): {
|
|
19
|
-
[TKey in keyof TData]: Awaited<TData[TKey]>;
|
|
20
|
-
};
|
|
21
|
-
<TData extends Promise<unknown>>(cb: (t: UseProcedureRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>) => TData): Awaited<TData>;
|
|
22
|
-
};
|
|
23
|
-
type CreateTRPCNextAppRouterBase<TRouter extends AnyRouter> = {
|
|
24
|
-
use: NextAppRouterUse<TRouter>;
|
|
25
|
-
};
|
|
26
|
-
export type CreateTRPCNextAppRouter<TRouter extends AnyRouter> = ProtectedIntersection<CreateTRPCNextAppRouterBase<TRouter>, UseProcedureRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>>;
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
|
|
27
10
|
/**
|
|
28
11
|
* @internal
|
|
29
12
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
interface CreateTRPCNextAppRouterOptions<TRouter extends AnyRouter> {
|
|
14
|
+
config: () => CreateTRPCClientOptions<TRouter>;
|
|
32
15
|
}
|
|
33
16
|
/**
|
|
34
17
|
* @internal
|
|
35
18
|
*/
|
|
36
|
-
|
|
37
|
-
export declare function isFormData(value: unknown): value is FormData;
|
|
19
|
+
|
|
38
20
|
/**
|
|
39
21
|
* @internal
|
|
40
22
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
interface ActionHandlerDef {
|
|
24
|
+
input?: any;
|
|
25
|
+
output?: any;
|
|
26
|
+
errorShape: any;
|
|
45
27
|
}
|
|
46
28
|
/**
|
|
47
29
|
* @internal
|
|
48
30
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
export {};
|
|
31
|
+
type inferActionDef<TRoot extends AnyClientTypes, TProc extends AnyProcedure> = {
|
|
32
|
+
input: inferProcedureInput<TProc>;
|
|
33
|
+
output: inferProcedureOutput<TProc>;
|
|
34
|
+
errorShape: TRoot['errorShape'];
|
|
35
|
+
}; //#endregion
|
|
36
|
+
export { ActionHandlerDef, CreateTRPCNextAppRouterOptions, inferActionDef };
|
|
55
37
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","
|
|
1
|
+
{"version":3,"file":"shared.d.ts","names":[],"sources":["../../src/app-dir/shared.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;AAsIc,UAxCG,8BAwCH,CAAA,gBAxCkD,SAwClD,CAAA,CAAA;EAAK,MAAA,EAAA,GAAA,GAvCH,uBAuCG,CAvCqB,OAuCrB,CAAA;;;;;;;;;UAhBF,gBAAA;;;;;;;;KAUL,6BACI,8BACA;SAEP,oBAAoB;UACnB,qBAAqB;cACjB"}
|
package/dist/app-dir/shared.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require(
|
|
4
|
-
require('@trpc/server/unstable-core-do-not-import');
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const __trpc_server_unstable_core_do_not_import = require_rolldown_runtime.__toESM(require("@trpc/server/unstable-core-do-not-import"));
|
|
3
|
+
const __trpc_client = require_rolldown_runtime.__toESM(require("@trpc/client"));
|
|
5
4
|
|
|
5
|
+
//#region src/app-dir/shared.ts
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function generateCacheTag(procedurePath, input) {
|
|
10
|
+
return input ? `${procedurePath}?input=${JSON.stringify(input)}` : procedurePath;
|
|
10
11
|
}
|
|
11
12
|
function isFormData(value) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return value instanceof FormData;
|
|
13
|
+
if (typeof FormData === "undefined") return false;
|
|
14
|
+
return value instanceof FormData;
|
|
17
15
|
}
|
|
18
16
|
|
|
17
|
+
//#endregion
|
|
19
18
|
exports.generateCacheTag = generateCacheTag;
|
|
20
|
-
exports.isFormData = isFormData;
|
|
19
|
+
exports.isFormData = isFormData;
|
package/dist/app-dir/shared.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createRecursiveProxy } from "@trpc/server/unstable-core-do-not-import";
|
|
2
|
+
import { TRPCUntypedClient } from "@trpc/client";
|
|
3
3
|
|
|
4
|
+
//#region src/app-dir/shared.ts
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
function generateCacheTag(procedurePath, input) {
|
|
9
|
+
return input ? `${procedurePath}?input=${JSON.stringify(input)}` : procedurePath;
|
|
8
10
|
}
|
|
9
11
|
function isFormData(value) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return value instanceof FormData;
|
|
12
|
+
if (typeof FormData === "undefined") return false;
|
|
13
|
+
return value instanceof FormData;
|
|
15
14
|
}
|
|
16
15
|
|
|
16
|
+
//#endregion
|
|
17
17
|
export { generateCacheTag, isFormData };
|
|
18
|
+
//# sourceMappingURL=shared.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.mjs","names":["procedurePath: string","input: any","value: unknown"],"sources":["../../src/app-dir/shared.ts"],"sourcesContent":["import type {\n CreateTRPCClientOptions,\n Resolver,\n TRPCClient,\n} from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { inferProcedureOutput } from '@trpc/server';\nimport type {\n AnyClientTypes,\n AnyProcedure,\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferProcedureInput,\n inferTransformedProcedureOutput,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';\n\n/**\n * @internal\n */\nexport type UseProcedureRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? Resolver<{\n input: inferProcedureInput<$Value>;\n output: inferTransformedProcedureOutput<TRoot, $Value>;\n errorShape: TRoot['errorShape'];\n transformer: TRoot['transformer'];\n }>\n : $Value extends RouterRecord\n ? UseProcedureRecord<TRoot, $Value>\n : never\n : never;\n};\n\nexport function createUseProxy<TRouter extends AnyRouter>(\n client: TRPCUntypedClient<TRouter> | TRPCClient<TRouter>,\n) {\n const untypedClient: TRPCUntypedClient<TRouter> =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return createRecursiveProxy<\n UseProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >((opts) => {\n const path = opts.path.join('.');\n\n return untypedClient.query(path, ...opts.args);\n });\n}\n\ntype NextAppRouterUse<TRouter extends AnyRouter> = {\n <TData extends Promise<unknown>[]>(\n cb: (\n t: UseProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >,\n ) => [...TData],\n ): {\n [TKey in keyof TData]: Awaited<TData[TKey]>;\n };\n <TData extends Promise<unknown>>(\n cb: (\n t: UseProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >,\n ) => TData,\n ): Awaited<TData>;\n};\ntype CreateTRPCNextAppRouterBase<TRouter extends AnyRouter> = {\n use: NextAppRouterUse<TRouter>;\n};\nexport type CreateTRPCNextAppRouter<TRouter extends AnyRouter> =\n ProtectedIntersection<\n CreateTRPCNextAppRouterBase<TRouter>,\n UseProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >;\n\n/**\n * @internal\n */\nexport interface CreateTRPCNextAppRouterOptions<TRouter extends AnyRouter> {\n config: () => CreateTRPCClientOptions<TRouter>;\n}\n\n/**\n * @internal\n */\nexport function generateCacheTag(procedurePath: string, input: any) {\n return input\n ? `${procedurePath}?input=${JSON.stringify(input)}`\n : procedurePath;\n}\n\nexport function isFormData(value: unknown): value is FormData {\n if (typeof FormData === 'undefined') {\n // FormData is not supported\n return false;\n }\n return value instanceof FormData;\n}\n\n/**\n * @internal\n */\nexport interface ActionHandlerDef {\n input?: any;\n output?: any;\n errorShape: any;\n}\n\n// ts-prune-ignore-next\n/**\n * @internal\n */\nexport type inferActionDef<\n TRoot extends AnyClientTypes,\n TProc extends AnyProcedure,\n> = {\n input: inferProcedureInput<TProc>;\n output: inferProcedureOutput<TProc>;\n errorShape: TRoot['errorShape'];\n};\n"],"mappings":";;;;;;;AAqGA,SAAgB,iBAAiBA,eAAuBC,OAAY;AAClE,QAAO,SACF,EAAE,cAAc,SAAS,KAAK,UAAU,MAAM,CAAC,IAChD;AACL;AAED,SAAgB,WAAWC,OAAmC;AAC5D,YAAW,aAAa,YAEtB,QAAO;AAET,QAAO,iBAAiB;AACzB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AnyProcedure, AnyRootTypes, ProcedureType, RouterRecord, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
2
|
+
import { Resolver } from "@trpc/client";
|
|
3
|
+
|
|
4
|
+
//#region src/app-dir/types.d.ts
|
|
5
|
+
type ResolverDef = {
|
|
6
|
+
input: any;
|
|
7
|
+
output: any;
|
|
8
|
+
transformer: boolean;
|
|
9
|
+
errorShape: any;
|
|
10
|
+
};
|
|
11
|
+
type DecorateProcedureServer<TType extends ProcedureType, TDef extends ResolverDef> = TType extends 'query' ? {
|
|
12
|
+
query: Resolver<TDef>;
|
|
13
|
+
revalidate: (input?: TDef['input']) => Promise<{
|
|
14
|
+
revalidated: false;
|
|
15
|
+
error: string;
|
|
16
|
+
} | {
|
|
17
|
+
revalidated: true;
|
|
18
|
+
}>;
|
|
19
|
+
} : TType extends 'mutation' ? {
|
|
20
|
+
mutate: Resolver<TDef>;
|
|
21
|
+
} : TType extends 'subscription' ? {
|
|
22
|
+
subscribe: Resolver<TDef>;
|
|
23
|
+
} : never;
|
|
24
|
+
type NextAppDirDecorateRouterRecord<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyProcedure ? DecorateProcedureServer<$Value['_def']['type'], {
|
|
25
|
+
input: inferProcedureInput<$Value>;
|
|
26
|
+
output: inferTransformedProcedureOutput<TRoot, $Value>;
|
|
27
|
+
errorShape: TRoot['errorShape'];
|
|
28
|
+
transformer: TRoot['transformer'];
|
|
29
|
+
}> : $Value extends RouterRecord ? NextAppDirDecorateRouterRecord<TRoot, $Value> : never : never };
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { NextAppDirDecorateRouterRecord };
|
|
33
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/app-dir/types.ts"],"sourcesContent":[],"mappings":";;;;KAUK,WAAA;;EAAA,MAAA,EAAA,GAAA;EAOO,WAAA,EAAA,OAAA;EAAuB,UAAA,EAAA,GAAA;CAAA;AAEpB,KAFH,uBAEG,CAAA,cADC,aACD,EAAA,aAAA,WAAA,CAAA,GACX,KADW,SAAA,OAAA,GAAA;EAAW,KACtB,EAES,QAFT,CAEkB,IAFlB,CAAA;EAAK,UAEa,EAAA,CAAA,KAAA,CAAA,EAEN,IAFM,CAAA,OAAA,CAAA,EAAA,GAGX,OAHW,CAAA;IAAT,WAAA,EAAA,KAAA;IAEG,KAAA,EAAA,MAAA;EAAI,CAAA,GACT;IAIP,WAAA,EAAA,IAAA;EAAK,CAAA,CAAA;CAEoB,GAFzB,KAEY,SAAA,UAAA,GAAA;EAAQ,MAElB,EAFU,QAEV,CAFmB,IAEnB,CAAA;CAAK,GAAL,KAEwB,SAAA,cAAA,GAAA;EAAI,SAAb,EAAA,QAAA,CAAS,IAAT,CAAA;AAAQ,CAAA,GAAA,KAAA;AAIjB,KAAA,8BAA8B,CAAA,cAC1B,YAD0B,EAAA,gBAExB,YAFwB,CAAA,GAAA,WAAA,MAIzB,OAJyB,GAIf,OAJe,CAIP,IAJO,CAAA,SAAA,KAAA,OAAA,GAKpC,MALoC,SAKrB,YALqB,GAMlC,uBANkC,CAOhC,MAPgC,CAAA,MAAA,CAAA,CAAA,MAAA,CAAA,EAAA;EAC1B,KAAA,EAQG,mBARH,CAQuB,MARvB,CAAA;EACE,MAAA,EAQE,+BARF,CAQkC,KARlC,EAQyC,MARzC,CAAA;EAED,UAAA,EAOO,KAPP,CAAA,YAAA,CAAA;EAAU,WAAA,EAQF,KARE,CAAA,aAAA,CAAA;AAAO,CAAA,CAAA,GAW1B,MAX2B,SAWZ,YAXY,GAYzB,8BAZyB,CAYM,KAZN,EAYa,MAZb,CAAA,GAAA,KAAA,GAAA,KAAA,EAAI"}
|
package/dist/app-dir/types.d.ts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Resolver } from "@trpc/client";
|
|
2
|
+
import { AnyProcedure, AnyRootTypes, ProcedureType, RouterRecord, inferProcedureInput, inferTransformedProcedureOutput } from "@trpc/server/unstable-core-do-not-import";
|
|
3
|
+
|
|
4
|
+
//#region src/app-dir/types.d.ts
|
|
3
5
|
type ResolverDef = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
input: any;
|
|
7
|
+
output: any;
|
|
8
|
+
transformer: boolean;
|
|
9
|
+
errorShape: any;
|
|
8
10
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
type DecorateProcedureServer<TType extends ProcedureType, TDef extends ResolverDef> = TType extends 'query' ? {
|
|
12
|
+
query: Resolver<TDef>;
|
|
13
|
+
revalidate: (input?: TDef['input']) => Promise<{
|
|
14
|
+
revalidated: false;
|
|
15
|
+
error: string;
|
|
16
|
+
} | {
|
|
17
|
+
revalidated: true;
|
|
18
|
+
}>;
|
|
17
19
|
} : TType extends 'mutation' ? {
|
|
18
|
-
|
|
20
|
+
mutate: Resolver<TDef>;
|
|
19
21
|
} : TType extends 'subscription' ? {
|
|
20
|
-
|
|
22
|
+
subscribe: Resolver<TDef>;
|
|
21
23
|
} : never;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export {};
|
|
24
|
+
type NextAppDirDecorateRouterRecord<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends AnyProcedure ? DecorateProcedureServer<$Value['_def']['type'], {
|
|
25
|
+
input: inferProcedureInput<$Value>;
|
|
26
|
+
output: inferTransformedProcedureOutput<TRoot, $Value>;
|
|
27
|
+
errorShape: TRoot['errorShape'];
|
|
28
|
+
transformer: TRoot['transformer'];
|
|
29
|
+
}> : $Value extends RouterRecord ? NextAppDirDecorateRouterRecord<TRoot, $Value> : never : never };
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { NextAppDirDecorateRouterRecord };
|
|
31
33
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/app-dir/types.ts"],"sourcesContent":[],"mappings":";;;;KAUK,WAAA;;EAAA,MAAA,EAAA,GAAA;EAOO,WAAA,EAAA,OAAA;EAAuB,UAAA,EAAA,GAAA;CAAA;AAEpB,KAFH,uBAEG,CAAA,cADC,aACD,EAAA,aAAA,WAAA,CAAA,GACX,KADW,SAAA,OAAA,GAAA;EAAW,KACtB,EAES,QAFT,CAEkB,IAFlB,CAAA;EAAK,UAEa,EAAA,CAAA,KAAA,CAAA,EAEN,IAFM,CAAA,OAAA,CAAA,EAAA,GAGX,OAHW,CAAA;IAAT,WAAA,EAAA,KAAA;IAEG,KAAA,EAAA,MAAA;EAAI,CAAA,GACT;IAIP,WAAA,EAAA,IAAA;EAAK,CAAA,CAAA;CAEoB,GAFzB,KAEY,SAAA,UAAA,GAAA;EAAQ,MAElB,EAFU,QAEV,CAFmB,IAEnB,CAAA;CAAK,GAAL,KAEwB,SAAA,cAAA,GAAA;EAAI,SAAb,EAAA,QAAA,CAAS,IAAT,CAAA;AAAQ,CAAA,GAAA,KAAA;AAIjB,KAAA,8BAA8B,CAAA,cAC1B,YAD0B,EAAA,gBAExB,YAFwB,CAAA,GAAA,WAAA,MAIzB,OAJyB,GAIf,OAJe,CAIP,IAJO,CAAA,SAAA,KAAA,OAAA,GAKpC,MALoC,SAKrB,YALqB,GAMlC,uBANkC,CAOhC,MAPgC,CAAA,MAAA,CAAA,CAAA,MAAA,CAAA,EAAA;EAC1B,KAAA,EAQG,mBARH,CAQuB,MARvB,CAAA;EACE,MAAA,EAQE,+BARF,CAQkC,KARlC,EAQyC,MARzC,CAAA;EAED,UAAA,EAOO,KAPP,CAAA,YAAA,CAAA;EAAU,WAAA,EAQF,KARE,CAAA,aAAA,CAAA;AAAO,CAAA,CAAA,GAW1B,MAX2B,SAWZ,YAXY,GAYzB,8BAZyB,CAYM,KAZN,EAYa,MAZb,CAAA,GAAA,KAAA,GAAA,KAAA,EAAI"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { WithTRPCNoSSROptions, WithTRPCSSROptions, withTRPC$1 as withTRPC } from "./withTRPC.mjs";
|
|
2
|
+
import { CreateReactUtils, DecorateRouterRecord, TRPCUseQueries, TRPCUseSuspenseQueries } from "@trpc/react-query/shared";
|
|
3
|
+
import { AnyRouter, ProtectedIntersection } from "@trpc/server/unstable-core-do-not-import";
|
|
4
|
+
import { NextPageContext } from "next/types";
|
|
5
|
+
|
|
6
|
+
//#region src/createTRPCNext.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
interface CreateTRPCNextBase<TRouter extends AnyRouter, TSSRContext extends NextPageContext> {
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
16
|
+
*
|
|
17
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
18
|
+
*/
|
|
19
|
+
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
20
|
+
/**
|
|
21
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
22
|
+
*/
|
|
23
|
+
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
24
|
+
withTRPC: ReturnType<typeof withTRPC<TRouter, TSSRContext>>;
|
|
25
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
26
|
+
useSuspenseQueries: TRPCUseSuspenseQueries<TRouter>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
type CreateTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext> = ProtectedIntersection<CreateTRPCNextBase<TRouter, TSSRContext>, DecorateRouterRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>>;
|
|
32
|
+
declare function createTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext = NextPageContext>(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>): CreateTRPCNext<TRouter, TSSRContext>;
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//# sourceMappingURL=createTRPCNext.d.ts.map
|
|
36
|
+
|
|
37
|
+
export { CreateTRPCNext, CreateTRPCNextBase, createTRPCNext as createTRPCNext$1 };
|
|
38
|
+
//# sourceMappingURL=createTRPCNext.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTRPCNext.d.mts","names":[],"sources":["../src/createTRPCNext.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;UA0BiB,mCACC,+BACI;EAFL;;;;;EASuB,UAAE,EAAA,EAA1B,gBAA0B,CAAT,OAAS,EAAA,WAAA,CAAA;EAAW;;;EAIF,QAArC,EAAA,EAAA,gBAAA,CAAiB,OAAjB,EAA0B,WAA1B,CAAA;EAAgB,QACS,EAA3B,UAA2B,CAAA,OAAT,QAAS,CAAA,OAAA,EAAS,WAAT,CAAA,CAAA;EAAO,UAAE,EAClC,cADkC,CACnB,OADmB,CAAA;EAAW,kBAA7B,EAER,sBAFQ,CAEe,OAFf,CAAA;;;;;AAER,KAMV,cANU,CAAA,gBAOJ,SAPI,EAAA,oBAQA,eARA,CAAA,GASlB,qBATkB,CAUpB,kBAVoB,CAUD,OAVC,EAUQ,WAVR,CAAA,EAWpB,oBAXoB,CAYlB,OAZkB,CAAA,MAAA,CAAA,CAAA,SAAA,CAAA,CAAA,QAAA,CAAA,EAalB,OAbkB,CAAA,MAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA;AAAsB,iBAiB5B,cAjB4B,CAAA,gBAkB1B,SAlB0B,EAAA,oBAmBtB,eAnBsB,GAmBJ,eAnBI,CAAA,CAAA,IAAA,EAqBpC,oBArBoC,CAqBf,OArBe,CAAA,GAqBJ,kBArBI,CAqBe,OArBf,CAAA,CAAA,EAsBzC,cAtByC,CAsB1B,OAtB0B,EAsBjB,WAtBiB,CAAA"}
|