@trpc/react-query 11.4.1 → 11.4.2

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.
@@ -0,0 +1,196 @@
1
+ import { skipToken } from "@tanstack/react-query";
2
+ import { isObject } from "@trpc/server/unstable-core-do-not-import";
3
+
4
+ //#region rolldown:runtime
5
+ var __create = Object.create;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __commonJS = (cb, mod) => function() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
+ key = keys[i];
17
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: ((k) => from[k]).bind(null, key),
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
27
+ }) : target, mod));
28
+
29
+ //#endregion
30
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js
31
+ var require_objectWithoutPropertiesLoose = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
32
+ function _objectWithoutPropertiesLoose(r, e) {
33
+ if (null == r) return {};
34
+ var t = {};
35
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
36
+ if (e.includes(n)) continue;
37
+ t[n] = r[n];
38
+ }
39
+ return t;
40
+ }
41
+ module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
42
+ } });
43
+
44
+ //#endregion
45
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js
46
+ var require_objectWithoutProperties = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(exports, module) {
47
+ var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
48
+ function _objectWithoutProperties$1(e, t) {
49
+ if (null == e) return {};
50
+ var o, r, i = objectWithoutPropertiesLoose(e, t);
51
+ if (Object.getOwnPropertySymbols) {
52
+ var s = Object.getOwnPropertySymbols(e);
53
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
54
+ }
55
+ return i;
56
+ }
57
+ module.exports = _objectWithoutProperties$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
58
+ } });
59
+
60
+ //#endregion
61
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js
62
+ var require_typeof = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
63
+ function _typeof$2(o) {
64
+ "@babel/helpers - typeof";
65
+ return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
66
+ return typeof o$1;
67
+ } : function(o$1) {
68
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
69
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
70
+ }
71
+ module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
72
+ } });
73
+
74
+ //#endregion
75
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js
76
+ var require_toPrimitive = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
77
+ var _typeof$1 = require_typeof()["default"];
78
+ function toPrimitive$1(t, r) {
79
+ if ("object" != _typeof$1(t) || !t) return t;
80
+ var e = t[Symbol.toPrimitive];
81
+ if (void 0 !== e) {
82
+ var i = e.call(t, r || "default");
83
+ if ("object" != _typeof$1(i)) return i;
84
+ throw new TypeError("@@toPrimitive must return a primitive value.");
85
+ }
86
+ return ("string" === r ? String : Number)(t);
87
+ }
88
+ module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
89
+ } });
90
+
91
+ //#endregion
92
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js
93
+ var require_toPropertyKey = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
94
+ var _typeof = require_typeof()["default"];
95
+ var toPrimitive = require_toPrimitive();
96
+ function toPropertyKey$1(t) {
97
+ var i = toPrimitive(t, "string");
98
+ return "symbol" == _typeof(i) ? i : i + "";
99
+ }
100
+ module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
101
+ } });
102
+
103
+ //#endregion
104
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js
105
+ var require_defineProperty = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
106
+ var toPropertyKey = require_toPropertyKey();
107
+ function _defineProperty(e, r, t) {
108
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
109
+ value: t,
110
+ enumerable: !0,
111
+ configurable: !0,
112
+ writable: !0
113
+ }) : e[r] = t, e;
114
+ }
115
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
116
+ } });
117
+
118
+ //#endregion
119
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js
120
+ var require_objectSpread2 = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
121
+ var defineProperty = require_defineProperty();
122
+ function ownKeys(e, r) {
123
+ var t = Object.keys(e);
124
+ if (Object.getOwnPropertySymbols) {
125
+ var o = Object.getOwnPropertySymbols(e);
126
+ r && (o = o.filter(function(r$1) {
127
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
128
+ })), t.push.apply(t, o);
129
+ }
130
+ return t;
131
+ }
132
+ function _objectSpread2(e) {
133
+ for (var r = 1; r < arguments.length; r++) {
134
+ var t = null != arguments[r] ? arguments[r] : {};
135
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
136
+ defineProperty(e, r$1, t[r$1]);
137
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
138
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
139
+ });
140
+ }
141
+ return e;
142
+ }
143
+ module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
144
+ } });
145
+
146
+ //#endregion
147
+ //#region src/internals/getQueryKey.ts
148
+ var import_objectWithoutProperties = __toESM(require_objectWithoutProperties(), 1);
149
+ var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
150
+ const _excluded = ["cursor", "direction"];
151
+ /**
152
+ * To allow easy interactions with groups of related queries, such as
153
+ * invalidating all queries of a router, we use an array as the path when
154
+ * storing in tanstack query.
155
+ **/
156
+ function getQueryKeyInternal(path, input, type) {
157
+ const splitPath = path.flatMap((part) => part.split("."));
158
+ if (!input && (!type || type === "any")) return splitPath.length ? [splitPath] : [];
159
+ if (type === "infinite" && isObject(input) && ("direction" in input || "cursor" in input)) {
160
+ const { cursor: _, direction: __ } = input, inputWithoutCursorAndDirection = (0, import_objectWithoutProperties.default)(input, _excluded);
161
+ return [splitPath, {
162
+ input: inputWithoutCursorAndDirection,
163
+ type: "infinite"
164
+ }];
165
+ }
166
+ return [splitPath, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, typeof input !== "undefined" && input !== skipToken && { input }), type && type !== "any" && { type })];
167
+ }
168
+ function getMutationKeyInternal(path) {
169
+ return getQueryKeyInternal(path, void 0, "any");
170
+ }
171
+ /**
172
+ * Method to extract the query key for a procedure
173
+ * @param procedureOrRouter - procedure or AnyRouter
174
+ * @param input - input to procedureOrRouter
175
+ * @param type - defaults to `any`
176
+ * @see https://trpc.io/docs/v11/getQueryKey
177
+ */
178
+ function getQueryKey(procedureOrRouter, ..._params) {
179
+ const [input, type] = _params;
180
+ const path = procedureOrRouter._def().path;
181
+ const queryKey = getQueryKeyInternal(path, input, type !== null && type !== void 0 ? type : "any");
182
+ return queryKey;
183
+ }
184
+ /**
185
+ * Method to extract the mutation key for a procedure
186
+ * @param procedure - procedure
187
+ * @see https://trpc.io/docs/v11/getQueryKey#mutations
188
+ */
189
+ function getMutationKey(procedure) {
190
+ const path = procedure._def().path;
191
+ return getMutationKeyInternal(path);
192
+ }
193
+
194
+ //#endregion
195
+ export { __commonJS, __toESM, getMutationKey, getMutationKeyInternal, getQueryKey, getQueryKeyInternal, require_objectSpread2, require_objectWithoutProperties };
196
+ //# sourceMappingURL=getQueryKey-BY58RNzP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getQueryKey-BY58RNzP.mjs","names":["_objectWithoutProperties","_typeof","o","_typeof","toPrimitive","toPropertyKey","r","path: readonly string[]","input: unknown","type: QueryType","procedureOrRouter: TProcedureOrRouter","procedure: TProcedure"],"sources":["../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js","../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js","../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js","../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js","../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js","../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js","../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js","../src/internals/getQueryKey.ts"],"sourcesContent":["function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (e.includes(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nmodule.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose.js\");\nfunction _objectWithoutProperties(e, t) {\n if (null == e) return {};\n var o,\n r,\n i = objectWithoutPropertiesLoose(e, t);\n if (Object.getOwnPropertySymbols) {\n var s = Object.getOwnPropertySymbols(e);\n for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);\n }\n return i;\n}\nmodule.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nmodule.exports = toPrimitive, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nvar toPrimitive = require(\"./toPrimitive.js\");\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nmodule.exports = toPropertyKey, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var toPropertyKey = require(\"./toPropertyKey.js\");\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var defineProperty = require(\"./defineProperty.js\");\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nmodule.exports = _objectSpread2, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","import { skipToken } from '@tanstack/react-query';\nimport {\n isObject,\n type DeepPartial,\n} from '@trpc/server/unstable-core-do-not-import';\nimport type { DecoratedMutation, DecoratedQuery } from '../createTRPCReact';\nimport type { DecorateRouterRecord } from '../shared';\n\nexport type QueryType = 'any' | 'infinite' | 'query';\n\nexport type TRPCQueryKey = [\n readonly string[],\n { input?: unknown; type?: Exclude<QueryType, 'any'> }?,\n];\n\nexport type TRPCMutationKey = [readonly string[]]; // = [TRPCQueryKey[0]]\n\ntype ProcedureOrRouter =\n | DecoratedMutation<any>\n | DecoratedQuery<any>\n | DecorateRouterRecord<any, any>;\n\n/**\n * To allow easy interactions with groups of related queries, such as\n * invalidating all queries of a router, we use an array as the path when\n * storing in tanstack query.\n **/\nexport function getQueryKeyInternal(\n path: readonly string[],\n input: unknown,\n type: QueryType,\n): TRPCQueryKey {\n // Construct a query key that is easy to destructure and flexible for\n // partial selecting etc.\n // https://github.com/trpc/trpc/issues/3128\n\n // some parts of the path may be dot-separated, split them up\n const splitPath = path.flatMap((part) => part.split('.'));\n\n if (!input && (!type || type === 'any')) {\n // this matches also all mutations (see `getMutationKeyInternal`)\n\n // for `utils.invalidate()` to match all queries (including vanilla react-query)\n // we don't want nested array if path is empty, i.e. `[]` instead of `[[]]`\n return splitPath.length ? [splitPath] : ([] as unknown as TRPCQueryKey);\n }\n\n if (\n type === 'infinite' &&\n isObject(input) &&\n ('direction' in input || 'cursor' in input)\n ) {\n const {\n cursor: _,\n direction: __,\n ...inputWithoutCursorAndDirection\n } = input;\n return [\n splitPath,\n {\n input: inputWithoutCursorAndDirection,\n type: 'infinite',\n },\n ];\n }\n return [\n splitPath,\n {\n ...(typeof input !== 'undefined' &&\n input !== skipToken && { input: input }),\n ...(type && type !== 'any' && { type: type }),\n },\n ];\n}\n\nexport function getMutationKeyInternal(path: readonly string[]) {\n return getQueryKeyInternal(path, undefined, 'any') as TRPCMutationKey;\n}\n\ntype GetInfiniteQueryInput<\n TProcedureInput,\n TInputWithoutCursorAndDirection = Omit<\n TProcedureInput,\n 'cursor' | 'direction'\n >,\n> = keyof TInputWithoutCursorAndDirection extends never\n ? undefined\n : DeepPartial<TInputWithoutCursorAndDirection> | undefined;\n\n/** @internal */\nexport type GetQueryProcedureInput<TProcedureInput> = TProcedureInput extends {\n cursor?: any;\n}\n ? GetInfiniteQueryInput<TProcedureInput>\n : DeepPartial<TProcedureInput> | undefined;\n\ntype GetParams<TProcedureOrRouter extends ProcedureOrRouter> =\n TProcedureOrRouter extends DecoratedQuery<infer $Def>\n ? [input?: GetQueryProcedureInput<$Def['input']>, type?: QueryType]\n : [];\n\n/**\n * Method to extract the query key for a procedure\n * @param procedureOrRouter - procedure or AnyRouter\n * @param input - input to procedureOrRouter\n * @param type - defaults to `any`\n * @see https://trpc.io/docs/v11/getQueryKey\n */\nexport function getQueryKey<TProcedureOrRouter extends ProcedureOrRouter>(\n procedureOrRouter: TProcedureOrRouter,\n ..._params: GetParams<TProcedureOrRouter>\n) {\n const [input, type] = _params;\n\n // @ts-expect-error - we don't expose _def on the type layer\n const path = procedureOrRouter._def().path as string[];\n const queryKey = getQueryKeyInternal(path, input, type ?? 'any');\n return queryKey;\n}\n\n// TODO: look over if we can't use a single type\nexport type QueryKeyKnown<TInput, TType extends Exclude<QueryType, 'any'>> = [\n string[],\n { input?: GetQueryProcedureInput<TInput>; type: TType }?,\n];\n\n/**\n * Method to extract the mutation key for a procedure\n * @param procedure - procedure\n * @see https://trpc.io/docs/v11/getQueryKey#mutations\n */\nexport function getMutationKey<TProcedure extends DecoratedMutation<any>>(\n procedure: TProcedure,\n) {\n // @ts-expect-error - we don't expose _def on the type layer\n const path = procedure._def().path as string[];\n return getMutationKeyInternal(path);\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6],"mappings":"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"}
@@ -0,0 +1,242 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ value: mod,
23
+ enumerable: true
24
+ }) : target, mod));
25
+
26
+ //#endregion
27
+ const __tanstack_react_query = __toESM(require("@tanstack/react-query"));
28
+ const __trpc_server_unstable_core_do_not_import = __toESM(require("@trpc/server/unstable-core-do-not-import"));
29
+
30
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js
31
+ var require_objectWithoutPropertiesLoose = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
32
+ function _objectWithoutPropertiesLoose(r, e) {
33
+ if (null == r) return {};
34
+ var t = {};
35
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
36
+ if (e.includes(n)) continue;
37
+ t[n] = r[n];
38
+ }
39
+ return t;
40
+ }
41
+ module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
42
+ } });
43
+
44
+ //#endregion
45
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js
46
+ var require_objectWithoutProperties = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(exports, module) {
47
+ var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
48
+ function _objectWithoutProperties$1(e, t) {
49
+ if (null == e) return {};
50
+ var o, r, i = objectWithoutPropertiesLoose(e, t);
51
+ if (Object.getOwnPropertySymbols) {
52
+ var s = Object.getOwnPropertySymbols(e);
53
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
54
+ }
55
+ return i;
56
+ }
57
+ module.exports = _objectWithoutProperties$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
58
+ } });
59
+
60
+ //#endregion
61
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js
62
+ var require_typeof = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
63
+ function _typeof$2(o) {
64
+ "@babel/helpers - typeof";
65
+ return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
66
+ return typeof o$1;
67
+ } : function(o$1) {
68
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
69
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
70
+ }
71
+ module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
72
+ } });
73
+
74
+ //#endregion
75
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js
76
+ var require_toPrimitive = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
77
+ var _typeof$1 = require_typeof()["default"];
78
+ function toPrimitive$1(t, r) {
79
+ if ("object" != _typeof$1(t) || !t) return t;
80
+ var e = t[Symbol.toPrimitive];
81
+ if (void 0 !== e) {
82
+ var i = e.call(t, r || "default");
83
+ if ("object" != _typeof$1(i)) return i;
84
+ throw new TypeError("@@toPrimitive must return a primitive value.");
85
+ }
86
+ return ("string" === r ? String : Number)(t);
87
+ }
88
+ module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
89
+ } });
90
+
91
+ //#endregion
92
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js
93
+ var require_toPropertyKey = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
94
+ var _typeof = require_typeof()["default"];
95
+ var toPrimitive = require_toPrimitive();
96
+ function toPropertyKey$1(t) {
97
+ var i = toPrimitive(t, "string");
98
+ return "symbol" == _typeof(i) ? i : i + "";
99
+ }
100
+ module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
101
+ } });
102
+
103
+ //#endregion
104
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js
105
+ var require_defineProperty = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
106
+ var toPropertyKey = require_toPropertyKey();
107
+ function _defineProperty(e, r, t) {
108
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
109
+ value: t,
110
+ enumerable: !0,
111
+ configurable: !0,
112
+ writable: !0
113
+ }) : e[r] = t, e;
114
+ }
115
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
116
+ } });
117
+
118
+ //#endregion
119
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js
120
+ var require_objectSpread2 = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
121
+ var defineProperty = require_defineProperty();
122
+ function ownKeys(e, r) {
123
+ var t = Object.keys(e);
124
+ if (Object.getOwnPropertySymbols) {
125
+ var o = Object.getOwnPropertySymbols(e);
126
+ r && (o = o.filter(function(r$1) {
127
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
128
+ })), t.push.apply(t, o);
129
+ }
130
+ return t;
131
+ }
132
+ function _objectSpread2(e) {
133
+ for (var r = 1; r < arguments.length; r++) {
134
+ var t = null != arguments[r] ? arguments[r] : {};
135
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
136
+ defineProperty(e, r$1, t[r$1]);
137
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
138
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
139
+ });
140
+ }
141
+ return e;
142
+ }
143
+ module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
144
+ } });
145
+
146
+ //#endregion
147
+ //#region src/internals/getQueryKey.ts
148
+ var import_objectWithoutProperties = __toESM(require_objectWithoutProperties(), 1);
149
+ var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
150
+ const _excluded = ["cursor", "direction"];
151
+ /**
152
+ * To allow easy interactions with groups of related queries, such as
153
+ * invalidating all queries of a router, we use an array as the path when
154
+ * storing in tanstack query.
155
+ **/
156
+ function getQueryKeyInternal(path, input, type) {
157
+ const splitPath = path.flatMap((part) => part.split("."));
158
+ if (!input && (!type || type === "any")) return splitPath.length ? [splitPath] : [];
159
+ if (type === "infinite" && (0, __trpc_server_unstable_core_do_not_import.isObject)(input) && ("direction" in input || "cursor" in input)) {
160
+ const { cursor: _, direction: __ } = input, inputWithoutCursorAndDirection = (0, import_objectWithoutProperties.default)(input, _excluded);
161
+ return [splitPath, {
162
+ input: inputWithoutCursorAndDirection,
163
+ type: "infinite"
164
+ }];
165
+ }
166
+ return [splitPath, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, typeof input !== "undefined" && input !== __tanstack_react_query.skipToken && { input }), type && type !== "any" && { type })];
167
+ }
168
+ function getMutationKeyInternal(path) {
169
+ return getQueryKeyInternal(path, void 0, "any");
170
+ }
171
+ /**
172
+ * Method to extract the query key for a procedure
173
+ * @param procedureOrRouter - procedure or AnyRouter
174
+ * @param input - input to procedureOrRouter
175
+ * @param type - defaults to `any`
176
+ * @see https://trpc.io/docs/v11/getQueryKey
177
+ */
178
+ function getQueryKey(procedureOrRouter, ..._params) {
179
+ const [input, type] = _params;
180
+ const path = procedureOrRouter._def().path;
181
+ const queryKey = getQueryKeyInternal(path, input, type !== null && type !== void 0 ? type : "any");
182
+ return queryKey;
183
+ }
184
+ /**
185
+ * Method to extract the mutation key for a procedure
186
+ * @param procedure - procedure
187
+ * @see https://trpc.io/docs/v11/getQueryKey#mutations
188
+ */
189
+ function getMutationKey(procedure) {
190
+ const path = procedure._def().path;
191
+ return getMutationKeyInternal(path);
192
+ }
193
+
194
+ //#endregion
195
+ Object.defineProperty(exports, '__commonJS', {
196
+ enumerable: true,
197
+ get: function () {
198
+ return __commonJS;
199
+ }
200
+ });
201
+ Object.defineProperty(exports, '__toESM', {
202
+ enumerable: true,
203
+ get: function () {
204
+ return __toESM;
205
+ }
206
+ });
207
+ Object.defineProperty(exports, 'getMutationKey', {
208
+ enumerable: true,
209
+ get: function () {
210
+ return getMutationKey;
211
+ }
212
+ });
213
+ Object.defineProperty(exports, 'getMutationKeyInternal', {
214
+ enumerable: true,
215
+ get: function () {
216
+ return getMutationKeyInternal;
217
+ }
218
+ });
219
+ Object.defineProperty(exports, 'getQueryKey', {
220
+ enumerable: true,
221
+ get: function () {
222
+ return getQueryKey;
223
+ }
224
+ });
225
+ Object.defineProperty(exports, 'getQueryKeyInternal', {
226
+ enumerable: true,
227
+ get: function () {
228
+ return getQueryKeyInternal;
229
+ }
230
+ });
231
+ Object.defineProperty(exports, 'require_objectSpread2', {
232
+ enumerable: true,
233
+ get: function () {
234
+ return require_objectSpread2;
235
+ }
236
+ });
237
+ Object.defineProperty(exports, 'require_objectWithoutProperties', {
238
+ enumerable: true,
239
+ get: function () {
240
+ return require_objectWithoutProperties;
241
+ }
242
+ });
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_getQueryKey = require('./getQueryKey-CP8onRYT.cjs');
2
- const require_shared = require('./shared-Doe-Gsbv.cjs');
1
+ const require_getQueryKey = require('./getQueryKey-PyKLS56S.cjs');
2
+ const require_shared = require('./shared-Dt4RsQVp.cjs');
3
3
  const __trpc_server_unstable_core_do_not_import = require_getQueryKey.__toESM(require("@trpc/server/unstable-core-do-not-import"));
