@trpc/tanstack-react-query 11.18.1-canary.2 → 11.18.1-canary.34.sha-3a77dc4d6

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/index.cjs CHANGED
@@ -1,13 +1,11 @@
1
- //#region rolldown:runtime
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  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
9
  var __copyProps = (to, from, except, desc) => {
12
10
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
11
  key = keys[i];
@@ -18,194 +16,150 @@ var __copyProps = (to, from, except, desc) => {
18
16
  }
19
17
  return to;
20
18
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
22
20
  value: mod,
23
21
  enumerable: true
24
22
  }) : target, mod));
25
-
26
23
  //#endregion
27
- const react = __toESM(require("react"));
28
- const __trpc_client = __toESM(require("@trpc/client"));
29
- const __trpc_server = __toESM(require("@trpc/server"));
30
- const __tanstack_react_query = __toESM(require("@tanstack/react-query"));
31
- const __trpc_server_unstable_core_do_not_import = __toESM(require("@trpc/server/unstable-core-do-not-import"));
32
- const react_jsx_runtime = __toESM(require("react/jsx-runtime"));
33
-
34
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js
35
- var require_typeof = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
36
- function _typeof$2(o) {
37
- "@babel/helpers - typeof";
38
- return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
39
- return typeof o$1;
40
- } : function(o$1) {
41
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
42
- }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
43
- }
44
- module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
45
- } });
46
-
24
+ let react = require("react");
25
+ react = __toESM(react, 1);
26
+ let _trpc_client = require("@trpc/client");
27
+ let _trpc_server = require("@trpc/server");
28
+ let _tanstack_react_query = require("@tanstack/react-query");
29
+ let _trpc_server_unstable_core_do_not_import = require("@trpc/server/unstable-core-do-not-import");
30
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
31
+ function _typeof(o) {
32
+ "@babel/helpers - typeof";
33
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
34
+ return typeof o;
35
+ } : function(o) {
36
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
37
+ }, _typeof(o);
38
+ }
47
39
  //#endregion
48
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js
49
- var require_toPrimitive = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
50
- var _typeof$1 = require_typeof()["default"];
51
- function toPrimitive$1(t, r) {
52
- if ("object" != _typeof$1(t) || !t) return t;
53
- var e = t[Symbol.toPrimitive];
54
- if (void 0 !== e) {
55
- var i = e.call(t, r || "default");
56
- if ("object" != _typeof$1(i)) return i;
57
- throw new TypeError("@@toPrimitive must return a primitive value.");
58
- }
59
- return ("string" === r ? String : Number)(t);
40
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
41
+ function toPrimitive(t, r) {
42
+ if ("object" != _typeof(t) || !t) return t;
43
+ var e = t[Symbol.toPrimitive];
44
+ if (void 0 !== e) {
45
+ var i = e.call(t, r || "default");
46
+ if ("object" != _typeof(i)) return i;
47
+ throw new TypeError("@@toPrimitive must return a primitive value.");
60
48
  }
61
- module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
62
- } });
63
-
49
+ return ("string" === r ? String : Number)(t);
50
+ }
64
51
  //#endregion
65
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js
66
- var require_toPropertyKey = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
67
- var _typeof = require_typeof()["default"];
68
- var toPrimitive = require_toPrimitive();
69
- function toPropertyKey$1(t) {
70
- var i = toPrimitive(t, "string");
71
- return "symbol" == _typeof(i) ? i : i + "";
72
- }
73
- module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
74
- } });
75
-
52
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
53
+ function toPropertyKey(t) {
54
+ var i = toPrimitive(t, "string");
55
+ return "symbol" == _typeof(i) ? i : i + "";
56
+ }
76
57
  //#endregion
77
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js
78
- var require_defineProperty = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
79
- var toPropertyKey = require_toPropertyKey();
80
- function _defineProperty(e, r, t) {
81
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
82
- value: t,
83
- enumerable: !0,
84
- configurable: !0,
85
- writable: !0
86
- }) : e[r] = t, e;
87
- }
88
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
89
- } });
90
-
58
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
59
+ function _defineProperty(e, r, t) {
60
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
61
+ value: t,
62
+ enumerable: !0,
63
+ configurable: !0,
64
+ writable: !0
65
+ }) : e[r] = t, e;
66
+ }
91
67
  //#endregion
