@openapi-qraft/react 1.11.0-beta.3 → 1.11.0-beta.5

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 (481) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/QraftContext.cjs +9 -0
  3. package/dist/cjs/QraftContext.cjs.map +1 -0
  4. package/dist/cjs/Unstable_QraftSecureRequestFn.cjs +193 -0
  5. package/dist/cjs/Unstable_QraftSecureRequestFn.cjs.map +1 -0
  6. package/dist/cjs/callbacks/cancelQueries.cjs +10 -0
  7. package/dist/cjs/callbacks/cancelQueries.cjs.map +1 -0
  8. package/dist/cjs/callbacks/fetchInfiniteQuery.cjs +10 -0
  9. package/dist/cjs/callbacks/fetchInfiniteQuery.cjs.map +1 -0
  10. package/dist/cjs/callbacks/fetchQuery.cjs +10 -0
  11. package/dist/cjs/callbacks/fetchQuery.cjs.map +1 -0
  12. package/dist/cjs/callbacks/getInfiniteQueryData.cjs +10 -0
  13. package/dist/cjs/callbacks/getInfiniteQueryData.cjs.map +1 -0
  14. package/dist/cjs/callbacks/getInfiniteQueryKey.cjs +10 -0
  15. package/dist/cjs/callbacks/getInfiniteQueryKey.cjs.map +1 -0
  16. package/dist/cjs/callbacks/getInfiniteQueryState.cjs +10 -0
  17. package/dist/cjs/callbacks/getInfiniteQueryState.cjs.map +1 -0
  18. package/dist/cjs/callbacks/getMutationKey.cjs +10 -0
  19. package/dist/cjs/callbacks/getMutationKey.cjs.map +1 -0
  20. package/dist/cjs/callbacks/getQueriesData.cjs +10 -0
  21. package/dist/cjs/callbacks/getQueriesData.cjs.map +1 -0
  22. package/dist/cjs/callbacks/getQueryData.cjs +10 -0
  23. package/dist/cjs/callbacks/getQueryData.cjs.map +1 -0
  24. package/dist/cjs/callbacks/getQueryKey.cjs +10 -0
  25. package/dist/cjs/callbacks/getQueryKey.cjs.map +1 -0
  26. package/dist/cjs/callbacks/getQueryState.cjs +10 -0
  27. package/dist/cjs/callbacks/getQueryState.cjs.map +1 -0
  28. package/dist/cjs/callbacks/index.cjs +76 -0
  29. package/dist/cjs/callbacks/index.cjs.map +1 -0
  30. package/dist/cjs/callbacks/invalidateQueries.cjs +10 -0
  31. package/dist/cjs/callbacks/invalidateQueries.cjs.map +1 -0
  32. package/dist/cjs/callbacks/isFetching.cjs +10 -0
  33. package/dist/cjs/callbacks/isFetching.cjs.map +1 -0
  34. package/dist/cjs/callbacks/isMutating.cjs +10 -0
  35. package/dist/cjs/callbacks/isMutating.cjs.map +1 -0
  36. package/dist/cjs/callbacks/mutationFn.cjs +12 -0
  37. package/dist/cjs/callbacks/mutationFn.cjs.map +1 -0
  38. package/dist/cjs/callbacks/operationInvokeFn.cjs +22 -0
  39. package/dist/cjs/callbacks/operationInvokeFn.cjs.map +1 -0
  40. package/dist/cjs/callbacks/prefetchInfiniteQuery.cjs +10 -0
  41. package/dist/cjs/callbacks/prefetchInfiniteQuery.cjs.map +1 -0
  42. package/dist/cjs/callbacks/prefetchQuery.cjs +10 -0
  43. package/dist/cjs/callbacks/prefetchQuery.cjs.map +1 -0
  44. package/dist/cjs/callbacks/queryFn.cjs +13 -0
  45. package/dist/cjs/callbacks/queryFn.cjs.map +1 -0
  46. package/dist/cjs/callbacks/refetchQueries.cjs +10 -0
  47. package/dist/cjs/callbacks/refetchQueries.cjs.map +1 -0
  48. package/dist/cjs/callbacks/removeQueries.cjs +10 -0
  49. package/dist/cjs/callbacks/removeQueries.cjs.map +1 -0
  50. package/dist/cjs/callbacks/resetQueries.cjs +10 -0
  51. package/dist/cjs/callbacks/resetQueries.cjs.map +1 -0
  52. package/dist/cjs/callbacks/setInfiniteQueryData.cjs +10 -0
  53. package/dist/cjs/callbacks/setInfiniteQueryData.cjs.map +1 -0
  54. package/dist/cjs/callbacks/setQueriesData.cjs +10 -0
  55. package/dist/cjs/callbacks/setQueriesData.cjs.map +1 -0
  56. package/dist/cjs/callbacks/setQueryData.cjs +10 -0
  57. package/dist/cjs/callbacks/setQueryData.cjs.map +1 -0
  58. package/dist/cjs/callbacks/useInfiniteQuery.cjs +13 -0
  59. package/dist/cjs/callbacks/useInfiniteQuery.cjs.map +1 -0
  60. package/dist/cjs/callbacks/useIsFetching.cjs +14 -0
  61. package/dist/cjs/callbacks/useIsFetching.cjs.map +1 -0
  62. package/dist/cjs/callbacks/useIsMutating.cjs +14 -0
  63. package/dist/cjs/callbacks/useIsMutating.cjs.map +1 -0
  64. package/dist/cjs/callbacks/useMutation.cjs +37 -0
  65. package/dist/cjs/callbacks/useMutation.cjs.map +1 -0
  66. package/dist/cjs/callbacks/useMutationState.cjs +17 -0
  67. package/dist/cjs/callbacks/useMutationState.cjs.map +1 -0
  68. package/dist/cjs/callbacks/useQueries.cjs +41 -0
  69. package/dist/cjs/callbacks/useQueries.cjs.map +1 -0
  70. package/dist/cjs/callbacks/useQuery.cjs +13 -0
  71. package/dist/cjs/callbacks/useQuery.cjs.map +1 -0
  72. package/dist/cjs/callbacks/useSuspenseInfiniteQuery.cjs +13 -0
  73. package/dist/cjs/callbacks/useSuspenseInfiniteQuery.cjs.map +1 -0
  74. package/dist/cjs/callbacks/useSuspenseQueries.cjs +41 -0
  75. package/dist/cjs/callbacks/useSuspenseQueries.cjs.map +1 -0
  76. package/dist/cjs/callbacks/useSuspenseQuery.cjs +13 -0
  77. package/dist/cjs/callbacks/useSuspenseQuery.cjs.map +1 -0
  78. package/dist/cjs/index.cjs +92 -0
  79. package/dist/cjs/index.cjs.map +1 -0
  80. package/dist/cjs/lib/callQueryClientFetchMethod.cjs +47 -0
  81. package/dist/cjs/lib/callQueryClientFetchMethod.cjs.map +1 -0
  82. package/dist/cjs/lib/callQueryClientMethodWithMutationFilters.cjs +19 -0
  83. package/dist/cjs/lib/callQueryClientMethodWithMutationFilters.cjs.map +1 -0
  84. package/dist/cjs/lib/callQueryClientMethodWithQueryFilters.cjs +19 -0
  85. package/dist/cjs/lib/callQueryClientMethodWithQueryFilters.cjs.map +1 -0
  86. package/dist/cjs/lib/callQueryClientMethodWithQueryKey.cjs +20 -0
  87. package/dist/cjs/lib/callQueryClientMethodWithQueryKey.cjs.map +1 -0
  88. package/dist/cjs/lib/composeBaseQueryKey.cjs +14 -0
  89. package/dist/cjs/lib/composeBaseQueryKey.cjs.map +1 -0
  90. package/dist/cjs/lib/composeInfiniteQueryKey.cjs +10 -0
  91. package/dist/cjs/lib/composeInfiniteQueryKey.cjs.map +1 -0
  92. package/dist/cjs/lib/composeMutationFilters.cjs +36 -0
  93. package/dist/cjs/lib/composeMutationFilters.cjs.map +1 -0
  94. package/dist/cjs/lib/composeMutationKey.cjs +29 -0
  95. package/dist/cjs/lib/composeMutationKey.cjs.map +1 -0
  96. package/dist/cjs/lib/composeQueryFilters.cjs +38 -0
  97. package/dist/cjs/lib/composeQueryFilters.cjs.map +1 -0
  98. package/dist/cjs/lib/composeQueryKey.cjs +10 -0
  99. package/dist/cjs/lib/composeQueryKey.cjs.map +1 -0
  100. package/dist/cjs/lib/createRecursiveProxy.cjs +35 -0
  101. package/dist/cjs/lib/createRecursiveProxy.cjs.map +1 -0
  102. package/dist/cjs/lib/jwt-decode/index.cjs +62 -0
  103. package/dist/cjs/lib/jwt-decode/index.cjs.map +1 -0
  104. package/dist/cjs/lib/requestFn.cjs +181 -0
  105. package/dist/cjs/lib/requestFn.cjs.map +1 -0
  106. package/dist/cjs/lib/shelfMerge.cjs +30 -0
  107. package/dist/cjs/lib/shelfMerge.cjs.map +1 -0
  108. package/dist/cjs/lib/useComposeUseQueryOptions.cjs +40 -0
  109. package/dist/cjs/lib/useComposeUseQueryOptions.cjs.map +1 -0
  110. package/dist/cjs/lib/useQueryClient.cjs +18 -0
  111. package/dist/cjs/lib/useQueryClient.cjs.map +1 -0
  112. package/dist/cjs/qraftAPIClient.cjs +48 -0
  113. package/dist/cjs/qraftAPIClient.cjs.map +1 -0
  114. package/dist/esm/QraftContext.js +7 -7
  115. package/dist/esm/QraftContext.js.map +1 -1
  116. package/dist/esm/Unstable_QraftSecureRequestFn.js +174 -176
  117. package/dist/esm/Unstable_QraftSecureRequestFn.js.map +1 -1
  118. package/dist/esm/callbacks/cancelQueries.js +6 -10
  119. package/dist/esm/callbacks/cancelQueries.js.map +1 -1
  120. package/dist/esm/callbacks/fetchInfiniteQuery.js +7 -12
  121. package/dist/esm/callbacks/fetchInfiniteQuery.js.map +1 -1
  122. package/dist/esm/callbacks/fetchQuery.js +7 -12
  123. package/dist/esm/callbacks/fetchQuery.js.map +1 -1
  124. package/dist/esm/callbacks/getInfiniteQueryData.js +6 -11
  125. package/dist/esm/callbacks/getInfiniteQueryData.js.map +1 -1
  126. package/dist/esm/callbacks/getInfiniteQueryKey.js +7 -7
  127. package/dist/esm/callbacks/getInfiniteQueryKey.js.map +1 -1
  128. package/dist/esm/callbacks/getInfiniteQueryState.js +6 -11
  129. package/dist/esm/callbacks/getInfiniteQueryState.js.map +1 -1
  130. package/dist/esm/callbacks/getMutationKey.js +7 -7
  131. package/dist/esm/callbacks/getMutationKey.js.map +1 -1
  132. package/dist/esm/callbacks/getQueriesData.js +6 -10
  133. package/dist/esm/callbacks/getQueriesData.js.map +1 -1
  134. package/dist/esm/callbacks/getQueryData.js +6 -11
  135. package/dist/esm/callbacks/getQueryData.js.map +1 -1
  136. package/dist/esm/callbacks/getQueryKey.js +7 -7
  137. package/dist/esm/callbacks/getQueryKey.js.map +1 -1
  138. package/dist/esm/callbacks/getQueryState.js +6 -11
  139. package/dist/esm/callbacks/getQueryState.js.map +1 -1
  140. package/dist/esm/callbacks/index.js +36 -73
  141. package/dist/esm/callbacks/index.js.map +1 -1
  142. package/dist/esm/callbacks/invalidateQueries.js +6 -10
  143. package/dist/esm/callbacks/invalidateQueries.js.map +1 -1
  144. package/dist/esm/callbacks/isFetching.js +6 -10
  145. package/dist/esm/callbacks/isFetching.js.map +1 -1
  146. package/dist/esm/callbacks/isMutating.js +6 -10
  147. package/dist/esm/callbacks/isMutating.js.map +1 -1
  148. package/dist/esm/callbacks/mutationFn.js +9 -10
  149. package/dist/esm/callbacks/mutationFn.js.map +1 -1
  150. package/dist/esm/callbacks/operationInvokeFn.js +19 -16
  151. package/dist/esm/callbacks/operationInvokeFn.js.map +1 -1
  152. package/dist/esm/callbacks/prefetchInfiniteQuery.js +7 -12
  153. package/dist/esm/callbacks/prefetchInfiniteQuery.js.map +1 -1
  154. package/dist/esm/callbacks/prefetchQuery.js +7 -12
  155. package/dist/esm/callbacks/prefetchQuery.js.map +1 -1
  156. package/dist/esm/callbacks/queryFn.js +10 -14
  157. package/dist/esm/callbacks/queryFn.js.map +1 -1
  158. package/dist/esm/callbacks/refetchQueries.js +6 -10
  159. package/dist/esm/callbacks/refetchQueries.js.map +1 -1
  160. package/dist/esm/callbacks/removeQueries.js +6 -10
  161. package/dist/esm/callbacks/removeQueries.js.map +1 -1
  162. package/dist/esm/callbacks/resetQueries.js +6 -10
  163. package/dist/esm/callbacks/resetQueries.js.map +1 -1
  164. package/dist/esm/callbacks/setInfiniteQueryData.js +6 -11
  165. package/dist/esm/callbacks/setInfiniteQueryData.js.map +1 -1
  166. package/dist/esm/callbacks/setQueriesData.js +6 -10
  167. package/dist/esm/callbacks/setQueriesData.js.map +1 -1
  168. package/dist/esm/callbacks/setQueryData.js +6 -11
  169. package/dist/esm/callbacks/setQueryData.js.map +1 -1
  170. package/dist/esm/callbacks/useInfiniteQuery.js +10 -13
  171. package/dist/esm/callbacks/useInfiniteQuery.js.map +1 -1
  172. package/dist/esm/callbacks/useIsFetching.js +11 -14
  173. package/dist/esm/callbacks/useIsFetching.js.map +1 -1
  174. package/dist/esm/callbacks/useIsMutating.js +11 -16
  175. package/dist/esm/callbacks/useIsMutating.js.map +1 -1
  176. package/dist/esm/callbacks/useMutation.js +34 -43
  177. package/dist/esm/callbacks/useMutation.js.map +1 -1
  178. package/dist/esm/callbacks/useMutationState.js +14 -19
  179. package/dist/esm/callbacks/useMutationState.js.map +1 -1
  180. package/dist/esm/callbacks/useQueries.js +38 -46
  181. package/dist/esm/callbacks/useQueries.js.map +1 -1
  182. package/dist/esm/callbacks/useQuery.js +10 -13
  183. package/dist/esm/callbacks/useQuery.js.map +1 -1
  184. package/dist/esm/callbacks/useSuspenseInfiniteQuery.js +10 -13
  185. package/dist/esm/callbacks/useSuspenseInfiniteQuery.js.map +1 -1
  186. package/dist/esm/callbacks/useSuspenseQueries.js +38 -46
  187. package/dist/esm/callbacks/useSuspenseQueries.js.map +1 -1
  188. package/dist/esm/callbacks/useSuspenseQuery.js +10 -13
  189. package/dist/esm/callbacks/useSuspenseQuery.js.map +1 -1
  190. package/dist/esm/index.js +42 -29
  191. package/dist/esm/index.js.map +1 -1
  192. package/dist/esm/lib/callQueryClientFetchMethod.js +41 -41
  193. package/dist/esm/lib/callQueryClientFetchMethod.js.map +1 -1
  194. package/dist/esm/lib/callQueryClientMethodWithMutationFilters.js +16 -17
  195. package/dist/esm/lib/callQueryClientMethodWithMutationFilters.js.map +1 -1
  196. package/dist/esm/lib/callQueryClientMethodWithQueryFilters.js +16 -17
  197. package/dist/esm/lib/callQueryClientMethodWithQueryFilters.js.map +1 -1
  198. package/dist/esm/lib/callQueryClientMethodWithQueryKey.js +17 -16
  199. package/dist/esm/lib/callQueryClientMethodWithQueryKey.js.map +1 -1
  200. package/dist/esm/lib/composeBaseQueryKey.js +10 -8
  201. package/dist/esm/lib/composeBaseQueryKey.js.map +1 -1
  202. package/dist/esm/lib/composeInfiniteQueryKey.js +6 -6
  203. package/dist/esm/lib/composeInfiniteQueryKey.js.map +1 -1
  204. package/dist/esm/lib/composeMutationFilters.js +31 -28
  205. package/dist/esm/lib/composeMutationFilters.js.map +1 -1
  206. package/dist/esm/lib/composeMutationKey.js +22 -23
  207. package/dist/esm/lib/composeMutationKey.js.map +1 -1
  208. package/dist/esm/lib/composeQueryFilters.js +33 -30
  209. package/dist/esm/lib/composeQueryFilters.js.map +1 -1
  210. package/dist/esm/lib/composeQueryKey.js +6 -6
  211. package/dist/esm/lib/composeQueryKey.js.map +1 -1
  212. package/dist/esm/lib/createRecursiveProxy.js +30 -22
  213. package/dist/esm/lib/createRecursiveProxy.js.map +1 -1
  214. package/dist/esm/lib/jwt-decode/index.js +49 -56
  215. package/dist/esm/lib/jwt-decode/index.js.map +1 -1
  216. package/dist/esm/lib/requestFn.js +156 -155
  217. package/dist/esm/lib/requestFn.js.map +1 -1
  218. package/dist/esm/lib/shelfMerge.js +27 -28
  219. package/dist/esm/lib/shelfMerge.js.map +1 -1
  220. package/dist/esm/lib/useComposeUseQueryOptions.js +37 -31
  221. package/dist/esm/lib/useComposeUseQueryOptions.js.map +1 -1
  222. package/dist/esm/lib/useQueryClient.js +15 -15
  223. package/dist/esm/lib/useQueryClient.js.map +1 -1
  224. package/dist/esm/qraftAPIClient.js +40 -47
  225. package/dist/esm/qraftAPIClient.js.map +1 -1
  226. package/dist/types/index.d.ts +1 -0
  227. package/dist/types/index.d.ts.map +1 -1
  228. package/package.json +9 -15
  229. package/src/index.ts +3 -0
  230. package/dist/cjs/QraftContext.js +0 -31
  231. package/dist/cjs/QraftContext.js.map +0 -1
  232. package/dist/cjs/ServiceOperation.js +0 -17
  233. package/dist/cjs/ServiceOperation.js.map +0 -1
  234. package/dist/cjs/Unstable_QraftSecureRequestFn.js +0 -214
  235. package/dist/cjs/Unstable_QraftSecureRequestFn.js.map +0 -1
  236. package/dist/cjs/callbacks/cancelQueries.js +0 -36
  237. package/dist/cjs/callbacks/cancelQueries.js.map +0 -1
  238. package/dist/cjs/callbacks/fetchInfiniteQuery.js +0 -37
  239. package/dist/cjs/callbacks/fetchInfiniteQuery.js.map +0 -1
  240. package/dist/cjs/callbacks/fetchQuery.js +0 -37
  241. package/dist/cjs/callbacks/fetchQuery.js.map +0 -1
  242. package/dist/cjs/callbacks/getInfiniteQueryData.js +0 -37
  243. package/dist/cjs/callbacks/getInfiniteQueryData.js.map +0 -1
  244. package/dist/cjs/callbacks/getInfiniteQueryKey.js +0 -32
  245. package/dist/cjs/callbacks/getInfiniteQueryKey.js.map +0 -1
  246. package/dist/cjs/callbacks/getInfiniteQueryState.js +0 -37
  247. package/dist/cjs/callbacks/getInfiniteQueryState.js.map +0 -1
  248. package/dist/cjs/callbacks/getMutationKey.js +0 -32
  249. package/dist/cjs/callbacks/getMutationKey.js.map +0 -1
  250. package/dist/cjs/callbacks/getQueriesData.js +0 -36
  251. package/dist/cjs/callbacks/getQueriesData.js.map +0 -1
  252. package/dist/cjs/callbacks/getQueryData.js +0 -37
  253. package/dist/cjs/callbacks/getQueryData.js.map +0 -1
  254. package/dist/cjs/callbacks/getQueryKey.js +0 -32
  255. package/dist/cjs/callbacks/getQueryKey.js.map +0 -1
  256. package/dist/cjs/callbacks/getQueryState.js +0 -37
  257. package/dist/cjs/callbacks/getQueryState.js.map +0 -1
  258. package/dist/cjs/callbacks/index.js +0 -131
  259. package/dist/cjs/callbacks/index.js.map +0 -1
  260. package/dist/cjs/callbacks/invalidateQueries.js +0 -36
  261. package/dist/cjs/callbacks/invalidateQueries.js.map +0 -1
  262. package/dist/cjs/callbacks/isFetching.js +0 -36
  263. package/dist/cjs/callbacks/isFetching.js.map +0 -1
  264. package/dist/cjs/callbacks/isMutating.js +0 -36
  265. package/dist/cjs/callbacks/isMutating.js.map +0 -1
  266. package/dist/cjs/callbacks/mutationFn.js +0 -35
  267. package/dist/cjs/callbacks/mutationFn.js.map +0 -1
  268. package/dist/cjs/callbacks/operationInvokeFn.js +0 -41
  269. package/dist/cjs/callbacks/operationInvokeFn.js.map +0 -1
  270. package/dist/cjs/callbacks/prefetchInfiniteQuery.js +0 -37
  271. package/dist/cjs/callbacks/prefetchInfiniteQuery.js.map +0 -1
  272. package/dist/cjs/callbacks/prefetchQuery.js +0 -37
  273. package/dist/cjs/callbacks/prefetchQuery.js.map +0 -1
  274. package/dist/cjs/callbacks/queryFn.js +0 -39
  275. package/dist/cjs/callbacks/queryFn.js.map +0 -1
  276. package/dist/cjs/callbacks/refetchQueries.js +0 -36
  277. package/dist/cjs/callbacks/refetchQueries.js.map +0 -1
  278. package/dist/cjs/callbacks/removeQueries.js +0 -36
  279. package/dist/cjs/callbacks/removeQueries.js.map +0 -1
  280. package/dist/cjs/callbacks/resetQueries.js +0 -36
  281. package/dist/cjs/callbacks/resetQueries.js.map +0 -1
  282. package/dist/cjs/callbacks/setInfiniteQueryData.js +0 -37
  283. package/dist/cjs/callbacks/setInfiniteQueryData.js.map +0 -1
  284. package/dist/cjs/callbacks/setQueriesData.js +0 -36
  285. package/dist/cjs/callbacks/setQueriesData.js.map +0 -1
  286. package/dist/cjs/callbacks/setQueryData.js +0 -37
  287. package/dist/cjs/callbacks/setQueryData.js.map +0 -1
  288. package/dist/cjs/callbacks/useInfiniteQuery.js +0 -36
  289. package/dist/cjs/callbacks/useInfiniteQuery.js.map +0 -1
  290. package/dist/cjs/callbacks/useIsFetching.js +0 -39
  291. package/dist/cjs/callbacks/useIsFetching.js.map +0 -1
  292. package/dist/cjs/callbacks/useIsMutating.js +0 -39
  293. package/dist/cjs/callbacks/useIsMutating.js.map +0 -1
  294. package/dist/cjs/callbacks/useMutation.js +0 -66
  295. package/dist/cjs/callbacks/useMutation.js.map +0 -1
  296. package/dist/cjs/callbacks/useMutationState.js +0 -42
  297. package/dist/cjs/callbacks/useMutationState.js.map +0 -1
  298. package/dist/cjs/callbacks/useQueries.js +0 -69
  299. package/dist/cjs/callbacks/useQueries.js.map +0 -1
  300. package/dist/cjs/callbacks/useQuery.js +0 -36
  301. package/dist/cjs/callbacks/useQuery.js.map +0 -1
  302. package/dist/cjs/callbacks/useSuspenseInfiniteQuery.js +0 -36
  303. package/dist/cjs/callbacks/useSuspenseInfiniteQuery.js.map +0 -1
  304. package/dist/cjs/callbacks/useSuspenseQueries.js +0 -69
  305. package/dist/cjs/callbacks/useSuspenseQueries.js.map +0 -1
  306. package/dist/cjs/callbacks/useSuspenseQuery.js +0 -36
  307. package/dist/cjs/callbacks/useSuspenseQuery.js.map +0 -1
  308. package/dist/cjs/index.js +0 -63
  309. package/dist/cjs/index.js.map +0 -1
  310. package/dist/cjs/lib/PartialParameters.type.js +0 -17
  311. package/dist/cjs/lib/PartialParameters.type.js.map +0 -1
  312. package/dist/cjs/lib/callQueryClientFetchMethod.js +0 -69
  313. package/dist/cjs/lib/callQueryClientFetchMethod.js.map +0 -1
  314. package/dist/cjs/lib/callQueryClientMethodWithMutationFilters.js +0 -42
  315. package/dist/cjs/lib/callQueryClientMethodWithMutationFilters.js.map +0 -1
  316. package/dist/cjs/lib/callQueryClientMethodWithQueryFilters.js +0 -42
  317. package/dist/cjs/lib/callQueryClientMethodWithQueryFilters.js.map +0 -1
  318. package/dist/cjs/lib/callQueryClientMethodWithQueryKey.js +0 -41
  319. package/dist/cjs/lib/callQueryClientMethodWithQueryKey.js.map +0 -1
  320. package/dist/cjs/lib/composeBaseQueryKey.js +0 -34
  321. package/dist/cjs/lib/composeBaseQueryKey.js.map +0 -1
  322. package/dist/cjs/lib/composeInfiniteQueryKey.js +0 -32
  323. package/dist/cjs/lib/composeInfiniteQueryKey.js.map +0 -1
  324. package/dist/cjs/lib/composeMutationFilters.js +0 -55
  325. package/dist/cjs/lib/composeMutationFilters.js.map +0 -1
  326. package/dist/cjs/lib/composeMutationKey.js +0 -52
  327. package/dist/cjs/lib/composeMutationKey.js.map +0 -1
  328. package/dist/cjs/lib/composeQueryFilters.js +0 -57
  329. package/dist/cjs/lib/composeQueryFilters.js.map +0 -1
  330. package/dist/cjs/lib/composeQueryKey.js +0 -32
  331. package/dist/cjs/lib/composeQueryKey.js.map +0 -1
  332. package/dist/cjs/lib/createRecursiveProxy.js +0 -49
  333. package/dist/cjs/lib/createRecursiveProxy.js.map +0 -1
  334. package/dist/cjs/lib/jwt-decode/index.js +0 -91
  335. package/dist/cjs/lib/jwt-decode/index.js.map +0 -1
  336. package/dist/cjs/lib/requestFn.js +0 -202
  337. package/dist/cjs/lib/requestFn.js.map +0 -1
  338. package/dist/cjs/lib/shelfMerge.js +0 -53
  339. package/dist/cjs/lib/shelfMerge.js.map +0 -1
  340. package/dist/cjs/lib/useComposeUseQueryOptions.js +0 -56
  341. package/dist/cjs/lib/useComposeUseQueryOptions.js.map +0 -1
  342. package/dist/cjs/lib/useQueryClient.js +0 -38
  343. package/dist/cjs/lib/useQueryClient.js.map +0 -1
  344. package/dist/cjs/qraftAPIClient.js +0 -77
  345. package/dist/cjs/qraftAPIClient.js.map +0 -1
  346. package/dist/cjs/service-operation/OperationInfiniteData.js +0 -17
  347. package/dist/cjs/service-operation/OperationInfiniteData.js.map +0 -1
  348. package/dist/cjs/service-operation/QueryFilters.js +0 -17
  349. package/dist/cjs/service-operation/QueryFilters.js.map +0 -1
  350. package/dist/cjs/service-operation/ServiceOperation.js +0 -17
  351. package/dist/cjs/service-operation/ServiceOperation.js.map +0 -1
  352. package/dist/cjs/service-operation/ServiceOperationCancelQueries.js +0 -17
  353. package/dist/cjs/service-operation/ServiceOperationCancelQueries.js.map +0 -1
  354. package/dist/cjs/service-operation/ServiceOperationFetchInfiniteQuery.js +0 -17
  355. package/dist/cjs/service-operation/ServiceOperationFetchInfiniteQuery.js.map +0 -1
  356. package/dist/cjs/service-operation/ServiceOperationFetchQuery.js +0 -17
  357. package/dist/cjs/service-operation/ServiceOperationFetchQuery.js.map +0 -1
  358. package/dist/cjs/service-operation/ServiceOperationGetInfiniteQueryData.js +0 -17
  359. package/dist/cjs/service-operation/ServiceOperationGetInfiniteQueryData.js.map +0 -1
  360. package/dist/cjs/service-operation/ServiceOperationGetQueriesData.js +0 -17
  361. package/dist/cjs/service-operation/ServiceOperationGetQueriesData.js.map +0 -1
  362. package/dist/cjs/service-operation/ServiceOperationGetQueryData.js +0 -17
  363. package/dist/cjs/service-operation/ServiceOperationGetQueryData.js.map +0 -1
  364. package/dist/cjs/service-operation/ServiceOperationGetQueryState.js +0 -17
  365. package/dist/cjs/service-operation/ServiceOperationGetQueryState.js.map +0 -1
  366. package/dist/cjs/service-operation/ServiceOperationInvalidateQueries.js +0 -17
  367. package/dist/cjs/service-operation/ServiceOperationInvalidateQueries.js.map +0 -1
  368. package/dist/cjs/service-operation/ServiceOperationIsFetchingQueries.js +0 -17
  369. package/dist/cjs/service-operation/ServiceOperationIsFetchingQueries.js.map +0 -1
  370. package/dist/cjs/service-operation/ServiceOperationIsMutatingQueries.js +0 -17
  371. package/dist/cjs/service-operation/ServiceOperationIsMutatingQueries.js.map +0 -1
  372. package/dist/cjs/service-operation/ServiceOperationKey.js +0 -17
  373. package/dist/cjs/service-operation/ServiceOperationKey.js.map +0 -1
  374. package/dist/cjs/service-operation/ServiceOperationMutationFn.js +0 -17
  375. package/dist/cjs/service-operation/ServiceOperationMutationFn.js.map +0 -1
  376. package/dist/cjs/service-operation/ServiceOperationQueryFn.js +0 -17
  377. package/dist/cjs/service-operation/ServiceOperationQueryFn.js.map +0 -1
  378. package/dist/cjs/service-operation/ServiceOperationRefetchQueries.js +0 -17
  379. package/dist/cjs/service-operation/ServiceOperationRefetchQueries.js.map +0 -1
  380. package/dist/cjs/service-operation/ServiceOperationRemoveQueries.js +0 -17
  381. package/dist/cjs/service-operation/ServiceOperationRemoveQueries.js.map +0 -1
  382. package/dist/cjs/service-operation/ServiceOperationResetQueries.js +0 -17
  383. package/dist/cjs/service-operation/ServiceOperationResetQueries.js.map +0 -1
  384. package/dist/cjs/service-operation/ServiceOperationSetInfiniteQueryData.js +0 -17
  385. package/dist/cjs/service-operation/ServiceOperationSetInfiniteQueryData.js.map +0 -1
  386. package/dist/cjs/service-operation/ServiceOperationSetQueriesData.js +0 -17
  387. package/dist/cjs/service-operation/ServiceOperationSetQueriesData.js.map +0 -1
  388. package/dist/cjs/service-operation/ServiceOperationSetQueryData.js +0 -17
  389. package/dist/cjs/service-operation/ServiceOperationSetQueryData.js.map +0 -1
  390. package/dist/cjs/service-operation/ServiceOperationUseInfiniteQuery.js +0 -17
  391. package/dist/cjs/service-operation/ServiceOperationUseInfiniteQuery.js.map +0 -1
  392. package/dist/cjs/service-operation/ServiceOperationUseIsFetchingQueries.js +0 -17
  393. package/dist/cjs/service-operation/ServiceOperationUseIsFetchingQueries.js.map +0 -1
  394. package/dist/cjs/service-operation/ServiceOperationUseIsMutating.js +0 -17
  395. package/dist/cjs/service-operation/ServiceOperationUseIsMutating.js.map +0 -1
  396. package/dist/cjs/service-operation/ServiceOperationUseMutation.js +0 -17
  397. package/dist/cjs/service-operation/ServiceOperationUseMutation.js.map +0 -1
  398. package/dist/cjs/service-operation/ServiceOperationUseMutationState.js +0 -17
  399. package/dist/cjs/service-operation/ServiceOperationUseMutationState.js.map +0 -1
  400. package/dist/cjs/service-operation/ServiceOperationUseQueries.js +0 -17
  401. package/dist/cjs/service-operation/ServiceOperationUseQueries.js.map +0 -1
  402. package/dist/cjs/service-operation/ServiceOperationUseQuery.js +0 -17
  403. package/dist/cjs/service-operation/ServiceOperationUseQuery.js.map +0 -1
  404. package/dist/cjs/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js +0 -17
  405. package/dist/cjs/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js.map +0 -1
  406. package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueries.js +0 -17
  407. package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueries.js.map +0 -1
  408. package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueryQuery.js +0 -17
  409. package/dist/cjs/service-operation/ServiceOperationUseSuspenseQueryQuery.js.map +0 -1
  410. package/dist/cjs/service-operation/index.js +0 -17
  411. package/dist/cjs/service-operation/index.js.map +0 -1
  412. package/dist/esm/ServiceOperation.js +0 -1
  413. package/dist/esm/ServiceOperation.js.map +0 -1
  414. package/dist/esm/lib/PartialParameters.type.js +0 -1
  415. package/dist/esm/lib/PartialParameters.type.js.map +0 -1
  416. package/dist/esm/service-operation/OperationInfiniteData.js +0 -1
  417. package/dist/esm/service-operation/OperationInfiniteData.js.map +0 -1
  418. package/dist/esm/service-operation/QueryFilters.js +0 -1
  419. package/dist/esm/service-operation/QueryFilters.js.map +0 -1
  420. package/dist/esm/service-operation/ServiceOperation.js +0 -1
  421. package/dist/esm/service-operation/ServiceOperation.js.map +0 -1
  422. package/dist/esm/service-operation/ServiceOperationCancelQueries.js +0 -1
  423. package/dist/esm/service-operation/ServiceOperationCancelQueries.js.map +0 -1
  424. package/dist/esm/service-operation/ServiceOperationFetchInfiniteQuery.js +0 -1
  425. package/dist/esm/service-operation/ServiceOperationFetchInfiniteQuery.js.map +0 -1
  426. package/dist/esm/service-operation/ServiceOperationFetchQuery.js +0 -1
  427. package/dist/esm/service-operation/ServiceOperationFetchQuery.js.map +0 -1
  428. package/dist/esm/service-operation/ServiceOperationGetInfiniteQueryData.js +0 -1
  429. package/dist/esm/service-operation/ServiceOperationGetInfiniteQueryData.js.map +0 -1
  430. package/dist/esm/service-operation/ServiceOperationGetQueriesData.js +0 -1
  431. package/dist/esm/service-operation/ServiceOperationGetQueriesData.js.map +0 -1
  432. package/dist/esm/service-operation/ServiceOperationGetQueryData.js +0 -1
  433. package/dist/esm/service-operation/ServiceOperationGetQueryData.js.map +0 -1
  434. package/dist/esm/service-operation/ServiceOperationGetQueryState.js +0 -1
  435. package/dist/esm/service-operation/ServiceOperationGetQueryState.js.map +0 -1
  436. package/dist/esm/service-operation/ServiceOperationInvalidateQueries.js +0 -1
  437. package/dist/esm/service-operation/ServiceOperationInvalidateQueries.js.map +0 -1
  438. package/dist/esm/service-operation/ServiceOperationIsFetchingQueries.js +0 -1
  439. package/dist/esm/service-operation/ServiceOperationIsFetchingQueries.js.map +0 -1
  440. package/dist/esm/service-operation/ServiceOperationIsMutatingQueries.js +0 -1
  441. package/dist/esm/service-operation/ServiceOperationIsMutatingQueries.js.map +0 -1
  442. package/dist/esm/service-operation/ServiceOperationKey.js +0 -1
  443. package/dist/esm/service-operation/ServiceOperationKey.js.map +0 -1
  444. package/dist/esm/service-operation/ServiceOperationMutationFn.js +0 -1
  445. package/dist/esm/service-operation/ServiceOperationMutationFn.js.map +0 -1
  446. package/dist/esm/service-operation/ServiceOperationQueryFn.js +0 -1
  447. package/dist/esm/service-operation/ServiceOperationQueryFn.js.map +0 -1
  448. package/dist/esm/service-operation/ServiceOperationRefetchQueries.js +0 -1
  449. package/dist/esm/service-operation/ServiceOperationRefetchQueries.js.map +0 -1
  450. package/dist/esm/service-operation/ServiceOperationRemoveQueries.js +0 -1
  451. package/dist/esm/service-operation/ServiceOperationRemoveQueries.js.map +0 -1
  452. package/dist/esm/service-operation/ServiceOperationResetQueries.js +0 -1
  453. package/dist/esm/service-operation/ServiceOperationResetQueries.js.map +0 -1
  454. package/dist/esm/service-operation/ServiceOperationSetInfiniteQueryData.js +0 -1
  455. package/dist/esm/service-operation/ServiceOperationSetInfiniteQueryData.js.map +0 -1
  456. package/dist/esm/service-operation/ServiceOperationSetQueriesData.js +0 -1
  457. package/dist/esm/service-operation/ServiceOperationSetQueriesData.js.map +0 -1
  458. package/dist/esm/service-operation/ServiceOperationSetQueryData.js +0 -1
  459. package/dist/esm/service-operation/ServiceOperationSetQueryData.js.map +0 -1
  460. package/dist/esm/service-operation/ServiceOperationUseInfiniteQuery.js +0 -1
  461. package/dist/esm/service-operation/ServiceOperationUseInfiniteQuery.js.map +0 -1
  462. package/dist/esm/service-operation/ServiceOperationUseIsFetchingQueries.js +0 -1
  463. package/dist/esm/service-operation/ServiceOperationUseIsFetchingQueries.js.map +0 -1
  464. package/dist/esm/service-operation/ServiceOperationUseIsMutating.js +0 -1
  465. package/dist/esm/service-operation/ServiceOperationUseIsMutating.js.map +0 -1
  466. package/dist/esm/service-operation/ServiceOperationUseMutation.js +0 -1
  467. package/dist/esm/service-operation/ServiceOperationUseMutation.js.map +0 -1
  468. package/dist/esm/service-operation/ServiceOperationUseMutationState.js +0 -1
  469. package/dist/esm/service-operation/ServiceOperationUseMutationState.js.map +0 -1
  470. package/dist/esm/service-operation/ServiceOperationUseQueries.js +0 -1
  471. package/dist/esm/service-operation/ServiceOperationUseQueries.js.map +0 -1
  472. package/dist/esm/service-operation/ServiceOperationUseQuery.js +0 -1
  473. package/dist/esm/service-operation/ServiceOperationUseQuery.js.map +0 -1
  474. package/dist/esm/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js +0 -1
  475. package/dist/esm/service-operation/ServiceOperationUseSuspenseInfiniteQuery.js.map +0 -1
  476. package/dist/esm/service-operation/ServiceOperationUseSuspenseQueries.js +0 -1
  477. package/dist/esm/service-operation/ServiceOperationUseSuspenseQueries.js.map +0 -1
  478. package/dist/esm/service-operation/ServiceOperationUseSuspenseQueryQuery.js +0 -1
  479. package/dist/esm/service-operation/ServiceOperationUseSuspenseQueryQuery.js.map +0 -1
  480. package/dist/esm/service-operation/index.js +0 -1
  481. package/dist/esm/service-operation/index.js.map +0 -1