4
4
  const react = require_getQueryKey.__toESM(require("react"));
5
5
 
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { getMutationKey, getQueryKey } from "./getQueryKey-Dekty44G.mjs";
2
- import { createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUtilityFunctions } from "./shared-CMPBsqju.mjs";
1
+ import { getMutationKey, getQueryKey } from "./getQueryKey-BY58RNzP.mjs";
2
+ import { createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUtilityFunctions } from "./shared-JtnEvJvB.mjs";
3
3
  import { createFlatProxy } from "@trpc/server/unstable-core-do-not-import";
4
4
  import * as React from "react";
5
5
 
package/dist/rsc.cjs CHANGED
@@ -1,10 +1,11 @@
1
- const require_getQueryKey = require('./getQueryKey-CP8onRYT.cjs');
1
+ const require_getQueryKey = require('./getQueryKey-PyKLS56S.cjs');
2
2
  const __tanstack_react_query = require_getQueryKey.__toESM(require("@tanstack/react-query"));
3
3
  const __trpc_server_unstable_core_do_not_import = require_getQueryKey.__toESM(require("@trpc/server/unstable-core-do-not-import"));
4
4
  const react = require_getQueryKey.__toESM(require("react"));
5
5
  const react_jsx_runtime = require_getQueryKey.__toESM(require("react/jsx-runtime"));