92
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js
93
- var require_objectSpread2 = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
94
- var defineProperty = require_defineProperty();
95
- function ownKeys(e, r) {
96
- var t = Object.keys(e);
97
- if (Object.getOwnPropertySymbols) {
98
- var o = Object.getOwnPropertySymbols(e);
99
- r && (o = o.filter(function(r$1) {
100
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
101
- })), t.push.apply(t, o);
102
- }
103
- return t;
68
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectSpread2.js
69
+ function ownKeys(e, r) {
70
+ var t = Object.keys(e);
71
+ if (Object.getOwnPropertySymbols) {
72
+ var o = Object.getOwnPropertySymbols(e);
73
+ r && (o = o.filter(function(r) {
74
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
75
+ })), t.push.apply(t, o);
104
76
  }
105
- function _objectSpread2(e) {
106
- for (var r = 1; r < arguments.length; r++) {
107
- var t = null != arguments[r] ? arguments[r] : {};
108
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
109
- defineProperty(e, r$1, t[r$1]);
110
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
111
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
112
- });
113
- }
114
- return e;
77
+ return t;
78
+ }
79
+ function _objectSpread2(e) {
80
+ for (var r = 1; r < arguments.length; r++) {
81
+ var t = null != arguments[r] ? arguments[r] : {};
82
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
83
+ _defineProperty(e, r, t[r]);
84
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
85
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
86
+ });
115
87
  }
116
- module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
117
- } });
118
-
88
+ return e;
89
+ }
119
90
  //#endregion
120
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js
121
- var require_asyncIterator = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(exports, module) {
122
- function _asyncIterator$1(r) {
123
- var n, t, o, e = 2;
124
- for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
125
- if (t && null != (n = r[t])) return n.call(r);
126
- if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
127
- t = "@@asyncIterator", o = "@@iterator";
128
- }
129
- throw new TypeError("Object is not async iterable");
91
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/asyncIterator.js
92
+ function _asyncIterator(r) {
93
+ var n, t, o, e = 2;
94
+ for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
95
+ if (t && null != (n = r[t])) return n.call(r);
96
+ if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
97
+ t = "@@asyncIterator", o = "@@iterator";
130
98
  }
131
- function AsyncFromSyncIterator(r) {
132
- function AsyncFromSyncIteratorContinuation(r$1) {
133
- if (Object(r$1) !== r$1) return Promise.reject(new TypeError(r$1 + " is not an object."));
134
- var n = r$1.done;
135
- return Promise.resolve(r$1.value).then(function(r$2) {
136
- return {
137
- value: r$2,
138
- done: n
139
- };
140
- });
141
- }
142
- return AsyncFromSyncIterator = function AsyncFromSyncIterator$1(r$1) {
143
- this.s = r$1, this.n = r$1.next;
144
- }, AsyncFromSyncIterator.prototype = {
145
- s: null,
146
- n: null,
147
- next: function next() {
148
- return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
149
- },
150
- "return": function _return(r$1) {
151
- var n = this.s["return"];
152
- return void 0 === n ? Promise.resolve({
153
- value: r$1,
154
- done: !0
155
- }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
156
- },
157
- "throw": function _throw(r$1) {
158
- var n = this.s["return"];
159
- return void 0 === n ? Promise.reject(r$1) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
160
- }
161
- }, new AsyncFromSyncIterator(r);
99
+ throw new TypeError("Object is not async iterable");
100
+ }
101
+ function AsyncFromSyncIterator(r) {
102
+ function AsyncFromSyncIteratorContinuation(r) {
103
+ if (Object(r) !== r) return Promise.reject(/* @__PURE__ */ new TypeError(r + " is not an object."));
104
+ var n = r.done;
105
+ return Promise.resolve(r.value).then(function(r) {
106
+ return {
107
+ value: r,
108
+ done: n
109
+ };
110
+ });
162
111
  }
163
- module.exports = _asyncIterator$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
164
- } });
165
-
166
- //#endregion
167
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js
168
- var require_objectWithoutPropertiesLoose = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
169
- function _objectWithoutPropertiesLoose(r, e) {
170
- if (null == r) return {};
171
- var t = {};
172
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
173
- if (e.includes(n)) continue;
174
- t[n] = r[n];
112
+ return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) {
113
+ this.s = r, this.n = r.next;
114
+ }, AsyncFromSyncIterator.prototype = {
115
+ s: null,
116
+ n: null,
117
+ next: function next() {
118
+ return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
119
+ },
120
+ "return": function _return(r) {
121
+ var n = this.s["return"];
122
+ return void 0 === n ? Promise.resolve({
123
+ value: r,
124
+ done: !0
125
+ }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
126
+ },
127
+ "throw": function _throw(r) {
128
+ var n = this.s["return"];
129
+ return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
175
130
  }
176
- return t;
131
+ }, new AsyncFromSyncIterator(r);
132
+ }
133
+ //#endregion
134
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectWithoutPropertiesLoose.js
135
+ function _objectWithoutPropertiesLoose(r, e) {
136
+ if (null == r) return {};
137
+ var t = {};
138
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
139
+ if (e.includes(n)) continue;
140
+ t[n] = r[n];
177
141
  }
