@orpc/experimental-react-swr 1.14.14 → 1.15.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +8 -3
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { isObject, resolveMaybeOptionalOptions, isAsyncIteratorObject, toArray } from '@orpc/shared';
1
+ import { isObject, resolveMaybeOptionalOptions, isAsyncIteratorObject, toArray, isTypescriptObject } from '@orpc/shared';
2
+ import { RECURSIVE_CLIENT_UNWRAP_KEYS } from '@orpc/client';
2
3
 
3
4
  function isSubsetOf(subsetKey, fullKey) {
4
5
  return subsetKey === fullKey ? true : typeof subsetKey !== typeof fullKey ? false : isObject(subsetKey) && isObject(fullKey) ? Object.keys(subsetKey).every((key) => subsetKey[key] === void 0 || isSubsetOf(subsetKey[key], fullKey[key])) : Array.isArray(subsetKey) && Array.isArray(fullKey) ? subsetKey.every((value, index) => isSubsetOf(value, fullKey[index])) : false;
@@ -151,7 +152,8 @@ function createRouterUtils(client, options = {}) {
151
152
  }, {
152
153
  get(target, prop) {
153
154
  const value = Reflect.get(target, prop);
154
- if (typeof prop !== "string") {
155
+ const nextClient = isTypescriptObject(client) ? Reflect.get(client, prop) : void 0;
156
+ if (typeof prop !== "string" || RECURSIVE_CLIENT_UNWRAP_KEYS.has(prop) || !isTypescriptObject(nextClient)) {
155
157
  return value;
156
158
  }
157
159
  const nextUtils = createRouterUtils(client[prop], { ...options, path: [...path, prop] });
@@ -159,7 +161,10 @@ function createRouterUtils(client, options = {}) {
159
161
  return nextUtils;
160
162
  }
161
163
  return new Proxy(value, {
162
- get(_, prop2) {
164
+ get(target2, prop2) {
165
+ if (typeof prop2 !== "string" || RECURSIVE_CLIENT_UNWRAP_KEYS.has(prop2)) {
166
+ return Reflect.get(target2, prop2);
167
+ }
163
168
  return Reflect.get(nextUtils, prop2);
164
169
  }
165
170
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/experimental-react-swr",
3
3
  "type": "module",
4
- "version": "1.14.14",
4
+ "version": "1.15.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.dev",
7
7
  "repository": {
@@ -25,10 +25,10 @@
25
25
  ],
26
26
  "peerDependencies": {
27
27
  "swr": ">=2.3.6",
28
- "@orpc/client": "1.14.14"
28
+ "@orpc/client": "1.15.0"
29
29
  },
30
30
  "dependencies": {
31
- "@orpc/shared": "1.14.14"
31
+ "@orpc/shared": "1.15.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "swr": "^2.4.1"