@@ -1,202 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var requestFn_exports = {};
20
- __export(requestFn_exports, {
21
- baseRequestFn: () => baseRequestFn,
22
- bodySerializer: () => bodySerializer,
23
- mergeHeaders: () => mergeHeaders,
24
- requestFn: () => requestFn,
25
- urlSerializer: () => urlSerializer
26
- });
27
- module.exports = __toCommonJS(requestFn_exports);
28
- async function requestFn(schema, requestInfo, options) {
29
- return baseRequestFn(schema, requestInfo, {
30
- urlSerializer,
31
- bodySerializer,
32
- ...options
33
- });
34
- }
35
- async function baseRequestFn(requestSchema, requestInfo, options) {
36
- const { parameters, headers, body, ...requestInfoRest } = requestInfo;
37
- const requestBody = options.bodySerializer(requestSchema, requestInfo);
38
- const baseFetch = options.fetch ?? fetch;
39
- const response = await baseFetch(
40
- options.urlSerializer(requestSchema, requestInfo),
41
- {
42
- method: requestSchema.method.toUpperCase(),
43
- body: requestBody,
44
- headers: mergeHeaders(
45
- {
46
- Accept: "application/json",
47
- "Content-Type": requestSchema.mediaType ?? getBodyContentType(body)
48
- },
49
- headers,
50
- parameters?.header,
51
- requestBody instanceof FormData ? (
52
- // remove `Content-Type` if serialized body is FormData; browser will correctly set Content-Type & boundary expression
53
- { "Content-Type": null }
54
- ) : void 0
55
- ),
56
- ...requestInfoRest
57
- }
58
- );
59
- const clonedResponse = response.clone();
60
- if (!response.ok) {
61
- throw await getResponseBody(clonedResponse);
62
- }
63
- return await getResponseBody(clonedResponse);
64
- }
65
- function urlSerializer(schema, info) {
66
- const path = schema.url.replace(
67
- /{(.*?)}/g,
68
- (substring, group) => {
69
- if (info.parameters?.path && Object.prototype.hasOwnProperty.call(info.parameters.path, group)) {
70
- return encodeURI(String(info.parameters?.path[group]));
71
- }
72
- return substring;
73
- }
74
- );
75
- const baseUrl = info.baseUrl ?? "";
76
- if (info.parameters?.query) {
77
- return `${baseUrl}${path}${getQueryString(info.parameters.query)}`;
78
- }
79
- return `${baseUrl}${path}`;
80
- }
81
- function getQueryString(params) {
82
- const qs = [];
83
- const append = (key, value) => {
84
- qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
85
- };
86
- const process2 = (key, value) => {
87
- if (typeof value === "undefined" || value === null) return;
88
- if (Array.isArray(value)) {
89
- value.forEach((v) => {
90
- process2(key, v);
91
- });
92
- } else if (typeof value === "object") {
93
- Object.entries(value).forEach(([k, v]) => {
94
- process2(`${key}[${k}]`, v);
95
- });
96
- } else {
97
- append(key, value);
98
- }
99
- };
100
- Object.entries(params).forEach(([key, value]) => {
101
- process2(key, value);
102
- });
103
- if (qs.length > 0) {
104
- return `?${qs.join("&")}`;
105
- }
106
- return "";
107
- }
108
- function mergeHeaders(...allHeaders) {
109
- const headers = new Headers();
110
- for (const headerSet of allHeaders) {
111
- if (!headerSet || typeof headerSet !== "object") {
112
- continue;
113
- }
114
- const headersIterator = headerSet instanceof Headers ? headerSet.entries() : Object.entries(headerSet);
115
- for (const [headerKey, headerValue] of headersIterator) {
116
- if (headerValue === null) {
117
- headers.delete(headerKey);
118
- } else if (headerValue !== void 0) {
119
- headers.set(headerKey, headerValue);
120
- }
121
- }
122
- }
123
- return headers;
124
- }
125
- function bodySerializer(schema, info) {
126
- if (info.body === void 0) return;
127
- if (schema.method === "get" || schema.method === "head" || schema.method === "options")
128
- return;
129
- if (schema.mediaType?.includes("/form-data"))
130
- return getRequestBodyFormData(info);
131
- if (!schema.mediaType?.includes("/json") && (typeof info.body === "string" || info.body instanceof Blob || info.body instanceof FormData)) {
132
- return info.body;
133
- }
134
- return JSON.stringify(info.body);
135
- }
136
- function getRequestBodyFormData({
137
- body
138
- }) {
139
- if (body instanceof FormData) return body;
140
- if (body === null) return;
141
- if (body instanceof Blob) throw new Error("Blob not supported in form-data");
142
- if (body instanceof ArrayBuffer)
143
- throw new Error("ArrayBuffer not supported in form-data");
144
- if (body instanceof URLSearchParams)
145
- throw new Error("URLSearchParams not supported in form-data");
146
- if (body instanceof ReadableStream)
147
- throw new Error("ReadableStream not supported in form-data");
148
- if (typeof body === "string")
149
- throw new Error("String not supported in form-data");
150
- if (typeof body !== "object")
151
- throw new Error(`Unsupported body type ${typeof body} in form-data.`);
152
- const formData = new FormData();
153
- const process2 = (key, value) => {
154
- if (typeof value === "string" || value instanceof Blob) {
155
- formData.append(key, value);
156
- } else {
157
- formData.append(key, JSON.stringify(value));
158
- }
159
- };
160
- Object.entries(body).filter(([_, value]) => typeof value !== "undefined" && value !== null).forEach(([key, value]) => {
161
- if (Array.isArray(value)) {
162
- value.forEach((v) => process2(key, v));
163
- } else {
164
- process2(key, value);
165
- }
166
- });
167
- return formData;
168
- }
169
- function getBodyContentType(body) {
170
- if (!body) return;
171
- if (body instanceof Blob) return body.type || "application/octet-stream";
172
- if (typeof body === "string") return "text/plain";
173
- if (!(body instanceof FormData)) return "application/json";
174
- }
175
- async function getResponseBody(response) {
176
- if (response.status === 204 || response.headers.get("Content-Length") === "0")
177
- return void 0;
178
- const contentType = response.headers.get("Content-Type")?.toLowerCase();
179
- const isJSON = contentType?.includes("/json") || contentType?.includes("+json");
180
- if (isJSON) {
181
- if (response.ok) return response.json();
182
- const errorFallbackResponse = response.clone();
183
- return response.json().catch(() => {
184
- if (process.env.NODE_ENV === "development") {
185
- console.warn(
186
- "Failed to parse response body as JSON. Falling back to .text()"
187
- );
188
- }
189
- return errorFallbackResponse.text();
190
- });
191
- }
192
- return response.text();
193
- }
194
- // Annotate the CommonJS export names for ESM import in node:
195
- 0 && (module.exports = {
196
- baseRequestFn,
197
- bodySerializer,
198
- mergeHeaders,
199
- requestFn,
200
- urlSerializer
201
- });
202
- //# sourceMappingURL=requestFn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/requestFn.ts"],"sourcesContent":["/**\n * This function is used to make a request to a specified endpoint.\n *\n * @template T The expected return type of the request.\n *\n * @param schema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.\n * @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.\n * @param [options] Optional. Additional options for the request. It includes custom urlSerializer, bodySerializer, and fetch function.\n *\n * @returns {Promise<T>} Returns a promise that resolves with the response of the request.\n *\n * @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.\n */\nexport async function requestFn<T>(\n schema: OperationSchema,\n requestInfo: RequestFnInfo,\n options?: RequestFnOptions\n): Promise<T> {\n return baseRequestFn(schema, requestInfo, {\n urlSerializer,\n bodySerializer,\n ...options,\n });\n}\n\n/**\n * This function is used to make a request to a specified endpoint.\n * It's needed to create a custom `requestFn` with a custom `urlSerializer`\n * and `bodySerializer`, with the tree-shaking of the default `requestFn`\n * and its serializers.\n *\n * @template T The expected return type of the request.\n *\n * @param requestSchema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.\n * @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.\n * @param options The options for the request. It includes urlSerializer, bodySerializer, and fetch function. The 'urlSerializer' and 'bodySerializer' are required.\n *\n * @returns {Promise<T>} Returns a promise that resolves with the response of the request.\n *\n * @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.\n */\nexport async function baseRequestFn<T>(\n requestSchema: OperationSchema,\n requestInfo: RequestFnInfo,\n options: WithRequired<RequestFnOptions, 'urlSerializer' | 'bodySerializer'>\n): Promise<T> {\n const { parameters, headers, body, ...requestInfoRest } = requestInfo;\n\n const requestBody = options.bodySerializer(requestSchema, requestInfo);\n\n const baseFetch = options.fetch ?? fetch;\n\n const response = await baseFetch(\n options.urlSerializer(requestSchema, requestInfo),\n {\n method: requestSchema.method.toUpperCase(),\n body: requestBody,\n headers: mergeHeaders(\n {\n Accept: 'application/json',\n 'Content-Type': requestSchema.mediaType ?? getBodyContentType(body),\n },\n headers,\n parameters?.header,\n requestBody instanceof FormData\n ? // remove `Content-Type` if serialized body is FormData; browser will correctly set Content-Type & boundary expression\n { 'Content-Type': null }\n : undefined\n ),\n ...requestInfoRest,\n }\n );\n\n // clone response to allow multiple reads\n const clonedResponse = response.clone();\n\n if (!response.ok) {\n throw await getResponseBody(clonedResponse);\n }\n\n return (await getResponseBody(clonedResponse)) as T;\n}\n\nexport function urlSerializer(\n schema: OperationSchema,\n info: RequestFnPayload\n): string {\n const path = schema.url.replace(\n /{(.*?)}/g,\n (substring: string, group: string) => {\n if (\n info.parameters?.path &&\n Object.prototype.hasOwnProperty.call(info.parameters.path, group)\n ) {\n return encodeURI(String(info.parameters?.path[group]));\n }\n return substring;\n }\n );\n\n const baseUrl = info.baseUrl ?? '';\n\n if (info.parameters?.query) {\n return `${baseUrl}${path}${getQueryString(info.parameters.query)}`;\n }\n\n return `${baseUrl}${path}`;\n}\n\nfunction getQueryString(params: Record<string, any>): string {\n const qs: string[] = [];\n\n const append = (key: string, value: any) => {\n qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);\n };\n\n const process = (key: string, value: any) => {\n if (typeof value === 'undefined' || value === null) return;\n\n if (Array.isArray(value)) {\n value.forEach((v) => {\n process(key, v);\n });\n } else if (typeof value === 'object') {\n Object.entries(value).forEach(([k, v]) => {\n process(`${key}[${k}]`, v);\n });\n } else {\n append(key, value);\n }\n };\n\n Object.entries(params).forEach(([key, value]) => {\n process(key, value);\n });\n\n if (qs.length > 0) {\n return `?${qs.join('&')}`;\n }\n\n return '';\n}\n\nexport function mergeHeaders(...allHeaders: (HeadersOptions | undefined)[]) {\n const headers = new Headers();\n\n for (const headerSet of allHeaders) {\n if (!headerSet || typeof headerSet !== 'object') {\n continue;\n }\n\n const headersIterator =\n headerSet instanceof Headers\n ? headerSet.entries()\n : Object.entries(headerSet);\n\n for (const [headerKey, headerValue] of headersIterator) {\n if (headerValue === null) {\n headers.delete(headerKey);\n } else if (headerValue !== undefined) {\n headers.set(headerKey, headerValue);\n }\n }\n }\n\n return headers;\n}\n\nexport function bodySerializer(\n schema: OperationSchema,\n info: RequestFnPayload\n) {\n if (info.body === undefined) return;\n\n if (\n schema.method === 'get' ||\n schema.method === 'head' ||\n schema.method === 'options'\n )\n return;\n\n if (schema.mediaType?.includes('/form-data'))\n return getRequestBodyFormData(info);\n\n if (\n !schema.mediaType?.includes('/json') &&\n (typeof info.body === 'string' ||\n info.body instanceof Blob ||\n info.body instanceof FormData)\n ) {\n return info.body;\n }\n\n return JSON.stringify(info.body);\n}\n\nfunction getRequestBodyFormData({\n body,\n}: Pick<RequestFnPayload, 'body'>): FormData | undefined {\n if (body instanceof FormData) return body;\n if (body === null) return;\n\n if (body instanceof Blob) throw new Error('Blob not supported in form-data');\n if (body instanceof ArrayBuffer)\n throw new Error('ArrayBuffer not supported in form-data');\n if (body instanceof URLSearchParams)\n throw new Error('URLSearchParams not supported in form-data');\n if (body instanceof ReadableStream)\n throw new Error('ReadableStream not supported in form-data');\n if (typeof body === 'string')\n throw new Error('String not supported in form-data');\n if (typeof body !== 'object')\n throw new Error(`Unsupported body type ${typeof body} in form-data.`);\n\n const formData = new FormData();\n\n const process = (key: string, value: any) => {\n if (typeof value === 'string' || value instanceof Blob) {\n formData.append(key, value);\n } else {\n formData.append(key, JSON.stringify(value));\n }\n };\n\n Object.entries(body)\n .filter(([_, value]) => typeof value !== 'undefined' && value !== null)\n .forEach(([key, value]) => {\n if (Array.isArray(value)) {\n value.forEach((v) => process(key, v));\n } else {\n process(key, value);\n }\n });\n\n return formData;\n}\n\nfunction getBodyContentType(body: RequestFnPayload['body']) {\n if (!body) return;\n if (body instanceof Blob) return body.type || 'application/octet-stream';\n if (typeof body === 'string') return 'text/plain';\n if (!(body instanceof FormData)) return 'application/json';\n}\n\nasync function getResponseBody<T>(response: Response): Promise<T | undefined> {\n if (response.status === 204 || response.headers.get('Content-Length') === '0')\n return undefined;\n\n const contentType = response.headers.get('Content-Type')?.toLowerCase();\n const isJSON =\n contentType?.includes('/json') || contentType?.includes('+json');\n\n if (isJSON) {\n // attempt to parse JSON for successful responses, otherwise fail\n if (response.ok) return response.json();\n\n const errorFallbackResponse = response.clone(); // clone to allow multiple reads\n\n return response.json().catch(() => {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n 'Failed to parse response body as JSON. Falling back to .text()'\n );\n }\n // falling back to .text() when necessary for error messages\n return errorFallbackResponse.text();\n });\n }\n\n return response.text() as Promise<T>;\n}\n\n// To have definitely typed headers without a conversion to stings\nexport type HeadersOptions =\n | HeadersInit\n | Record<string, string | number | boolean | null | undefined>;\n\nexport interface OperationSchema {\n /**\n * Operation path\n * @example /user/{id}\n */\n readonly url: string; //todo::rename to `path`\n\n /**\n * Operation method\n */\n readonly method:\n | 'get'\n | 'put'\n | 'post'\n | 'patch'\n | 'delete'\n | 'options'\n | 'head'\n | 'trace';\n\n /**\n * Media type of the request body\n * @example application/json\n */\n readonly mediaType?: string;\n\n readonly security?: string[];\n}\n\nexport interface RequestFnPayload {\n /**\n * Base URL to use for the request\n * @example 'https://api.example.com'\n */\n baseUrl: string | undefined;\n\n /**\n * OpenAPI parameters\n * @example\n * ```ts\n * { path: {id: 1}, query: {search: 'hello'} }\n * ```\n */\n readonly parameters?: {\n readonly path?: Record<string, any>;\n readonly header?: Record<string, any>;\n readonly query?: Record<string, any>;\n };\n\n /**\n * Request body\n * @example { name: 'John' }\n */\n readonly body?: BodyInit | Record<string, unknown> | null;\n\n /**\n * Tanstack Query Meta\n */\n meta?: Record<string, unknown>;\n\n /** An AbortSignal to set request's signal. */\n signal?: AbortSignal | null;\n}\n\nexport interface RequestFnInfo\n extends RequestFnPayload,\n Omit<RequestInit, 'headers' | 'method' | 'body' | 'signal'> {\n /**\n * Request headers\n * @example { 'X-Auth': '123' }\n */\n readonly headers?: HeadersOptions;\n}\n\nexport interface RequestFnOptions {\n urlSerializer?: typeof urlSerializer;\n bodySerializer?: typeof bodySerializer;\n fetch?: typeof fetch;\n}\n\nexport type RequestFn<T> = typeof requestFn<T>;\n\ntype WithRequired<T, K extends keyof T> = T & {\n [_ in K]: {};\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,eAAsB,UACpB,QACA,aACA,SACY;AACZ,SAAO,cAAc,QAAQ,aAAa;AAAA,IACxC;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACH;AAkBA,eAAsB,cACpB,eACA,aACA,SACY;AACZ,QAAM,EAAE,YAAY,SAAS,MAAM,GAAG,gBAAgB,IAAI;AAE1D,QAAM,cAAc,QAAQ,eAAe,eAAe,WAAW;AAErE,QAAM,YAAY,QAAQ,SAAS;AAEnC,QAAM,WAAW,MAAM;AAAA,IACrB,QAAQ,cAAc,eAAe,WAAW;AAAA,IAChD;AAAA,MACE,QAAQ,cAAc,OAAO,YAAY;AAAA,MACzC,MAAM;AAAA,MACN,SAAS;AAAA,QACP;AAAA,UACE,QAAQ;AAAA,UACR,gBAAgB,cAAc,aAAa,mBAAmB,IAAI;AAAA,QACpE;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,uBAAuB;AAAA;AAAA,UAEnB,EAAE,gBAAgB,KAAK;AAAA,YACvB;AAAA,MACN;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EACF;AAGA,QAAM,iBAAiB,SAAS,MAAM;AAEtC,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,MAAM,gBAAgB,cAAc;AAAA,EAC5C;AAEA,SAAQ,MAAM,gBAAgB,cAAc;AAC9C;AAEO,SAAS,cACd,QACA,MACQ;AACR,QAAM,OAAO,OAAO,IAAI;AAAA,IACtB;AAAA,IACA,CAAC,WAAmB,UAAkB;AACpC,UACE,KAAK,YAAY,QACjB,OAAO,UAAU,eAAe,KAAK,KAAK,WAAW,MAAM,KAAK,GAChE;AACA,eAAO,UAAU,OAAO,KAAK,YAAY,KAAK,KAAK,CAAC,CAAC;AAAA,MACvD;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,UAAU,KAAK,WAAW;AAEhC,MAAI,KAAK,YAAY,OAAO;AAC1B,WAAO,GAAG,OAAO,GAAG,IAAI,GAAG,eAAe,KAAK,WAAW,KAAK,CAAC;AAAA,EAClE;AAEA,SAAO,GAAG,OAAO,GAAG,IAAI;AAC1B;AAEA,SAAS,eAAe,QAAqC;AAC3D,QAAM,KAAe,CAAC;AAEtB,QAAM,SAAS,CAAC,KAAa,UAAe;AAC1C,OAAG,KAAK,GAAG,mBAAmB,GAAG,CAAC,IAAI,mBAAmB,OAAO,KAAK,CAAC,CAAC,EAAE;AAAA,EAC3E;AAEA,QAAMA,WAAU,CAAC,KAAa,UAAe;AAC3C,QAAI,OAAO,UAAU,eAAe,UAAU,KAAM;AAEpD,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,YAAM,QAAQ,CAAC,MAAM;AACnB,QAAAA,SAAQ,KAAK,CAAC;AAAA,MAChB,CAAC;AAAA,IACH,WAAW,OAAO,UAAU,UAAU;AACpC,aAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM;AACxC,QAAAA,SAAQ,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;AAAA,MAC3B,CAAC;AAAA,IACH,OAAO;AACL,aAAO,KAAK,KAAK;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC/C,IAAAA,SAAQ,KAAK,KAAK;AAAA,EACpB,CAAC;AAED,MAAI,GAAG,SAAS,GAAG;AACjB,WAAO,IAAI,GAAG,KAAK,GAAG,CAAC;AAAA,EACzB;AAEA,SAAO;AACT;AAEO,SAAS,gBAAgB,YAA4C;AAC1E,QAAM,UAAU,IAAI,QAAQ;AAE5B,aAAW,aAAa,YAAY;AAClC,QAAI,CAAC,aAAa,OAAO,cAAc,UAAU;AAC/C;AAAA,IACF;AAEA,UAAM,kBACJ,qBAAqB,UACjB,UAAU,QAAQ,IAClB,OAAO,QAAQ,SAAS;AAE9B,eAAW,CAAC,WAAW,WAAW,KAAK,iBAAiB;AACtD,UAAI,gBAAgB,MAAM;AACxB,gBAAQ,OAAO,SAAS;AAAA,MAC1B,WAAW,gBAAgB,QAAW;AACpC,gBAAQ,IAAI,WAAW,WAAW;AAAA,MACpC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,eACd,QACA,MACA;AACA,MAAI,KAAK,SAAS,OAAW;AAE7B,MACE,OAAO,WAAW,SAClB,OAAO,WAAW,UAClB,OAAO,WAAW;AAElB;AAEF,MAAI,OAAO,WAAW,SAAS,YAAY;AACzC,WAAO,uBAAuB,IAAI;AAEpC,MACE,CAAC,OAAO,WAAW,SAAS,OAAO,MAClC,OAAO,KAAK,SAAS,YACpB,KAAK,gBAAgB,QACrB,KAAK,gBAAgB,WACvB;AACA,WAAO,KAAK;AAAA,EACd;AAEA,SAAO,KAAK,UAAU,KAAK,IAAI;AACjC;AAEA,SAAS,uBAAuB;AAAA,EAC9B;AACF,GAAyD;AACvD,MAAI,gBAAgB,SAAU,QAAO;AACrC,MAAI,SAAS,KAAM;AAEnB,MAAI,gBAAgB,KAAM,OAAM,IAAI,MAAM,iCAAiC;AAC3E,MAAI,gBAAgB;AAClB,UAAM,IAAI,MAAM,wCAAwC;AAC1D,MAAI,gBAAgB;AAClB,UAAM,IAAI,MAAM,4CAA4C;AAC9D,MAAI,gBAAgB;AAClB,UAAM,IAAI,MAAM,2CAA2C;AAC7D,MAAI,OAAO,SAAS;AAClB,UAAM,IAAI,MAAM,mCAAmC;AACrD,MAAI,OAAO,SAAS;AAClB,UAAM,IAAI,MAAM,yBAAyB,OAAO,IAAI,gBAAgB;AAEtE,QAAM,WAAW,IAAI,SAAS;AAE9B,QAAMA,WAAU,CAAC,KAAa,UAAe;AAC3C,QAAI,OAAO,UAAU,YAAY,iBAAiB,MAAM;AACtD,eAAS,OAAO,KAAK,KAAK;AAAA,IAC5B,OAAO;AACL,eAAS,OAAO,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,IAC5C;AAAA,EACF;AAEA,SAAO,QAAQ,IAAI,EAChB,OAAO,CAAC,CAAC,GAAG,KAAK,MAAM,OAAO,UAAU,eAAe,UAAU,IAAI,EACrE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACzB,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,YAAM,QAAQ,CAAC,MAAMA,SAAQ,KAAK,CAAC,CAAC;AAAA,IACtC,OAAO;AACL,MAAAA,SAAQ,KAAK,KAAK;AAAA,IACpB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;AAEA,SAAS,mBAAmB,MAAgC;AAC1D,MAAI,CAAC,KAAM;AACX,MAAI,gBAAgB,KAAM,QAAO,KAAK,QAAQ;AAC9C,MAAI,OAAO,SAAS,SAAU,QAAO;AACrC,MAAI,EAAE,gBAAgB,UAAW,QAAO;AAC1C;AAEA,eAAe,gBAAmB,UAA4C;AAC5E,MAAI,SAAS,WAAW,OAAO,SAAS,QAAQ,IAAI,gBAAgB,MAAM;AACxE,WAAO;AAET,QAAM,cAAc,SAAS,QAAQ,IAAI,cAAc,GAAG,YAAY;AACtE,QAAM,SACJ,aAAa,SAAS,OAAO,KAAK,aAAa,SAAS,OAAO;AAEjE,MAAI,QAAQ;AAEV,QAAI,SAAS,GAAI,QAAO,SAAS,KAAK;AAEtC,UAAM,wBAAwB,SAAS,MAAM;AAE7C,WAAO,SAAS,KAAK,EAAE,MAAM,MAAM;AACjC,UAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,gBAAQ;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAEA,aAAO,sBAAsB,KAAK;AAAA,IACpC,CAAC;AAAA,EACH;AAEA,SAAO,SAAS,KAAK;AACvB;","names":["process"]}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var shelfMerge_exports = {};
20
- __export(shelfMerge_exports, {
21
- shelfMerge: () => shelfMerge
22
- });
23
- module.exports = __toCommonJS(shelfMerge_exports);
24
- function shelfMerge(depth = 2, ...args) {
25
- return args.reduce((acc, arg) => {
26
- if (!arg || typeof arg !== "object") return acc;
27
- Object.entries(arg).forEach(([key, value]) => {
28
- if (typeof value !== "object") {
29
- acc[key] = value;
30
- return;
31
- }
32
- if (Array.isArray(value)) {
33
- acc[key] = value;
34
- return;
35
- }
36
- if (depth > 1) {
37
- acc[key] = shelfMerge(
38
- depth - 1,
39
- acc[key],
40
- value
41
- );
42
- return;
43
- }
44
- acc[key] = value;
45
- });
46
- return acc;
47
- }, {});
48
- }
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- shelfMerge
52
- });
53
- //# sourceMappingURL=shelfMerge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/shelfMerge.ts"],"sourcesContent":["/**\n * Merges objects with provided depth\n * @param depth\n * @param args\n */\nexport function shelfMerge<T>(depth = 2, ...args: T[]): T {\n return args.reduce((acc, arg) => {\n if (!arg || typeof arg !== 'object') return acc;\n\n Object.entries(arg).forEach(([key, value]) => {\n if (typeof value !== 'object') {\n acc[key as never] = value as never;\n return;\n }\n\n if (Array.isArray(value)) {\n acc[key as never] = value as never;\n return;\n }\n\n if (depth > 1) {\n acc[key as never] = shelfMerge(\n depth - 1,\n acc[key as never],\n value\n ) as never;\n return;\n }\n\n acc[key as never] = value as never;\n });\n\n return acc;\n }, {} as T);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,WAAc,QAAQ,MAAM,MAAc;AACxD,SAAO,KAAK,OAAO,CAAC,KAAK,QAAQ;AAC/B,QAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAE5C,WAAO,QAAQ,GAAG,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC5C,UAAI,OAAO,UAAU,UAAU;AAC7B,YAAI,GAAY,IAAI;AACpB;AAAA,MACF;AAEA,UAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,YAAI,GAAY,IAAI;AACpB;AAAA,MACF;AAEA,UAAI,QAAQ,GAAG;AACb,YAAI,GAAY,IAAI;AAAA,UAClB,QAAQ;AAAA,UACR,IAAI,GAAY;AAAA,UAChB;AAAA,QACF;AACA;AAAA,MACF;AAEA,UAAI,GAAY,IAAI;AAAA,IACtB,CAAC;AAED,WAAO;AAAA,EACT,GAAG,CAAC,CAAM;AACZ;","names":[]}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var useComposeUseQueryOptions_exports = {};
21
- __export(useComposeUseQueryOptions_exports, {
22
- useComposeUseQueryOptions: () => useComposeUseQueryOptions
23
- });
24
- module.exports = __toCommonJS(useComposeUseQueryOptions_exports);
25
- var import_react = require("react");
26
- var import_QraftContext = require("../QraftContext.js");
27
- var import_composeInfiniteQueryKey = require("./composeInfiniteQueryKey.js");
28
- var import_composeQueryKey = require("./composeQueryKey.js");
29
- var import_shelfMerge = require("./shelfMerge.js");
30
- var import_useQueryClient = require("./useQueryClient.js");
31
- function useComposeUseQueryOptions(qraftOptions, schema, args, infinite) {
32
- const [parameters, options, queryClient] = args;
33
- const contextValue = (0, import_react.useContext)(qraftOptions?.context ?? import_QraftContext.QraftContext);
34
- if (!contextValue?.requestFn)
35
- throw new Error(`QraftContext.requestFn not found`);
36
- const queryFn = options?.queryFn ?? // @ts-expect-error - Too complex to type
37
- function({ queryKey: [, queryParams], signal, meta, pageParam }) {
38
- return contextValue.requestFn(schema, {
39
- // @ts-expect-error - Too complex to type
40
- parameters: infinite ? (0, import_shelfMerge.shelfMerge)(2, queryParams, pageParam) : queryParams,
41
- baseUrl: contextValue.baseUrl,
42
- signal,
43
- meta
44
- });
45
- };
46
- const queryKey = Array.isArray(parameters) ? parameters : infinite ? (0, import_composeInfiniteQueryKey.composeInfiniteQueryKey)(schema, parameters) : (0, import_composeQueryKey.composeQueryKey)(schema, parameters);
47
- return [
48
- { ...options, queryFn, queryKey },
49
- (0, import_useQueryClient.useQueryClient)(qraftOptions, queryClient)
50
- ];
51
- }
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- useComposeUseQueryOptions
55
- });
56
- //# sourceMappingURL=useComposeUseQueryOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/useComposeUseQueryOptions.ts"],"sourcesContent":["'use client';\n\nimport { useContext } from 'react';\n\nimport type { QueryClient } from '@tanstack/query-core';\nimport type { UseQueryOptions } from '@tanstack/react-query';\n\nimport type { QraftClientOptions } from '../qraftAPIClient.js';\nimport { QraftContext } from '../QraftContext.js';\nimport type { ServiceOperationQueryKey } from '../service-operation/ServiceOperationKey.js';\nimport { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js';\nimport { composeQueryKey } from './composeQueryKey.js';\nimport type { OperationSchema } from './requestFn.js';\nimport { shelfMerge } from './shelfMerge.js';\nimport { useQueryClient } from './useQueryClient.js';\n\n/**\n * Composes the options for useQuery, useInfiniteQuery, useSuspenseQuery, and useSuspenseQueries.\n * @internal\n */\nexport function useComposeUseQueryOptions(\n qraftOptions: QraftClientOptions | undefined,\n schema: OperationSchema,\n args: UseQueryOptionsArgs,\n infinite: boolean\n): never {\n const [parameters, options, queryClient] = args;\n\n const contextValue = useContext(qraftOptions?.context ?? QraftContext);\n if (!contextValue?.requestFn)\n throw new Error(`QraftContext.requestFn not found`);\n\n const queryFn =\n options?.queryFn ??\n // @ts-expect-error - Too complex to type\n function ({ queryKey: [, queryParams], signal, meta, pageParam }) {\n return contextValue.requestFn(schema, {\n // @ts-expect-error - Too complex to type\n parameters: infinite\n ? (shelfMerge(2, queryParams, pageParam) as never)\n : queryParams,\n baseUrl: contextValue.baseUrl,\n signal,\n meta,\n });\n };\n\n const queryKey = Array.isArray(parameters)\n ? (parameters as ServiceOperationQueryKey<OperationSchema, unknown>)\n : infinite\n ? composeInfiniteQueryKey(schema, parameters)\n : composeQueryKey(schema, parameters);\n\n return [\n { ...options, queryFn, queryKey },\n useQueryClient(qraftOptions, queryClient),\n ] as never;\n}\n\ntype UseQueryOptionsArgs = [\n parameters: unknown,\n options?: UseQueryOptions,\n queryClient?: QueryClient,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2B;AAM3B,0BAA6B;AAE7B,qCAAwC;AACxC,6BAAgC;AAEhC,wBAA2B;AAC3B,4BAA+B;AAMxB,SAAS,0BACd,cACA,QACA,MACA,UACO;AACP,QAAM,CAAC,YAAY,SAAS,WAAW,IAAI;AAE3C,QAAM,mBAAe,yBAAW,cAAc,WAAW,gCAAY;AACrE,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,kCAAkC;AAEpD,QAAM,UACJ,SAAS;AAAA,EAET,SAAU,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,QAAQ,MAAM,UAAU,GAAG;AAChE,WAAO,aAAa,UAAU,QAAQ;AAAA;AAAA,MAEpC,YAAY,eACP,8BAAW,GAAG,aAAa,SAAS,IACrC;AAAA,MACJ,SAAS,aAAa;AAAA,MACtB;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEF,QAAM,WAAW,MAAM,QAAQ,UAAU,IACpC,aACD,eACE,wDAAwB,QAAQ,UAAU,QAC1C,wCAAgB,QAAQ,UAAU;AAExC,SAAO;AAAA,IACL,EAAE,GAAG,SAAS,SAAS,SAAS;AAAA,QAChC,sCAAe,cAAc,WAAW;AAAA,EAC1C;AACF;","names":[]}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var useQueryClient_exports = {};
21
- __export(useQueryClient_exports, {
22
- useQueryClient: () => useQueryClient
23
- });
24
- module.exports = __toCommonJS(useQueryClient_exports);
25
- var import_react = require("react");
26
- var import_react_query = require("@tanstack/react-query");
27
- var import_QraftContext = require("../QraftContext.js");
28
- function useQueryClient(qraftOptions, queryClient) {
29
- const queryClientByContext = (0, import_react.useContext)(
30
- qraftOptions?.context ?? import_QraftContext.QraftContext
31
- )?.queryClient;
32
- return (0, import_react_query.useQueryClient)(queryClient ?? queryClientByContext);
33
- }
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- useQueryClient
37
- });
38
- //# sourceMappingURL=useQueryClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/useQueryClient.ts"],"sourcesContent":["'use client';\n\nimport { useContext } from 'react';\n\nimport {\n QueryClient,\n useQueryClient as useQueryClientTanstack,\n} from '@tanstack/react-query';\n\nimport type { QraftClientOptions } from '../qraftAPIClient.js';\nimport { QraftContext } from '../QraftContext.js';\n\n/**\n * Get the QueryClient from the QraftContext or the provided QueryClient argument.\n * @param qraftOptions if `queryClient` is not provided, will be taken from context\n * @param queryClient If not provided, will be taken this instance\n */\nexport function useQueryClient(\n qraftOptions: QraftClientOptions | undefined,\n queryClient: QueryClient | undefined\n) {\n const queryClientByContext = useContext(\n qraftOptions?.context ?? QraftContext\n )?.queryClient;\n\n return useQueryClientTanstack(queryClient ?? queryClientByContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2B;AAE3B,yBAGO;AAGP,0BAA6B;AAOtB,SAAS,eACd,cACA,aACA;AACA,QAAM,2BAAuB;AAAA,IAC3B,cAAc,WAAW;AAAA,EAC3B,GAAG;AAEH,aAAO,mBAAAA,gBAAuB,eAAe,oBAAoB;AACnE;","names":["useQueryClientTanstack"]}
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var qraftAPIClient_exports = {};
20
- __export(qraftAPIClient_exports, {
21
- qraftAPIClient: () => qraftAPIClient
22
- });
23
- module.exports = __toCommonJS(qraftAPIClient_exports);
24
- var import_createRecursiveProxy = require("./lib/createRecursiveProxy.js");
25
- const qraftAPIClient = (services, callbacks, options) => {
26
- return (0, import_createRecursiveProxy.createRecursiveProxy)(
27
- function getCallback(getPath, key) {
28
- if (getPath.length !== 2 || key !== "schema") return;
29
- const serviceOperation = getByPath(services, getPath);
30
- if (!isServiceOperation(serviceOperation))
31
- throw new Error(`Service operation not found: ${getPath.join(".")}`);
32
- return serviceOperation.schema;
33
- },
34
- function applyCallback(applyPath, args) {
35
- const { path, callbackName } = extractCallbackDetails(applyPath);
36
- if (!(callbackName in callbacks))
37
- throw new Error(`Function ${callbackName} is not supported`);
38
- const serviceOperation = getByPath(services, path);
39
- if (!isServiceOperation(serviceOperation))
40
- throw new Error(`Service operation not found: ${path.join(".")}`);
41
- return callbacks[callbackName](
42
- options,
43
- serviceOperation.schema,
44
- args
45
- );
46
- },
47
- []
48
- );
49
- };
50
- function extractCallbackDetails(applyPath) {
51
- if (applyPath.length === 2) {
52
- return {
53
- path: applyPath,
54
- callbackName: "operationInvokeFn"
55
- };
56
- } else {
57
- return {
58
- path: applyPath.slice(0, -1),
59
- // The last arg is for instance `.useMutation` or `.useQuery()`
60
- callbackName: applyPath[applyPath.length - 1]
61
- };
62
- }
63
- }
64
- function isServiceOperation(input) {
65
- return input !== null && typeof input === "object" && "schema" in input;
66
- }
67
- function getByPath(obj, path) {
68
- return path.reduce((acc, key) => {
69
- if (acc && typeof acc === "object" && key in acc)
70
- return acc[key];
71
- }, obj);
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- qraftAPIClient
76
- });
77
- //# sourceMappingURL=qraftAPIClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/qraftAPIClient.ts"],"sourcesContent":["import type { Context } from 'react';\n\nimport type * as operationInvokeModule from './callbacks/operationInvokeFn.js';\nimport { createRecursiveProxy } from './lib/createRecursiveProxy.js';\nimport type { OperationSchema } from './lib/requestFn.js';\nimport type { QraftContextValue } from './QraftContext.js';\n\nexport interface QraftClientOptions {\n context?: Context<QraftContextValue>;\n}\n\nexport const qraftAPIClient = <\n Services extends ServicesBaseDeclaration<Services>,\n Callbacks extends ServicesCallbacks,\n>(\n services: ServicesDeclaration<Services>,\n callbacks: Callbacks,\n options?: QraftClientOptions\n): Services => {\n return createRecursiveProxy(\n function getCallback(getPath, key) {\n if (getPath.length !== 2 || key !== 'schema') return; // todo::maybe return callback?\n\n const serviceOperation = getByPath(services, getPath);\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${getPath.join('.')}`);\n return serviceOperation.schema;\n },\n function applyCallback(applyPath, args) {\n const { path, callbackName } = extractCallbackDetails(applyPath);\n\n if (!(callbackName in callbacks))\n throw new Error(`Function ${callbackName} is not supported`);\n\n const serviceOperation = getByPath(services, path);\n\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${path.join('.')}`);\n\n return callbacks[callbackName as keyof Callbacks](\n options,\n serviceOperation.schema,\n args\n );\n },\n []\n ) as never;\n};\n\n/**\n * Extracts Callback details from the applyPath\n * @param applyPath\n */\nfunction extractCallbackDetails(applyPath: string[]) {\n // <service>.<operation>()\n if (applyPath.length === 2) {\n return {\n path: applyPath,\n callbackName: 'operationInvokeFn' satisfies Extract<\n keyof typeof operationInvokeModule,\n 'operationInvokeFn'\n >,\n };\n } else {\n // <service>.<operation>.<method>()\n return {\n path: applyPath.slice(0, -1),\n // The last arg is for instance `.useMutation` or `.useQuery()`\n callbackName: applyPath[applyPath.length - 1],\n };\n }\n}\n\nfunction isServiceOperation(\n input: unknown\n): input is { schema: OperationSchema } {\n return input !== null && typeof input === 'object' && 'schema' in input;\n}\n\nfunction getByPath(obj: Record<string, unknown>, path: string[]) {\n return path.reduce<unknown>((acc, key) => {\n if (acc && typeof acc === 'object' && key in acc)\n return acc[key as keyof typeof acc];\n }, obj);\n}\n\ntype ServicesBaseDeclaration<Services> = {\n [service in keyof Services]: {\n [method in keyof Services[service]]: { schema: OperationSchema };\n };\n};\n\ntype ServicesDeclaration<Services extends ServicesBaseDeclaration<Services>> = {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: Services[service][method]['schema'];\n };\n };\n};\n\ntype ServicesCallbacks = Record<string, (...rest: any[]) => unknown>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kCAAqC;AAQ9B,MAAM,iBAAiB,CAI5B,UACA,WACA,YACa;AACb,aAAO;AAAA,IACL,SAAS,YAAY,SAAS,KAAK;AACjC,UAAI,QAAQ,WAAW,KAAK,QAAQ,SAAU;AAE9C,YAAM,mBAAmB,UAAU,UAAU,OAAO;AACpD,UAAI,CAAC,mBAAmB,gBAAgB;AACtC,cAAM,IAAI,MAAM,gCAAgC,QAAQ,KAAK,GAAG,CAAC,EAAE;AACrE,aAAO,iBAAiB;AAAA,IAC1B;AAAA,IACA,SAAS,cAAc,WAAW,MAAM;AACtC,YAAM,EAAE,MAAM,aAAa,IAAI,uBAAuB,SAAS;AAE/D,UAAI,EAAE,gBAAgB;AACpB,cAAM,IAAI,MAAM,YAAY,YAAY,mBAAmB;AAE7D,YAAM,mBAAmB,UAAU,UAAU,IAAI;AAEjD,UAAI,CAAC,mBAAmB,gBAAgB;AACtC,cAAM,IAAI,MAAM,gCAAgC,KAAK,KAAK,GAAG,CAAC,EAAE;AAElE,aAAO,UAAU,YAA+B;AAAA,QAC9C;AAAA,QACA,iBAAiB;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAMA,SAAS,uBAAuB,WAAqB;AAEnD,MAAI,UAAU,WAAW,GAAG;AAC1B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,cAAc;AAAA,IAIhB;AAAA,EACF,OAAO;AAEL,WAAO;AAAA,MACL,MAAM,UAAU,MAAM,GAAG,EAAE;AAAA;AAAA,MAE3B,cAAc,UAAU,UAAU,SAAS,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;AAEA,SAAS,mBACP,OACsC;AACtC,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,YAAY;AACpE;AAEA,SAAS,UAAU,KAA8B,MAAgB;AAC/D,SAAO,KAAK,OAAgB,CAAC,KAAK,QAAQ;AACxC,QAAI,OAAO,OAAO,QAAQ,YAAY,OAAO;AAC3C,aAAO,IAAI,GAAuB;AAAA,EACtC,GAAG,GAAG;AACR;","names":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var OperationInfiniteData_exports = {};
16
- module.exports = __toCommonJS(OperationInfiniteData_exports);
17
- //# sourceMappingURL=OperationInfiniteData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/service-operation/OperationInfiniteData.ts"],"sourcesContent":["import type { InfiniteData } from '@tanstack/query-core';\n\nimport type { PartialParameters } from '../lib/PartialParameters.type.js';\n\nexport type OperationInfiniteData<TData, TParams> = InfiniteData<\n TData,\n PartialParameters<TParams>\n>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var QueryFilters_exports = {};
16
- module.exports = __toCommonJS(QueryFilters_exports);
17
- //# sourceMappingURL=QueryFilters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/service-operation/QueryFilters.ts"],"sourcesContent":["import type { DefaultError, FetchStatus, Query } from '@tanstack/query-core';\n\nimport type { PartialParameters } from '../lib/PartialParameters.type.js';\nimport type { OperationInfiniteData } from './OperationInfiniteData.js';\nimport type {\n ServiceOperationBaseQueryKey,\n ServiceOperationInfiniteQueryKey,\n ServiceOperationQueryKey,\n} from './ServiceOperationKey.js';\n\nexport type QueryTypeFilter = 'all' | 'active' | 'inactive';\n\ninterface QueryFiltersBase<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> {\n /**\n * Include queries matching this predicate function\n */\n predicate?: TInfinite extends true\n ? QueryFilterInfinitePredicate<TSchema, TData, TParams, TError>\n : TInfinite extends false\n ? QueryFilterRegularPredicate<TSchema, TData, TParams, TError>\n : (query: string) => boolean;\n\n /**\n * Filter to active queries, inactive queries or all queries\n */\n type?: QueryTypeFilter;\n\n /**\n * Include or exclude stale queries\n */\n stale?: boolean;\n\n /**\n * Include queries matching their fetchStatus\n */\n fetchStatus?: FetchStatus;\n}\n\ninterface QueryFiltersByQueryKeyBase<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {\n infinite?: never;\n parameters?: never;\n}\n\ninterface QueryFiltersByExactQueryKey<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> extends QueryFiltersByQueryKeyBase<\n TSchema,\n TData,\n TInfinite,\n TParams,\n TError\n > {\n /**\n * Include queries matching this query key\n */\n queryKey: ServiceOperationBaseQueryKey<TSchema, TInfinite, TParams>;\n\n /**\n * Match query key exactly\n */\n exact: true;\n}\n\ninterface QueryFiltersWeakExactQueryKey<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> extends QueryFiltersByQueryKeyBase<\n TSchema,\n TData,\n TInfinite,\n TParams,\n TError\n > {\n /**\n * Include queries matching this query key\n */\n queryKey?: ServiceOperationBaseQueryKey<\n TSchema,\n TInfinite,\n PartialParameters<TParams>\n >;\n\n /**\n * Match query key exactly\n */\n exact?: false;\n}\n\nexport type QueryFiltersByQueryKey<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> =\n | QueryFiltersByExactQueryKey<TSchema, TData, TInfinite, TParams, TError>\n | QueryFiltersWeakExactQueryKey<TSchema, TData, TInfinite, TParams, TError>;\n\ninterface QueryFiltersByParametersBase<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {\n /**\n * Is the query infinite\n */\n infinite?: TInfinite;\n\n queryKey?: never;\n}\n\ninterface QueryFiltersByExactParameters<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> extends QueryFiltersByParametersBase<\n TSchema,\n TData,\n TInfinite,\n TParams,\n TError\n > {\n /**\n * Match query key exactly\n */\n exact: true;\n\n /**\n * Include queries matching parameters\n */\n parameters: TParams;\n}\n\ninterface QueryFiltersByWeakParameters<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> extends QueryFiltersByParametersBase<\n TSchema,\n TData,\n TInfinite,\n TParams,\n TError\n > {\n /**\n * Match query key exactly\n */\n exact?: false;\n\n /**\n * Include queries matching parameters\n */\n parameters?: PartialParameters<TParams>;\n}\n\nexport type QueryFiltersByParameters<\n TSchema extends { url: string; method: string },\n TData,\n TInfinite extends boolean,\n TParams = {},\n TError = DefaultError,\n> =\n | QueryFiltersByExactParameters<TSchema, TData, TInfinite, TParams, TError>\n | QueryFiltersByWeakParameters<TSchema, TData, TInfinite, TParams, TError>;\n\ninterface QueryFilterInfinitePredicate<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TError = DefaultError,\n> {\n /**\n * Include queries matching this predicate function\n */\n (\n query: Query<\n OperationInfiniteData<TData, TParams>,\n TError,\n OperationInfiniteData<TData, TParams>,\n ServiceOperationInfiniteQueryKey<TSchema, TParams>\n >\n ): boolean;\n}\n\ninterface QueryFilterRegularPredicate<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TError = DefaultError,\n> {\n /**\n * Include queries matching this predicate function\n */\n (\n query: Query<\n TData,\n TError,\n TData,\n ServiceOperationQueryKey<TSchema, TParams>\n >\n ): boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var ServiceOperation_exports = {};
16
- module.exports = __toCommonJS(ServiceOperation_exports);
17
- //# sourceMappingURL=ServiceOperation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/service-operation/ServiceOperation.ts"],"sourcesContent":["import type { DefaultError } from '@tanstack/query-core';\n\nimport type { ServiceOperationCancelQueries } from './ServiceOperationCancelQueries.js';\nimport type { ServiceOperationFetchInfiniteQuery } from './ServiceOperationFetchInfiniteQuery.js';\nimport type { ServiceOperationFetchQuery } from './ServiceOperationFetchQuery.js';\nimport type { ServiceOperationGetInfiniteQueryData } from './ServiceOperationGetInfiniteQueryData.js';\nimport type { ServiceOperationGetQueriesData } from './ServiceOperationGetQueriesData.js';\nimport type { ServiceOperationGetQueryData } from './ServiceOperationGetQueryData.js';\nimport type { ServiceOperationGetQueryState } from './ServiceOperationGetQueryState.js';\nimport type { ServiceOperationInvalidateQueries } from './ServiceOperationInvalidateQueries.js';\nimport type { ServiceOperationIsFetchingQueries } from './ServiceOperationIsFetchingQueries.js';\nimport type { ServiceOperationIsMutatingQueries } from './ServiceOperationIsMutatingQueries.js';\nimport type { ServiceOperationMutationFn } from './ServiceOperationMutationFn.js';\nimport type { ServiceOperationQueryFn } from './ServiceOperationQueryFn.js';\nimport type { ServiceOperationRefetchQueries } from './ServiceOperationRefetchQueries.js';\nimport type { ServiceOperationRemoveQueries } from './ServiceOperationRemoveQueries.js';\nimport type { ServiceOperationResetQueries } from './ServiceOperationResetQueries.js';\nimport type { ServiceOperationSetInfiniteQueryData } from './ServiceOperationSetInfiniteQueryData.js';\nimport type { ServiceOperationSetQueriesData } from './ServiceOperationSetQueriesData.js';\nimport type { ServiceOperationSetQueryData } from './ServiceOperationSetQueryData.js';\nimport type { ServiceOperationUseInfiniteQuery } from './ServiceOperationUseInfiniteQuery.js';\nimport type { ServiceOperationUseIsFetchingQueries } from './ServiceOperationUseIsFetchingQueries.js';\nimport type { ServiceOperationUseIsMutating } from './ServiceOperationUseIsMutating.js';\nimport type { ServiceOperationUseMutation } from './ServiceOperationUseMutation.js';\nimport type { ServiceOperationUseMutationState } from './ServiceOperationUseMutationState.js';\nimport type { ServiceOperationUseQueries } from './ServiceOperationUseQueries.js';\nimport type { ServiceOperationUseQuery } from './ServiceOperationUseQuery.js';\nimport type { ServiceOperationUseSuspenseInfiniteQuery } from './ServiceOperationUseSuspenseInfiniteQuery.js';\nimport type { ServiceOperationUseSuspenseQueries } from './ServiceOperationUseSuspenseQueries.js';\nimport type { ServiceOperationUseSuspenseQueryQuery } from './ServiceOperationUseSuspenseQueryQuery.js';\n\nexport interface ServiceOperationQuery<\n TSchema extends { url: string; method: string },\n TData,\n TParams,\n TError = DefaultError,\n> extends ServiceOperationUseQuery<TSchema, TData, TParams, TError>,\n ServiceOperationUseQueries<TSchema, TData, TParams, TError>,\n ServiceOperationUseSuspenseQueries<TSchema, TData, TParams, TError>,\n ServiceOperationUseInfiniteQuery<TSchema, TData, TParams, TError>,\n ServiceOperationUseSuspenseQueryQuery<TSchema, TData, TParams, TError>,\n ServiceOperationUseSuspenseInfiniteQuery<TSchema, TData, TParams, TError>,\n ServiceOperationUseIsFetchingQueries<TSchema, TData, TParams, TError>,\n ServiceOperationQueryFn<TSchema, TData, TParams>,\n ServiceOperationFetchQuery<TSchema, TData, TParams, TError>,\n ServiceOperationFetchInfiniteQuery<TSchema, TData, TParams, TError>,\n ServiceOperationGetQueryData<TSchema, TData, TParams>,\n ServiceOperationGetQueryState<TSchema, TData, TParams, TError>,\n ServiceOperationGetQueriesData<TSchema, TData, TParams, TError>,\n ServiceOperationGetInfiniteQueryData<TSchema, TData, TParams>,\n ServiceOperationSetQueryData<TSchema, TData, TParams>,\n ServiceOperationSetQueriesData<TSchema, TData, TParams, TError>,\n ServiceOperationSetInfiniteQueryData<TSchema, TData, TParams>,\n ServiceOperationInvalidateQueries<TSchema, TData, TParams, TError>,\n ServiceOperationCancelQueries<TSchema, TData, TParams, TError>,\n ServiceOperationRemoveQueries<TSchema, TData, TParams, TError>,\n ServiceOperationResetQueries<TSchema, TData, TParams, TError>,\n ServiceOperationRefetchQueries<TSchema, TData, TParams, TError>,\n ServiceOperationIsFetchingQueries<TSchema, TData, TParams, TError> {\n schema: TSchema;\n types: {\n parameters: TParams;\n data: TData;\n error: TError;\n };\n}\n\nexport interface ServiceOperationMutation<\n TSchema extends { url: string; method: string },\n TBody,\n TData,\n TParams,\n TError = DefaultError,\n> extends ServiceOperationUseMutation<TSchema, TBody, TData, TParams, TError>,\n ServiceOperationUseIsMutating<TSchema, TBody, TData, TParams, TError>,\n ServiceOperationUseMutationState<TSchema, TBody, TData, TParams, TError>,\n ServiceOperationIsMutatingQueries<TSchema, TBody, TData, TParams, TError>,\n ServiceOperationMutationFn<TSchema, TBody, TData, TParams> {\n schema: TSchema;\n types: {\n parameters: TParams;\n data: TData;\n error: TError;\n body: TBody;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var ServiceOperationCancelQueries_exports = {};
16
- module.exports = __toCommonJS(ServiceOperationCancelQueries_exports);
17
- //# sourceMappingURL=ServiceOperationCancelQueries.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/service-operation/ServiceOperationCancelQueries.ts"],"sourcesContent":["import type {\n CancelOptions,\n DefaultError,\n QueryClient,\n} from '@tanstack/query-core';\n\nimport type {\n QueryFiltersByParameters,\n QueryFiltersByQueryKey,\n} from './QueryFilters.js';\n\nexport interface ServiceOperationCancelQueries<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TError = DefaultError,\n> {\n cancelQueries<TInfinite extends boolean>(\n filters:\n | QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>\n | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,\n options: CancelOptions,\n queryClient: QueryClient\n ): Promise<void>;\n\n cancelQueries<TInfinite extends boolean>(\n filters:\n | QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>\n | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>,\n queryClient: QueryClient\n ): Promise<void>;\n\n cancelQueries(queryClient: QueryClient): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport interface ServiceOperationCancelQueriesCallback<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TError = DefaultError,\n> extends ServiceOperationCancelQueries<TSchema, TData, TParams, TError> {\n cancelQueries<TInfinite extends boolean>(\n filters:\n | QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError>\n | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>\n | QueryClient,\n options?: CancelOptions | QueryClient,\n queryClient?: QueryClient\n ): Promise<void>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var ServiceOperationFetchInfiniteQuery_exports = {};
16
- module.exports = __toCommonJS(ServiceOperationFetchInfiniteQuery_exports);
17
- //# sourceMappingURL=ServiceOperationFetchInfiniteQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/service-operation/ServiceOperationFetchInfiniteQuery.ts"],"sourcesContent":["import type {\n DefaultError,\n FetchQueryOptions,\n GetNextPageParamFunction,\n InitialPageParam,\n QueryClient,\n QueryFunction,\n} from '@tanstack/query-core';\n\nimport type { PartialParameters } from '../lib/PartialParameters.type.js';\nimport type { RequestFn } from '../lib/requestFn.js';\nimport type { OperationInfiniteData } from './OperationInfiniteData.js';\nimport type {\n ServiceOperationInfiniteQueryKey,\n ServiceOperationQueryKey,\n} from './ServiceOperationKey.js';\n\nexport interface ServiceOperationFetchInfiniteQuery<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TError = DefaultError,\n> {\n fetchInfiniteQuery<TPageParam extends TParams>(\n options:\n | (FetchInfiniteQueryOptionsByQueryKey<\n TSchema,\n TData,\n TParams,\n TPageParam,\n TError\n > &\n FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>)\n | (FetchInfiniteQueryOptionsByParameters<\n TSchema,\n TData,\n TParams,\n TPageParam,\n TError\n > &\n FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>),\n queryClient: QueryClient\n ): Promise<OperationInfiniteData<TData, TParams>>;\n\n prefetchInfiniteQuery<TPageParam extends TParams>(\n options:\n | (FetchInfiniteQueryOptionsByQueryKey<\n TSchema,\n TData,\n TParams,\n TPageParam,\n TError\n > &\n FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>)\n | (FetchInfiniteQueryOptionsByParameters<\n TSchema,\n TData,\n TParams,\n TPageParam,\n TError\n > &\n FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>),\n queryClient: QueryClient\n ): Promise<void>;\n}\n\ntype FetchInfiniteQueryPages<TData = unknown, TPageParam = unknown> =\n | {\n pages?: never;\n }\n | {\n pages: number;\n getNextPageParam: GetNextPageParamFunction<\n PartialParameters<TPageParam>,\n TData\n >;\n };\n\ntype FetchInfiniteQueryOptionsBase<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TPageParam = unknown,\n TError = DefaultError,\n> = Omit<\n FetchQueryOptions<\n TData,\n TError,\n OperationInfiniteData<TData, TParams>,\n ServiceOperationQueryKey<TSchema, TParams>,\n TPageParam\n >,\n 'queryKey'\n> &\n InitialPageParam<PartialParameters<TPageParam>> &\n FetchInfiniteQueryPages<TData, TPageParam>;\n\ntype FetchInfiniteQueryOptionsByQueryKey<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TPageParam = {},\n TError = DefaultError,\n> = FetchInfiniteQueryOptionsBase<\n TSchema,\n TData,\n TParams,\n TPageParam,\n TError\n> & {\n /**\n * Fetch Queries by query key\n */\n queryKey?: ServiceOperationInfiniteQueryKey<TSchema, TParams>;\n parameters?: never;\n};\ntype FetchInfiniteQueryOptionsByParameters<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n TPageParam = {},\n TError = DefaultError,\n> = FetchInfiniteQueryOptionsBase<\n TSchema,\n TData,\n TParams,\n TPageParam,\n TError\n> & {\n /**\n * Fetch Queries by parameters\n */\n parameters?: TParams;\n queryKey?: never;\n};\n\ntype FetchInfiniteQueryOptionsQueryFn<\n TSchema extends { url: string; method: string },\n TData,\n TParams = {},\n> =\n | {\n queryFn?: QueryFunction<\n TData,\n ServiceOperationInfiniteQueryKey<TSchema, TParams>\n >;\n }\n | {\n requestFn: RequestFn<TData>;\n /**\n * Base URL to use for the request (used in the `queryFn`)\n * @example 'https://api.example.com'\n */\n baseUrl: string | undefined;\n queryFn?: never; // Workaround to fix union type error\n };\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}