178
- module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
179
- } });
180
-
142
+ return t;
143
+ }
181
144
  //#endregion
182
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js
183
- var require_objectWithoutProperties = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(exports, module) {
184
- var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
185
- function _objectWithoutProperties$1(e, t) {
186
- if (null == e) return {};
187
- var o, r, i = objectWithoutPropertiesLoose(e, t);
188
- if (Object.getOwnPropertySymbols) {
189
- var s = Object.getOwnPropertySymbols(e);
190
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
191
- }
192
- return i;
145
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectWithoutProperties.js
146
+ function _objectWithoutProperties(e, t) {
147
+ if (null == e) return {};
148
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
149
+ if (Object.getOwnPropertySymbols) {
150
+ var s = Object.getOwnPropertySymbols(e);
151
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
193
152
  }
194
- module.exports = _objectWithoutProperties$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
195
- } });
196
-
153
+ return i;
154
+ }
197
155
  //#endregion
198
156
  //#region src/internals/utils.ts
199
- var import_objectSpread2$5 = __toESM(require_objectSpread2(), 1);
200
- var import_asyncIterator = __toESM(require_asyncIterator(), 1);
201
- var import_objectWithoutProperties = __toESM(require_objectWithoutProperties(), 1);
202
157
  const _excluded = ["cursor", "direction"];
203
158
  /**
204
159
  * @internal
205
160
  */
206
161
  function createTRPCOptionsResult(value) {
207
- const path = value.path.join(".");
208
- return { path };
162
+ return { path: value.path.join(".") };
209
163
  }