6
6
 
7
7
  //#region src/rsc.tsx
8
+ var import_objectSpread2 = require_getQueryKey.__toESM(require_getQueryKey.require_objectSpread2());
8
9
  const HELPERS = ["prefetch", "prefetchInfinite"];
9
10
  /**
10
11
  * @note This requires `@tanstack/react-query@^5.49.0`
@@ -35,20 +36,19 @@ function createHydrationHelpers(caller, getQueryClient) {
35
36
  const helper = path.pop();
36
37
  if (helper === "prefetch") {
37
38
  const args1 = args[1];
38
- return getQueryClient().prefetchQuery({
39
- ...args1,
39
+ return getQueryClient().prefetchQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, args1), {}, {
40
40
  queryKey: require_getQueryKey.getQueryKeyInternal(path, input, "query"),
41
41
  queryFn: () => promise
42
- });
42
+ }));
43
43
  }
44
44
  if (helper === "prefetchInfinite") {
45
+ var _args1$initialCursor;
45
46
  const args1 = args[1];
46
- return getQueryClient().prefetchInfiniteQuery({
47
- ...args1,
47
+ return getQueryClient().prefetchInfiniteQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, args1), {}, {
48
48
  queryKey: require_getQueryKey.getQueryKeyInternal(path, input, "infinite"),
49
49
  queryFn: () => promise,
50
- initialPageParam: args1?.initialCursor ?? null
51
- });
50
+ initialPageParam: (_args1$initialCursor = args1 === null || args1 === void 0 ? void 0 : args1.initialCursor) !== null && _args1$initialCursor !== void 0 ? _args1$initialCursor : null
51
+ }));
52
52
  }
53
53
  return promise;
54
54
  });
package/dist/rsc.mjs CHANGED
@@ -1,10 +1,11 @@
1
- import { getQueryKeyInternal } from "./getQueryKey-Dekty44G.mjs";
1
+ import { __toESM, getQueryKeyInternal, require_objectSpread2 } from "./getQueryKey-BY58RNzP.mjs";
2
2
  import { HydrationBoundary, dehydrate } from "@tanstack/react-query";
3
3
  import { createRecursiveProxy } from "@trpc/server/unstable-core-do-not-import";
4
4
  import "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/rsc.tsx
8
+ var import_objectSpread2 = __toESM(require_objectSpread2());
8
9
  const HELPERS = ["prefetch", "prefetchInfinite"];
9
10
  /**
10
11
  * @note This requires `@tanstack/react-query@^5.49.0`
@@ -35,20 +36,19 @@ function createHydrationHelpers(caller, getQueryClient) {
35
36
  const helper = path.pop();
36
37
  if (helper === "prefetch") {
37
38
  const args1 = args[1];
38
- return getQueryClient().prefetchQuery({
39
- ...args1,
39
+ return getQueryClient().prefetchQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, args1), {}, {
40
40
  queryKey: getQueryKeyInternal(path, input, "query"),
41
41
  queryFn: () => promise
42
- });
42
+ }));
43
43
  }
44
44
  if (helper === "prefetchInfinite") {
45
+ var _args1$initialCursor;
45
46
  const args1 = args[1];
46
- return getQueryClient().prefetchInfiniteQuery({
47
- ...args1,
47
+ return getQueryClient().prefetchInfiniteQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, args1), {}, {
48
48
  queryKey: getQueryKeyInternal(path, input, "infinite"),
49
49
  queryFn: () => promise,
50
- initialPageParam: args1?.initialCursor ?? null
51
- });
50
+ initialPageParam: (_args1$initialCursor = args1 === null || args1 === void 0 ? void 0 : args1.initialCursor) !== null && _args1$initialCursor !== void 0 ? _args1$initialCursor : null
51
+ }));
52
52
  }
53
53
  return promise;
54
54
  });
package/dist/rsc.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.mjs","names":["caller: AnyRouter extends TRouter\n ? TypeError<'Generic parameter missing in `createHydrationHelpers<HERE>`'>\n : Caller<TRouter>","getQueryClient: () => QueryClient","props: { children: React.ReactNode }"],"sources":["../src/rsc.tsx"],"sourcesContent":["/// <reference types=\"react/canary\" />\n\nimport {\n dehydrate,\n HydrationBoundary,\n type QueryClient,\n} from '@tanstack/react-query';\nimport type { TRPCClientError } from '@trpc/client';\nimport type { inferTransformedProcedureOutput } from '@trpc/server';\nimport {\n createRecursiveProxy,\n type AnyRouter,\n type inferProcedureInput,\n type RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport type {\n AnyProcedure,\n AnyRootTypes,\n inferProcedureOutput,\n inferRouterRootTypes,\n Maybe,\n RouterCaller,\n TypeError,\n} from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport { getQueryKeyInternal } from './internals/getQueryKey';\nimport type {\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n} from './shared';\n\nconst HELPERS = ['prefetch', 'prefetchInfinite'];\n\ntype DecorateProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyProcedure,\n> = {\n (\n input: inferProcedureInput<TProcedure>,\n ): Promise<inferProcedureOutput<TProcedure>>;\n prefetch: (\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ) => Promise<void>;\n prefetchInfinite: (\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput<TProcedure>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ) => Promise<void>;\n};\n\ntype DecorateRouterRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyProcedure\n ? DecorateProcedure<TRoot, $Value>\n : $Value extends RouterRecord\n ? DecorateRouterRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype Caller<TRouter extends AnyRouter> = ReturnType<\n RouterCaller<inferRouterRootTypes<TRouter>, TRouter['_def']['record']>\n>;\n\n// ts-prune-ignore-next\n/**\n * @note This requires `@tanstack/react-query@^5.49.0`\n * @note Make sure to have `dehydrate.serializeData` and `hydrate.deserializeData`\n * set to your data transformer in your `QueryClient` factory.\n * @example\n * ```ts\n * export const createQueryClient = () =>\n * new QueryClient({\n * defaultOptions: {\n * dehydrate: {\n * serializeData: transformer.serialize,\n * },\n * hydrate: {\n * deserializeData: transformer.deserialize,\n * },\n * },\n * });\n * ```\n */\nexport function createHydrationHelpers<TRouter extends AnyRouter>(\n caller: AnyRouter extends TRouter\n ? TypeError<'Generic parameter missing in `createHydrationHelpers<HERE>`'>\n : Caller<TRouter>,\n getQueryClient: () => QueryClient,\n) {\n type RootTypes = inferRouterRootTypes<TRouter>;\n\n const wrappedProxy = createRecursiveProxy<\n DecorateRouterRecord<RootTypes, TRouter['_def']['record']>\n >(async (opts) => {\n const path = [...opts.path];\n const args = [...opts.args];\n const proc = path.reduce(\n (acc, key) =>\n // @ts-expect-error - ??\n HELPERS.includes(key) ? acc : acc[key],\n caller,\n ) as unknown as DecorateProcedure<RootTypes, AnyProcedure>;\n\n const input = args[0];\n const promise = proc(input);\n\n const helper = path.pop();\n if (helper === 'prefetch') {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n\n return getQueryClient().prefetchQuery({\n ...args1,\n queryKey: getQueryKeyInternal(path, input, 'query'),\n queryFn: () => promise,\n });\n }\n if (helper === 'prefetchInfinite') {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n\n return getQueryClient().prefetchInfiniteQuery({\n ...args1,\n queryKey: getQueryKeyInternal(path, input, 'infinite'),\n queryFn: () => promise,\n initialPageParam: args1?.initialCursor ?? null,\n });\n }\n\n return promise;\n });\n\n function HydrateClient(props: { children: React.ReactNode }) {\n const dehydratedState = dehydrate(getQueryClient());\n\n return (\n <HydrationBoundary state={dehydratedState}>\n {props.children}\n </HydrationBoundary>\n );\n }\n\n return {\n /***\n * Wrapped caller with prefetch helpers\n * Can be used as a regular [server-side caller](https://trpc.io/docs/server/server-side-calls)\n * or using prefetch helpers to put the promise into the QueryClient cache\n * @example\n * ```ts\n * const data = await trpc.post.get(\"postId\");\n *\n * // or\n * void trpc.post.get.prefetch(\"postId\");\n * ```\n */\n trpc: wrappedProxy,\n /**\n * HoC to hydrate the query client for a client component\n * to pick up the prefetched promise and skip an initial\n * client-side fetch.\n * @example\n * ```tsx\n * // MyRSC.tsx\n * const MyRSC = ({ params }) => {\n * void trpc.post.get.prefetch(params.postId);\n *\n * return (\n * <HydrateClient>\n * <MyCC postId={params.postId} />\n * </HydrateClient>\n * );\n * };\n *\n * // MyCC.tsx\n * \"use client\"\n * const MyCC = ({ postId }) => {\n * const { data: post } = trpc.post.get.useQuery(postId);\n * return <div>{post.title}</div>;\n * };\n * ```\n */\n HydrateClient,\n };\n}\n"],"mappings":";;;;;;;AA+BA,MAAM,UAAU,CAAC,YAAY,kBAAmB;;;;;;;;;;;;;;;;;;;;AA+DhD,SAAgB,uBACdA,QAGAC,gBACA;CAGA,MAAM,eAAe,qBAEnB,OAAO,SAAS;EAChB,MAAM,OAAO,CAAC,GAAG,KAAK,IAAK;EAC3B,MAAM,OAAO,CAAC,GAAG,KAAK,IAAK;EAC3B,MAAM,OAAO,KAAK,OAChB,CAAC,KAAK,QAEJ,QAAQ,SAAS,IAAI,GAAG,MAAM,IAAI,MACpC,OACD;EAED,MAAM,QAAQ,KAAK;EACnB,MAAM,UAAU,KAAK,MAAM;EAE3B,MAAM,SAAS,KAAK,KAAK;AACzB,MAAI,WAAW,YAAY;GACzB,MAAM,QAAQ,KAAK;AAInB,UAAO,gBAAgB,CAAC,cAAc;IACpC,GAAG;IACH,UAAU,oBAAoB,MAAM,OAAO,QAAQ;IACnD,SAAS,MAAM;GAChB,EAAC;EACH;AACD,MAAI,WAAW,oBAAoB;GACjC,MAAM,QAAQ,KAAK;AAInB,UAAO,gBAAgB,CAAC,sBAAsB;IAC5C,GAAG;IACH,UAAU,oBAAoB,MAAM,OAAO,WAAW;IACtD,SAAS,MAAM;IACf,kBAAkB,OAAO,iBAAiB;GAC3C,EAAC;EACH;AAED,SAAO;CACR,EAAC;CAEF,SAAS,cAAcC,OAAsC;EAC3D,MAAM,kBAAkB,UAAU,gBAAgB,CAAC;AAEnD,yBACE,IAAC;GAAkB,OAAO;aACvB,MAAM;IACW;CAEvB;AAED,QAAO;EAaL,MAAM;EA0BN;CACD;AACF"}
1
+ {"version":3,"file":"rsc.mjs","names":["caller: AnyRouter extends TRouter\n ? TypeError<'Generic parameter missing in `createHydrationHelpers<HERE>`'>\n : Caller<TRouter>","getQueryClient: () => QueryClient","props: { children: React.ReactNode }"],"sources":["../src/rsc.tsx"],"sourcesContent":["/// <reference types=\"react/canary\" />\n\nimport {\n dehydrate,\n HydrationBoundary,\n type QueryClient,\n} from '@tanstack/react-query';\nimport type { TRPCClientError } from '@trpc/client';\nimport type { inferTransformedProcedureOutput } from '@trpc/server';\nimport {\n createRecursiveProxy,\n type AnyRouter,\n type inferProcedureInput,\n type RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport type {\n AnyProcedure,\n AnyRootTypes,\n inferProcedureOutput,\n inferRouterRootTypes,\n Maybe,\n RouterCaller,\n TypeError,\n} from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport { getQueryKeyInternal } from './internals/getQueryKey';\nimport type {\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n} from './shared';\n\nconst HELPERS = ['prefetch', 'prefetchInfinite'];\n\ntype DecorateProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyProcedure,\n> = {\n (\n input: inferProcedureInput<TProcedure>,\n ): Promise<inferProcedureOutput<TProcedure>>;\n prefetch: (\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ) => Promise<void>;\n prefetchInfinite: (\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput<TProcedure>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ) => Promise<void>;\n};\n\ntype DecorateRouterRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyProcedure\n ? DecorateProcedure<TRoot, $Value>\n : $Value extends RouterRecord\n ? DecorateRouterRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype Caller<TRouter extends AnyRouter> = ReturnType<\n RouterCaller<inferRouterRootTypes<TRouter>, TRouter['_def']['record']>\n>;\n\n// ts-prune-ignore-next\n/**\n * @note This requires `@tanstack/react-query@^5.49.0`\n * @note Make sure to have `dehydrate.serializeData` and `hydrate.deserializeData`\n * set to your data transformer in your `QueryClient` factory.\n * @example\n * ```ts\n * export const createQueryClient = () =>\n * new QueryClient({\n * defaultOptions: {\n * dehydrate: {\n * serializeData: transformer.serialize,\n * },\n * hydrate: {\n * deserializeData: transformer.deserialize,\n * },\n * },\n * });\n * ```\n */\nexport function createHydrationHelpers<TRouter extends AnyRouter>(\n caller: AnyRouter extends TRouter\n ? TypeError<'Generic parameter missing in `createHydrationHelpers<HERE>`'>\n : Caller<TRouter>,\n getQueryClient: () => QueryClient,\n) {\n type RootTypes = inferRouterRootTypes<TRouter>;\n\n const wrappedProxy = createRecursiveProxy<\n DecorateRouterRecord<RootTypes, TRouter['_def']['record']>\n >(async (opts) => {\n const path = [...opts.path];\n const args = [...opts.args];\n const proc = path.reduce(\n (acc, key) =>\n // @ts-expect-error - ??\n HELPERS.includes(key) ? acc : acc[key],\n caller,\n ) as unknown as DecorateProcedure<RootTypes, AnyProcedure>;\n\n const input = args[0];\n const promise = proc(input);\n\n const helper = path.pop();\n if (helper === 'prefetch') {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n\n return getQueryClient().prefetchQuery({\n ...args1,\n queryKey: getQueryKeyInternal(path, input, 'query'),\n queryFn: () => promise,\n });\n }\n if (helper === 'prefetchInfinite') {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n\n return getQueryClient().prefetchInfiniteQuery({\n ...args1,\n queryKey: getQueryKeyInternal(path, input, 'infinite'),\n queryFn: () => promise,\n initialPageParam: args1?.initialCursor ?? null,\n });\n }\n\n return promise;\n });\n\n function HydrateClient(props: { children: React.ReactNode }) {\n const dehydratedState = dehydrate(getQueryClient());\n\n return (\n <HydrationBoundary state={dehydratedState}>\n {props.children}\n </HydrationBoundary>\n );\n }\n\n return {\n /***\n * Wrapped caller with prefetch helpers\n * Can be used as a regular [server-side caller](https://trpc.io/docs/server/server-side-calls)\n * or using prefetch helpers to put the promise into the QueryClient cache\n * @example\n * ```ts\n * const data = await trpc.post.get(\"postId\");\n *\n * // or\n * void trpc.post.get.prefetch(\"postId\");\n * ```\n */\n trpc: wrappedProxy,\n /**\n * HoC to hydrate the query client for a client component\n * to pick up the prefetched promise and skip an initial\n * client-side fetch.\n * @example\n * ```tsx\n * // MyRSC.tsx\n * const MyRSC = ({ params }) => {\n * void trpc.post.get.prefetch(params.postId);\n *\n * return (\n * <HydrateClient>\n * <MyCC postId={params.postId} />\n * </HydrateClient>\n * );\n * };\n *\n * // MyCC.tsx\n * \"use client\"\n * const MyCC = ({ postId }) => {\n * const { data: post } = trpc.post.get.useQuery(postId);\n * return <div>{post.title}</div>;\n * };\n * ```\n */\n HydrateClient,\n };\n}\n"],"mappings":";;;;;;;;AA+BA,MAAM,UAAU,CAAC,YAAY,kBAAmB;;;;;;;;;;;;;;;;;;;;AA+DhD,SAAgB,uBACdA,QAGAC,gBACA;CAGA,MAAM,eAAe,qBAEnB,OAAO,SAAS;EAChB,MAAM,OAAO,CAAC,GAAG,KAAK,IAAK;EAC3B,MAAM,OAAO,CAAC,GAAG,KAAK,IAAK;EAC3B,MAAM,OAAO,KAAK,OAChB,CAAC,KAAK,QAEJ,QAAQ,SAAS,IAAI,GAAG,MAAM,IAAI,MACpC,OACD;EAED,MAAM,QAAQ,KAAK;EACnB,MAAM,UAAU,KAAK,MAAM;EAE3B,MAAM,SAAS,KAAK,KAAK;AACzB,MAAI,WAAW,YAAY;GACzB,MAAM,QAAQ,KAAK;AAInB,UAAO,gBAAgB,CAAC,sFACnB;IACH,UAAU,oBAAoB,MAAM,OAAO,QAAQ;IACnD,SAAS,MAAM;MACf;EACH;AACD,MAAI,WAAW,oBAAoB;;GACjC,MAAM,QAAQ,KAAK;AAInB,UAAO,gBAAgB,CAAC,8FACnB;IACH,UAAU,oBAAoB,MAAM,OAAO,WAAW;IACtD,SAAS,MAAM;IACf,wFAAkB,MAAO,oFAAiB;MAC1C;EACH;AAED,SAAO;CACR,EAAC;CAEF,SAAS,cAAcC,OAAsC;EAC3D,MAAM,kBAAkB,UAAU,gBAAgB,CAAC;AAEnD,yBACE,IAAC;GAAkB,OAAO;aACvB,MAAM;IACW;CAEvB;AAED,QAAO;EAaL,MAAM;EA0BN;CACD;AACF"}