210
164
  function isPrefixedQueryKey(queryKey) {
211
165
  return queryKey.length >= 3;
@@ -233,7 +187,7 @@ function getClientArgs(queryKey, opts, infiniteParams) {
233
187
  let input = (_queryKeyData$args = queryKeyData.args) === null || _queryKeyData$args === void 0 ? void 0 : _queryKeyData$args.input;
234
188
  if (infiniteParams) {
235
189
  var _queryKeyData$args$in, _queryKeyData$args2;
236
- input = (0, import_objectSpread2$5.default)((0, import_objectSpread2$5.default)((0, import_objectSpread2$5.default)({}, (_queryKeyData$args$in = (_queryKeyData$args2 = queryKeyData.args) === null || _queryKeyData$args2 === void 0 ? void 0 : _queryKeyData$args2.input) !== null && _queryKeyData$args$in !== void 0 ? _queryKeyData$args$in : {}), infiniteParams.pageParam !== void 0 ? { cursor: infiniteParams.pageParam } : {}), {}, { direction: infiniteParams.direction });
190
+ input = _objectSpread2(_objectSpread2(_objectSpread2({}, (_queryKeyData$args$in = (_queryKeyData$args2 = queryKeyData.args) === null || _queryKeyData$args2 === void 0 ? void 0 : _queryKeyData$args2.input) !== null && _queryKeyData$args$in !== void 0 ? _queryKeyData$args$in : {}), infiniteParams.pageParam !== void 0 ? { cursor: infiniteParams.pageParam } : {}), {}, { direction: infiniteParams.direction });
237
191
  }
238
192
  return [
239
193
  queryKeyData.path.join("."),
@@ -245,8 +199,7 @@ function getClientArgs(queryKey, opts, infiniteParams) {
245
199
  * @internal
246
200
  */
247
201
  async function buildQueryFromAsyncIterable(asyncIterable, queryClient, queryKey) {
248
- const queryCache = queryClient.getQueryCache();
249
- const query = queryCache.build(queryClient, { queryKey });
202
+ const query = queryClient.getQueryCache().build(queryClient, { queryKey });
250
203
  query.setState({
251
204
  data: [],
252
205
  status: "success"
@@ -256,12 +209,10 @@ async function buildQueryFromAsyncIterable(asyncIterable, queryClient, queryKey)
256
209
  var _didIteratorError = false;
257
210
  var _iteratorError;
258
211
  try {
259
- for (var _iterator = (0, import_asyncIterator.default)(asyncIterable), _step; _iteratorAbruptCompletion = !(_step = await _iterator.next()).done; _iteratorAbruptCompletion = false) {
212
+ for (var _iterator = _asyncIterator(asyncIterable), _step; _iteratorAbruptCompletion = !(_step = await _iterator.next()).done; _iteratorAbruptCompletion = false) {
260
213
  const value = _step.value;
261
- {
262
- aggregate.push(value);
263
- query.setState({ data: [...aggregate] });
264
- }
214
+ aggregate.push(value);
215
+ query.setState({ data: [...aggregate] });
265
216
  }
266
217
  } catch (err) {
267
218
  _didIteratorError = true;
@@ -283,18 +234,18 @@ async function buildQueryFromAsyncIterable(asyncIterable, queryClient, queryKey)
283
234
  * @internal
284
235
  */
285
236
  function getQueryKeyInternal(opts) {
286
- const key = (0, __trpc_server_unstable_core_do_not_import.run)(() => {
237
+ const key = (0, _trpc_server_unstable_core_do_not_import.run)(() => {
287
238
  const { input, type } = opts;
288
239
  const splitPath = opts.path.flatMap((part) => part.split("."));
289
240
  if (!input && type === "any") return splitPath.length ? [splitPath] : [];
290
- if (type === "infinite" && (0, __trpc_server_unstable_core_do_not_import.isObject)(input) && ("direction" in input || "cursor" in input)) {
291
- const { cursor: _, direction: __ } = input, inputWithoutCursorAndDirection = (0, import_objectWithoutProperties.default)(input, _excluded);
241
+ if (type === "infinite" && (0, _trpc_server_unstable_core_do_not_import.isObject)(input) && ("direction" in input || "cursor" in input)) {
242
+ const { cursor: _, direction: __ } = input;
292
243
  return [splitPath, {
293
- input: inputWithoutCursorAndDirection,
244
+ input: _objectWithoutProperties(input, _excluded),
294
245
  type: "infinite"
295
246
  }];
296
247
  }
297
- return [splitPath, (0, import_objectSpread2$5.default)((0, import_objectSpread2$5.default)({}, typeof input !== "undefined" && input !== __tanstack_react_query.skipToken && { input }), type && type !== "any" && { type })];
248
+ return [splitPath, _objectSpread2(_objectSpread2({}, typeof input !== "undefined" && input !== _tanstack_react_query.skipToken && { input }), type && type !== "any" && { type })];
298
249
  });
299
250
  if (opts.prefix) key.unshift([opts.prefix]);
300
251
  return key;
@@ -311,35 +262,30 @@ function getMutationKeyInternal(opts) {
311
262
  * @internal
312
263
  */
313
264
  function unwrapLazyArg(valueOrLazy) {
314
- return (0, __trpc_server_unstable_core_do_not_import.isFunction)(valueOrLazy) ? valueOrLazy() : valueOrLazy;
265
+ return (0, _trpc_server_unstable_core_do_not_import.isFunction)(valueOrLazy) ? valueOrLazy() : valueOrLazy;
315
266
  }
316
-
317
267
  //#endregion
318
268
  //#region src/internals/infiniteQueryOptions.ts
319
- var import_objectSpread2$4 = __toESM(require_objectSpread2(), 1);
320
269
  function trpcInfiniteQueryOptions(args) {
321
270
  var _opts$initialCursor;
322
271
  const { input, query, path, queryKey, opts } = args;
323
- const inputIsSkipToken = input === __tanstack_react_query.skipToken;
272
+ const inputIsSkipToken = input === _tanstack_react_query.skipToken;
324
273
  const queryFn = async (queryFnContext) => {
325
274
  var _opts$trpc;
326
- const actualOpts = (0, import_objectSpread2$4.default)((0, import_objectSpread2$4.default)({}, opts), {}, { trpc: (0, import_objectSpread2$4.default)((0, import_objectSpread2$4.default)({}, opts === null || opts === void 0 ? void 0 : opts.trpc), (opts === null || opts === void 0 || (_opts$trpc = opts.trpc) === null || _opts$trpc === void 0 ? void 0 : _opts$trpc.abortOnUnmount) ? { signal: queryFnContext.signal } : { signal: null }) });
327
- const result = await query(...getClientArgs(queryKey, actualOpts, {
275
+ const actualOpts = _objectSpread2(_objectSpread2({}, opts), {}, { trpc: _objectSpread2(_objectSpread2({}, opts === null || opts === void 0 ? void 0 : opts.trpc), (opts === null || opts === void 0 || (_opts$trpc = opts.trpc) === null || _opts$trpc === void 0 ? void 0 : _opts$trpc.abortOnUnmount) ? { signal: queryFnContext.signal } : { signal: null }) });
276
+ return await query(...getClientArgs(queryKey, actualOpts, {
328
277
  direction: queryFnContext.direction,
329
278
  pageParam: queryFnContext.pageParam
330
279
  }));
331
- return result;
332
280
  };
333
- return Object.assign((0, __tanstack_react_query.infiniteQueryOptions)((0, import_objectSpread2$4.default)((0, import_objectSpread2$4.default)({}, opts !== null && opts !== void 0 ? opts : {}), {}, {
281
+ return Object.assign((0, _tanstack_react_query.infiniteQueryOptions)(_objectSpread2(_objectSpread2({}, opts !== null && opts !== void 0 ? opts : {}), {}, {
334
282
  queryKey,
335
- queryFn: inputIsSkipToken ? __tanstack_react_query.skipToken : queryFn,
283
+ queryFn: inputIsSkipToken ? _tanstack_react_query.skipToken : queryFn,
336
284
  initialPageParam: (_opts$initialCursor = opts === null || opts === void 0 ? void 0 : opts.initialCursor) !== null && _opts$initialCursor !== void 0 ? _opts$initialCursor : input === null || input === void 0 ? void 0 : input.cursor
337
285
  })), { trpc: createTRPCOptionsResult({ path }) });
338
286
  }
339
-
340
287
  //#endregion
341
288
  //#region src/internals/mutationOptions.ts
342
- var import_objectSpread2$3 = __toESM(require_objectSpread2(), 1);
343
289
  /**
344
290
  * @internal
345
291
  */
@@ -352,19 +298,18 @@ function trpcMutationOptions(args) {
352
298
  prefix: (_opts$keyPrefix = opts === null || opts === void 0 ? void 0 : opts.keyPrefix) !== null && _opts$keyPrefix !== void 0 ? _opts$keyPrefix : prefix
353
299
  });
354
300
  const defaultOpts = queryClient.defaultMutationOptions(queryClient.getMutationDefaults(mutationKey));
355
- const mutationSuccessOverride = (_overrides$onSuccess = overrides === null || overrides === void 0 ? void 0 : overrides.onSuccess) !== null && _overrides$onSuccess !== void 0 ? _overrides$onSuccess : (options) => options.originalFn();
301
+ const mutationSuccessOverride = (_overrides$onSuccess = overrides === null || overrides === void 0 ? void 0 : overrides.onSuccess) !== null && _overrides$onSuccess !== void 0 ? _overrides$onSuccess : ((options) => options.originalFn());
356
302
  const mutationFn = async (input) => {
357
- const result = await mutate(...getClientArgs([...mutationKey, { input }], opts));
358
- return result;
303
+ return await mutate(...getClientArgs([...mutationKey, { input }], opts));
359
304
  };
360
- return (0, import_objectSpread2$3.default)((0, import_objectSpread2$3.default)({}, opts), {}, {
305
+ return _objectSpread2(_objectSpread2({}, opts), {}, {
361
306
  mutationKey,
362
307
  mutationFn,
363
- onSuccess(...args$1) {
308
+ onSuccess(...args) {
364
309
  var _ref, _opts$meta;
365
310
  const originalFn = () => {
366
311
  var _opts$onSuccess, _opts$onSuccess2, _defaultOpts$onSucces;
367
- return (_opts$onSuccess = opts === null || opts === void 0 || (_opts$onSuccess2 = opts.onSuccess) === null || _opts$onSuccess2 === void 0 ? void 0 : _opts$onSuccess2.call(opts, ...args$1)) !== null && _opts$onSuccess !== void 0 ? _opts$onSuccess : defaultOpts === null || defaultOpts === void 0 || (_defaultOpts$onSucces = defaultOpts.onSuccess) === null || _defaultOpts$onSucces === void 0 ? void 0 : _defaultOpts$onSucces.call(defaultOpts, ...args$1);
312
+ return (_opts$onSuccess = opts === null || opts === void 0 || (_opts$onSuccess2 = opts.onSuccess) === null || _opts$onSuccess2 === void 0 ? void 0 : _opts$onSuccess2.call(opts, ...args)) !== null && _opts$onSuccess !== void 0 ? _opts$onSuccess : defaultOpts === null || defaultOpts === void 0 || (_defaultOpts$onSucces = defaultOpts.onSuccess) === null || _defaultOpts$onSucces === void 0 ? void 0 : _defaultOpts$onSucces.call(defaultOpts, ...args);
368
313
  };
369
314
  return mutationSuccessOverride({
370
315
  originalFn,
@@ -375,46 +320,40 @@ function trpcMutationOptions(args) {
375
320
  trpc: createTRPCOptionsResult({ path })
376
321
  });
377
322
  }
378
-
379
323
  //#endregion
380
324
  //#region src/internals/queryOptions.ts
381
- var import_objectSpread2$2 = __toESM(require_objectSpread2(), 1);
382
325
  /**
383
326
  * @internal
384
327
  */
385
328
  function trpcQueryOptions(args) {
386
329
  const { input, query, path, queryKey, opts } = args;
387
330
  const queryClient = unwrapLazyArg(args.queryClient);
388
- const inputIsSkipToken = input === __tanstack_react_query.skipToken;
331
+ const inputIsSkipToken = input === _tanstack_react_query.skipToken;
389
332
  const queryFn = async (queryFnContext) => {
390
333
  var _opts$trpc;
391
- const actualOpts = (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, opts), {}, { trpc: (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, opts === null || opts === void 0 ? void 0 : opts.trpc), (opts === null || opts === void 0 || (_opts$trpc = opts.trpc) === null || _opts$trpc === void 0 ? void 0 : _opts$trpc.abortOnUnmount) ? { signal: queryFnContext.signal } : { signal: null }) });
392
- const queryKey$1 = queryFnContext.queryKey;
393
- const result = await query(...getClientArgs(queryKey$1, actualOpts));
394
- if ((0, __trpc_server_unstable_core_do_not_import.isAsyncIterable)(result)) return buildQueryFromAsyncIterable(result, queryClient, queryKey$1);
334
+ const actualOpts = _objectSpread2(_objectSpread2({}, opts), {}, { trpc: _objectSpread2(_objectSpread2({}, opts === null || opts === void 0 ? void 0 : opts.trpc), (opts === null || opts === void 0 || (_opts$trpc = opts.trpc) === null || _opts$trpc === void 0 ? void 0 : _opts$trpc.abortOnUnmount) ? { signal: queryFnContext.signal } : { signal: null }) });
335
+ const queryKey = queryFnContext.queryKey;
336
+ const result = await query(...getClientArgs(queryKey, actualOpts));
337
+ if ((0, _trpc_server_unstable_core_do_not_import.isAsyncIterable)(result)) return buildQueryFromAsyncIterable(result, queryClient, queryKey);
395
338
  return result;
396
339
  };
397
- return Object.assign((0, __tanstack_react_query.queryOptions)((0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, opts), {}, {
340
+ return Object.assign((0, _tanstack_react_query.queryOptions)(_objectSpread2(_objectSpread2({}, opts), {}, {
398
341
  queryKey,
399
- queryFn: inputIsSkipToken ? __tanstack_react_query.skipToken : queryFn
342
+ queryFn: inputIsSkipToken ? _tanstack_react_query.skipToken : queryFn
400
343
  })), { trpc: createTRPCOptionsResult({ path }) });
401
344
  }
402
-
403
345
  //#endregion
404
346
  //#region src/internals/subscriptionOptions.ts
405
- var import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);
406
347
  /**
407
348
  * @internal
408
349
  */
409
350
  const trpcSubscriptionOptions = (args) => {
410
- var _readQueryKey;
411
- const { subscribe, path, queryKey, opts = {} } = args;
412
- const input = (_readQueryKey = readQueryKey(queryKey)) === null || _readQueryKey === void 0 || (_readQueryKey = _readQueryKey.args) === null || _readQueryKey === void 0 ? void 0 : _readQueryKey.input;
413
- const enabled = "enabled" in opts ? !!opts.enabled : input !== __tanstack_react_query.skipToken;
351
+ const { subscribe, path, queryKey, input, opts = {} } = args;
352
+ const enabled = "enabled" in opts ? !!opts.enabled : input !== _tanstack_react_query.skipToken;
414
353
  const _subscribe = (innerOpts) => {
415
- return subscribe(path.join("."), input !== null && input !== void 0 ? input : void 0, innerOpts);
354
+ return subscribe(path.join("."), input === _tanstack_react_query.skipToken ? void 0 : input, innerOpts);
416
355
  };
417
- return (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts), {}, {
356
+ return _objectSpread2(_objectSpread2({}, opts), {}, {
418
357
  enabled,
419
358
  subscribe: _subscribe,
420
359
  queryKey,
@@ -424,7 +363,7 @@ const trpcSubscriptionOptions = (args) => {
424
363
  function useSubscription(opts) {
425
364
  const optsRef = react.useRef(opts);
426
365
  optsRef.current = opts;
427
- const trackedProps = react.useRef(new Set([]));
366
+ const trackedProps = react.useRef(/* @__PURE__ */ new Set([]));
428
367
  const addTrackedProp = react.useCallback((key) => {
429
368
  trackedProps.current.add(key);
430
369
  }, []);
@@ -438,7 +377,7 @@ function useSubscription(opts) {
438
377
  onStarted: () => {
439
378
  var _optsRef$current$onSt, _optsRef$current;
440
379
  (_optsRef$current$onSt = (_optsRef$current = optsRef.current).onStarted) === null || _optsRef$current$onSt === void 0 || _optsRef$current$onSt.call(_optsRef$current);
441
- updateState((prev) => (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, prev), {}, {
380
+ updateState((prev) => _objectSpread2(_objectSpread2({}, prev), {}, {
442
381
  status: "pending",
443
382
  error: null
444
383
  }));
@@ -446,7 +385,7 @@ function useSubscription(opts) {
446
385
  onData: (data) => {
447
386
  var _optsRef$current$onDa, _optsRef$current2;
448
387
  (_optsRef$current$onDa = (_optsRef$current2 = optsRef.current).onData) === null || _optsRef$current$onDa === void 0 || _optsRef$current$onDa.call(_optsRef$current2, data);
449
- updateState((prev) => (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, prev), {}, {
388
+ updateState((prev) => _objectSpread2(_objectSpread2({}, prev), {}, {
450
389
  status: "pending",
451
390
  data,
452
391
  error: null
@@ -455,7 +394,7 @@ function useSubscription(opts) {
455
394
  onError: (error) => {
456
395
  var _optsRef$current$onEr, _optsRef$current3;
457
396
  (_optsRef$current$onEr = (_optsRef$current3 = optsRef.current).onError) === null || _optsRef$current$onEr === void 0 || _optsRef$current$onEr.call(_optsRef$current3, error);
458
- updateState((prev) => (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, prev), {}, {
397
+ updateState((prev) => _objectSpread2(_objectSpread2({}, prev), {}, {
459
398
  status: "error",
460
399
  error
461
400
  }));
@@ -465,12 +404,12 @@ function useSubscription(opts) {
465
404
  (_optsRef$current$onCo = (_optsRef$current4 = optsRef.current).onConnectionStateChange) === null || _optsRef$current$onCo === void 0 || _optsRef$current$onCo.call(_optsRef$current4, result);
466
405
  updateState((prev) => {
467
406
  switch (result.state) {
468
- case "connecting": return (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, prev), {}, {
407
+ case "connecting": return _objectSpread2(_objectSpread2({}, prev), {}, {
469
408
  status: "connecting",
470
409
  error: result.error
471
410
  });
472
411
  case "pending": return prev;
473
- case "idle": return (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, prev), {}, {
412
+ case "idle": return _objectSpread2(_objectSpread2({}, prev), {}, {
474
413
  status: "idle",
475
414
  data: void 0,
476
415
  error: null
@@ -482,7 +421,7 @@ function useSubscription(opts) {
482
421
  currentSubscriptionRef.current = () => {
483
422
  subscription.unsubscribe();
484
423
  };
485
- }, [(0, __tanstack_react_query.hashKey)(opts.queryKey), opts.enabled]);
424
+ }, [(0, _tanstack_react_query.hashKey)(opts.queryKey), opts.enabled]);
486
425
  const getInitialState = react.useCallback(() => {
487
426
  return opts.enabled ? {
488
427
  data: void 0,
@@ -520,16 +459,13 @@ function useSubscription(opts) {
520
459
  return state;
521
460
  }
522
461
  function trackResult(result, onTrackResult) {
523
- const trackedResult = new Proxy(result.current, { get(_target, prop) {
462
+ return new Proxy(result.current, { get(_target, prop) {
524
463
  onTrackResult(prop);
525
464
  return result.current[prop];
526
465
  } });
527
- return trackedResult;
528
466
  }
529
-
530
467
  //#endregion
531
468
  //#region src/internals/createOptionsProxy.ts
532
- var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
533
469
  /**
534
470
  * Create a typed proxy from your router types. Can also be used on the server.
535
471
  *
@@ -540,7 +476,7 @@ function createTRPCOptionsProxy(opts) {
540
476
  const prefix = opts.keyPrefix;
541
477
  const callIt = (type) => {
542
478
  return (path, input, trpcOpts) => {
543
- if ("router" in opts) return Promise.resolve(unwrapLazyArg(opts.ctx)).then((ctx) => (0, __trpc_server.callTRPCProcedure)({
479
+ if ("router" in opts) return Promise.resolve(unwrapLazyArg(opts.ctx)).then((ctx) => (0, _trpc_server.callTRPCProcedure)({
544
480
  router: opts.router,
545
481
  path,
546
482
  getRawInput: async () => input,
@@ -549,15 +485,14 @@ function createTRPCOptionsProxy(opts) {
549
485
  signal: void 0,
550
486
  batchIndex: 0
551
487
  }));
552
- const untypedClient = opts.client instanceof __trpc_client.TRPCUntypedClient ? opts.client : (0, __trpc_client.getUntypedClient)(opts.client);
553
- return untypedClient[type](path, input, trpcOpts);
488
+ return (opts.client instanceof _trpc_client.TRPCUntypedClient ? opts.client : (0, _trpc_client.getUntypedClient)(opts.client))[type](path, input, trpcOpts);
554
489
  };
555
490
  };
556
- return (0, __trpc_server.createTRPCRecursiveProxy)(({ args, path: _path }) => {
491
+ return (0, _trpc_server.createTRPCRecursiveProxy)(({ args, path: _path }) => {
557
492
  const path = [..._path];
558
493
  const utilName = path.pop();
559
494
  const [arg1, arg2] = args;
560
- const contextMap = {
495
+ return {
561
496
  "~types": void 0,
562
497
  pathKey: () => {
563
498
  return getQueryKeyInternal({
@@ -567,7 +502,7 @@ function createTRPCOptionsProxy(opts) {
567
502
  });
568
503
  },
569
504
  pathFilter: () => {
570
- return (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, arg1), {}, { queryKey: getQueryKeyInternal({
505
+ return _objectSpread2(_objectSpread2({}, arg1), {}, { queryKey: getQueryKeyInternal({
571
506
  path,
572
507
  type: "any",
573
508
  prefix
@@ -597,7 +532,7 @@ function createTRPCOptionsProxy(opts) {
597
532
  });
598
533
  },
599
534
  queryFilter: () => {
600
- return (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, arg2), {}, { queryKey: getQueryKeyInternal({
535
+ return _objectSpread2(_objectSpread2({}, arg2), {}, { queryKey: getQueryKeyInternal({
601
536
  path,
602
537
  input: arg1,
603
538
  type: "query",
@@ -628,7 +563,7 @@ function createTRPCOptionsProxy(opts) {
628
563
  });
629
564
  },
630
565
  infiniteQueryFilter: () => {
631
- return (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, arg2), {}, { queryKey: getQueryKeyInternal({
566
+ return _objectSpread2(_objectSpread2({}, arg2), {}, { queryKey: getQueryKeyInternal({
632
567
  path,
633
568
  input: arg1,
634
569
  type: "infinite",
@@ -656,6 +591,7 @@ function createTRPCOptionsProxy(opts) {
656
591
  return trpcSubscriptionOptions({
657
592
  opts: arg2,
658
593
  path,
594
+ input: arg1,
659
595
  queryKey: getQueryKeyInternal({
660
596
  path,
661
597
  input: arg1,
@@ -665,11 +601,9 @@ function createTRPCOptionsProxy(opts) {
665
601
  subscribe: callIt("subscription")
666
602
  });
667
603
  }
668
- };
669
- return contextMap[utilName]();
604
+ }[utilName]();
670
605
  });
671
606
  }
672
-
673
607
  //#endregion
674
608
  //#region src/internals/Context.tsx
675
609
  /**
@@ -690,13 +624,7 @@ function createTRPCContext() {
690
624
  props.queryClient,
691
625
  props.keyPrefix
692
626
  ]);
693
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TRPCClientContext.Provider, {
694
- value: props.trpcClient,
695
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TRPCContext.Provider, {
696
- value,
697
- children: props.children
698
- })
699
- });
627
+ return /* @__PURE__ */ react.createElement(TRPCClientContext.Provider, { value: props.trpcClient }, /* @__PURE__ */ react.createElement(TRPCContext.Provider, { value }, props.children));
700
628
  };
701
629
  TRPCProvider.displayName = "TRPCProvider";
702
630
  function useTRPC() {
@@ -715,8 +643,7 @@ function createTRPCContext() {
715
643
  useTRPCClient
716
644
  };
717
645
  }
718
-
719
646
  //#endregion
720
647
  exports.createTRPCContext = createTRPCContext;
721
648
  exports.createTRPCOptionsProxy = createTRPCOptionsProxy;
722
- exports.useSubscription = useSubscription;
649
+ exports.useSubscription = useSubscription;