@multiplatform.one/frappe 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (858) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +241 -0
  3. package/dist/cjs/auth.cjs +50 -0
  4. package/dist/cjs/auth.native.js +100 -0
  5. package/dist/cjs/auth.native.js.map +1 -0
  6. package/dist/cjs/auth.spec.cjs +322 -0
  7. package/dist/cjs/auth.spec.native.js +329 -0
  8. package/dist/cjs/auth.spec.native.js.map +1 -0
  9. package/dist/cjs/call.cjs +45 -0
  10. package/dist/cjs/call.native.js +93 -0
  11. package/dist/cjs/call.native.js.map +1 -0
  12. package/dist/cjs/call.spec.cjs +427 -0
  13. package/dist/cjs/call.spec.native.js +430 -0
  14. package/dist/cjs/call.spec.native.js.map +1 -0
  15. package/dist/cjs/collection.cjs +278 -0
  16. package/dist/cjs/collection.native.js +494 -0
  17. package/dist/cjs/collection.native.js.map +1 -0
  18. package/dist/cjs/collection.spec.cjs +186 -0
  19. package/dist/cjs/collection.spec.native.js +216 -0
  20. package/dist/cjs/collection.spec.native.js.map +1 -0
  21. package/dist/cjs/common/types.cjs +18 -0
  22. package/dist/cjs/common/types.native.js +21 -0
  23. package/dist/cjs/common/types.native.js.map +1 -0
  24. package/dist/cjs/common/types.spec.cjs +266 -0
  25. package/dist/cjs/common/types.spec.native.js +271 -0
  26. package/dist/cjs/common/types.spec.native.js.map +1 -0
  27. package/dist/cjs/core/http.cjs +289 -0
  28. package/dist/cjs/core/http.native.js +484 -0
  29. package/dist/cjs/core/http.native.js.map +1 -0
  30. package/dist/cjs/core/http.spec.cjs +1259 -0
  31. package/dist/cjs/core/http.spec.native.js +1401 -0
  32. package/dist/cjs/core/http.spec.native.js.map +1 -0
  33. package/dist/cjs/core/types.cjs +53 -0
  34. package/dist/cjs/core/types.native.js +178 -0
  35. package/dist/cjs/core/types.native.js.map +1 -0
  36. package/dist/cjs/core/wire.cjs +53 -0
  37. package/dist/cjs/core/wire.native.js +56 -0
  38. package/dist/cjs/core/wire.native.js.map +1 -0
  39. package/dist/cjs/core/wire.spec.cjs +478 -0
  40. package/dist/cjs/core/wire.spec.native.js +482 -0
  41. package/dist/cjs/core/wire.spec.native.js.map +1 -0
  42. package/dist/cjs/db.cjs +355 -0
  43. package/dist/cjs/db.native.js +469 -0
  44. package/dist/cjs/db.native.js.map +1 -0
  45. package/dist/cjs/db.spec.cjs +862 -0
  46. package/dist/cjs/db.spec.native.js +865 -0
  47. package/dist/cjs/db.spec.native.js.map +1 -0
  48. package/dist/cjs/devtools/FrappeDevtoolsPanel.cjs +838 -0
  49. package/dist/cjs/devtools/FrappeDevtoolsPanel.native.js +919 -0
  50. package/dist/cjs/devtools/FrappeDevtoolsPanel.native.js.map +1 -0
  51. package/dist/cjs/devtools/index.cjs +30 -0
  52. package/dist/cjs/devtools/index.native.js +33 -0
  53. package/dist/cjs/devtools/index.native.js.map +1 -0
  54. package/dist/cjs/devtools/plugin.cjs +39 -0
  55. package/dist/cjs/devtools/plugin.native.js +56 -0
  56. package/dist/cjs/devtools/plugin.native.js.map +1 -0
  57. package/dist/cjs/devtools/theme.cjs +55 -0
  58. package/dist/cjs/devtools/theme.native.js +58 -0
  59. package/dist/cjs/devtools/theme.native.js.map +1 -0
  60. package/dist/cjs/doctype.cjs +410 -0
  61. package/dist/cjs/doctype.native.js +521 -0
  62. package/dist/cjs/doctype.native.js.map +1 -0
  63. package/dist/cjs/doctype.spec.cjs +460 -0
  64. package/dist/cjs/doctype.spec.native.js +538 -0
  65. package/dist/cjs/doctype.spec.native.js.map +1 -0
  66. package/dist/cjs/file.cjs +41 -0
  67. package/dist/cjs/file.native.js +84 -0
  68. package/dist/cjs/file.native.js.map +1 -0
  69. package/dist/cjs/file.spec.cjs +315 -0
  70. package/dist/cjs/file.spec.native.js +342 -0
  71. package/dist/cjs/file.spec.native.js.map +1 -0
  72. package/dist/cjs/fixtureDb.cjs +212 -0
  73. package/dist/cjs/fixtureDb.native.js +313 -0
  74. package/dist/cjs/fixtureDb.native.js.map +1 -0
  75. package/dist/cjs/fixtures.cjs +199 -0
  76. package/dist/cjs/fixtures.native.js +400 -0
  77. package/dist/cjs/fixtures.native.js.map +1 -0
  78. package/dist/cjs/frappeApp.cjs +117 -0
  79. package/dist/cjs/frappeApp.native.js +179 -0
  80. package/dist/cjs/frappeApp.native.js.map +1 -0
  81. package/dist/cjs/frappeApp.spec.cjs +306 -0
  82. package/dist/cjs/frappeApp.spec.native.js +308 -0
  83. package/dist/cjs/frappeApp.spec.native.js.map +1 -0
  84. package/dist/cjs/frappeReact.cjs +314 -0
  85. package/dist/cjs/frappeReact.native.js +351 -0
  86. package/dist/cjs/frappeReact.native.js.map +1 -0
  87. package/dist/cjs/frappeReact.spec.cjs +531 -0
  88. package/dist/cjs/frappeReact.spec.native.js +670 -0
  89. package/dist/cjs/frappeReact.spec.native.js.map +1 -0
  90. package/dist/cjs/index.cjs +149 -0
  91. package/dist/cjs/index.native.js +152 -0
  92. package/dist/cjs/index.native.js.map +1 -0
  93. package/dist/cjs/optimistic.cjs +28 -0
  94. package/dist/cjs/optimistic.native.js +31 -0
  95. package/dist/cjs/optimistic.native.js.map +1 -0
  96. package/dist/cjs/optimistic.spec.cjs +11 -0
  97. package/dist/cjs/optimistic.spec.native.js +19 -0
  98. package/dist/cjs/optimistic.spec.native.js.map +1 -0
  99. package/dist/cjs/pacer.cjs +200 -0
  100. package/dist/cjs/pacer.native.js +274 -0
  101. package/dist/cjs/pacer.native.js.map +1 -0
  102. package/dist/cjs/pacer.spec.cjs +470 -0
  103. package/dist/cjs/pacer.spec.native.js +537 -0
  104. package/dist/cjs/pacer.spec.native.js.map +1 -0
  105. package/dist/cjs/plugin/index.cjs +124 -0
  106. package/dist/cjs/plugin/index.native.js +193 -0
  107. package/dist/cjs/plugin/index.native.js.map +1 -0
  108. package/dist/cjs/realtime.cjs +265 -0
  109. package/dist/cjs/realtime.native.js +387 -0
  110. package/dist/cjs/realtime.native.js.map +1 -0
  111. package/dist/cjs/realtime.spec.cjs +326 -0
  112. package/dist/cjs/realtime.spec.native.js +392 -0
  113. package/dist/cjs/realtime.spec.native.js.map +1 -0
  114. package/dist/cjs/sync/backfill.cjs +314 -0
  115. package/dist/cjs/sync/backfill.native.js +487 -0
  116. package/dist/cjs/sync/backfill.native.js.map +1 -0
  117. package/dist/cjs/sync/backfill.spec.cjs +586 -0
  118. package/dist/cjs/sync/backfill.spec.native.js +712 -0
  119. package/dist/cjs/sync/backfill.spec.native.js.map +1 -0
  120. package/dist/cjs/sync/debug.spec.cjs +125 -0
  121. package/dist/cjs/sync/debug.spec.native.js +133 -0
  122. package/dist/cjs/sync/debug.spec.native.js.map +1 -0
  123. package/dist/cjs/sync/filters.cjs +311 -0
  124. package/dist/cjs/sync/filters.native.js +446 -0
  125. package/dist/cjs/sync/filters.native.js.map +1 -0
  126. package/dist/cjs/sync/filters.spec.cjs +168 -0
  127. package/dist/cjs/sync/filters.spec.native.js +173 -0
  128. package/dist/cjs/sync/filters.spec.native.js.map +1 -0
  129. package/dist/cjs/sync/index.cjs +303 -0
  130. package/dist/cjs/sync/index.native.js +462 -0
  131. package/dist/cjs/sync/index.native.js.map +1 -0
  132. package/dist/cjs/sync/merge.cjs +435 -0
  133. package/dist/cjs/sync/merge.native.js +717 -0
  134. package/dist/cjs/sync/merge.native.js.map +1 -0
  135. package/dist/cjs/sync/merge.spec.cjs +908 -0
  136. package/dist/cjs/sync/merge.spec.native.js +937 -0
  137. package/dist/cjs/sync/merge.spec.native.js.map +1 -0
  138. package/dist/cjs/sync/multiOrderBy.spec.cjs +165 -0
  139. package/dist/cjs/sync/multiOrderBy.spec.native.js +229 -0
  140. package/dist/cjs/sync/multiOrderBy.spec.native.js.map +1 -0
  141. package/dist/cjs/sync/mutationEngine.cjs +781 -0
  142. package/dist/cjs/sync/mutationEngine.native.js +1159 -0
  143. package/dist/cjs/sync/mutationEngine.native.js.map +1 -0
  144. package/dist/cjs/sync/mutationEngine.spec.cjs +1158 -0
  145. package/dist/cjs/sync/mutationEngine.spec.native.js +1173 -0
  146. package/dist/cjs/sync/mutationEngine.spec.native.js.map +1 -0
  147. package/dist/cjs/sync/mutationJournal.cjs +150 -0
  148. package/dist/cjs/sync/mutationJournal.native.js +282 -0
  149. package/dist/cjs/sync/mutationJournal.native.js.map +1 -0
  150. package/dist/cjs/sync/mutationJournal.spec.cjs +330 -0
  151. package/dist/cjs/sync/mutationJournal.spec.native.js +333 -0
  152. package/dist/cjs/sync/mutationJournal.spec.native.js.map +1 -0
  153. package/dist/cjs/sync/mutations.spec.cjs +327 -0
  154. package/dist/cjs/sync/mutations.spec.native.js +330 -0
  155. package/dist/cjs/sync/mutations.spec.native.js.map +1 -0
  156. package/dist/cjs/sync/normalizedCache.cjs +140 -0
  157. package/dist/cjs/sync/normalizedCache.native.js +229 -0
  158. package/dist/cjs/sync/normalizedCache.native.js.map +1 -0
  159. package/dist/cjs/sync/normalizedCache.spec.cjs +302 -0
  160. package/dist/cjs/sync/normalizedCache.spec.native.js +311 -0
  161. package/dist/cjs/sync/normalizedCache.spec.native.js.map +1 -0
  162. package/dist/cjs/sync/persistence.cjs +627 -0
  163. package/dist/cjs/sync/persistence.native.js +911 -0
  164. package/dist/cjs/sync/persistence.native.js.map +1 -0
  165. package/dist/cjs/sync/persistence.spec.cjs +562 -0
  166. package/dist/cjs/sync/persistence.spec.native.js +572 -0
  167. package/dist/cjs/sync/persistence.spec.native.js.map +1 -0
  168. package/dist/cjs/sync/realtime.cjs +214 -0
  169. package/dist/cjs/sync/realtime.native.js +340 -0
  170. package/dist/cjs/sync/realtime.native.js.map +1 -0
  171. package/dist/cjs/sync/realtime.spec.cjs +499 -0
  172. package/dist/cjs/sync/realtime.spec.native.js +512 -0
  173. package/dist/cjs/sync/realtime.spec.native.js.map +1 -0
  174. package/dist/cjs/sync/rehydration.cjs +323 -0
  175. package/dist/cjs/sync/rehydration.native.js +531 -0
  176. package/dist/cjs/sync/rehydration.native.js.map +1 -0
  177. package/dist/cjs/sync/rehydration.spec.cjs +731 -0
  178. package/dist/cjs/sync/rehydration.spec.native.js +736 -0
  179. package/dist/cjs/sync/rehydration.spec.native.js.map +1 -0
  180. package/dist/cjs/sync/storage.cjs +142 -0
  181. package/dist/cjs/sync/storage.native.js +209 -0
  182. package/dist/cjs/sync/storage.native.js.map +1 -0
  183. package/dist/cjs/sync/storage.spec.cjs +446 -0
  184. package/dist/cjs/sync/storage.spec.native.js +470 -0
  185. package/dist/cjs/sync/storage.spec.native.js.map +1 -0
  186. package/dist/cjs/sync/subscriptionManager.cjs +487 -0
  187. package/dist/cjs/sync/subscriptionManager.native.js +948 -0
  188. package/dist/cjs/sync/subscriptionManager.native.js.map +1 -0
  189. package/dist/cjs/sync/subscriptionManager.spec.cjs +1102 -0
  190. package/dist/cjs/sync/subscriptionManager.spec.native.js +1136 -0
  191. package/dist/cjs/sync/subscriptionManager.spec.native.js.map +1 -0
  192. package/dist/cjs/sync/subscriptions.spec.cjs +937 -0
  193. package/dist/cjs/sync/subscriptions.spec.native.js +969 -0
  194. package/dist/cjs/sync/subscriptions.spec.native.js.map +1 -0
  195. package/dist/cjs/sync/syncModule.spec.cjs +206 -0
  196. package/dist/cjs/sync/syncModule.spec.native.js +222 -0
  197. package/dist/cjs/sync/syncModule.spec.native.js.map +1 -0
  198. package/dist/cjs/sync/types.cjs +99 -0
  199. package/dist/cjs/sync/types.native.js +102 -0
  200. package/dist/cjs/sync/types.native.js.map +1 -0
  201. package/dist/cjs/sync/types.spec.cjs +246 -0
  202. package/dist/cjs/sync/types.spec.native.js +256 -0
  203. package/dist/cjs/sync/types.spec.native.js.map +1 -0
  204. package/dist/cjs/sync/virtualPageManager.cjs +821 -0
  205. package/dist/cjs/sync/virtualPageManager.native.js +1125 -0
  206. package/dist/cjs/sync/virtualPageManager.native.js.map +1 -0
  207. package/dist/cjs/sync/virtualPageManager.spec.cjs +801 -0
  208. package/dist/cjs/sync/virtualPageManager.spec.native.js +873 -0
  209. package/dist/cjs/sync/virtualPageManager.spec.native.js.map +1 -0
  210. package/dist/cjs/util.cjs +31 -0
  211. package/dist/cjs/util.native.js +34 -0
  212. package/dist/cjs/util.native.js.map +1 -0
  213. package/dist/cjs/util.spec.cjs +43 -0
  214. package/dist/cjs/util.spec.native.js +48 -0
  215. package/dist/cjs/util.spec.native.js.map +1 -0
  216. package/dist/esm/auth.mjs +25 -0
  217. package/dist/esm/auth.mjs.map +1 -0
  218. package/dist/esm/auth.native.js +72 -0
  219. package/dist/esm/auth.native.js.map +1 -0
  220. package/dist/esm/auth.spec.mjs +323 -0
  221. package/dist/esm/auth.spec.mjs.map +1 -0
  222. package/dist/esm/auth.spec.native.js +327 -0
  223. package/dist/esm/auth.spec.native.js.map +1 -0
  224. package/dist/esm/call.mjs +20 -0
  225. package/dist/esm/call.mjs.map +1 -0
  226. package/dist/esm/call.native.js +65 -0
  227. package/dist/esm/call.native.js.map +1 -0
  228. package/dist/esm/call.spec.mjs +428 -0
  229. package/dist/esm/call.spec.mjs.map +1 -0
  230. package/dist/esm/call.spec.native.js +428 -0
  231. package/dist/esm/call.spec.native.js.map +1 -0
  232. package/dist/esm/collection.mjs +250 -0
  233. package/dist/esm/collection.mjs.map +1 -0
  234. package/dist/esm/collection.native.js +463 -0
  235. package/dist/esm/collection.native.js.map +1 -0
  236. package/dist/esm/collection.spec.mjs +187 -0
  237. package/dist/esm/collection.spec.mjs.map +1 -0
  238. package/dist/esm/collection.spec.native.js +214 -0
  239. package/dist/esm/collection.spec.native.js.map +1 -0
  240. package/dist/esm/common/types.mjs +2 -0
  241. package/dist/esm/common/types.mjs.map +1 -0
  242. package/dist/esm/common/types.native.js +2 -0
  243. package/dist/esm/common/types.native.js.map +1 -0
  244. package/dist/esm/common/types.spec.mjs +267 -0
  245. package/dist/esm/common/types.spec.mjs.map +1 -0
  246. package/dist/esm/common/types.spec.native.js +269 -0
  247. package/dist/esm/common/types.spec.native.js.map +1 -0
  248. package/dist/esm/core/http.mjs +258 -0
  249. package/dist/esm/core/http.mjs.map +1 -0
  250. package/dist/esm/core/http.native.js +450 -0
  251. package/dist/esm/core/http.native.js.map +1 -0
  252. package/dist/esm/core/http.spec.mjs +1260 -0
  253. package/dist/esm/core/http.spec.mjs.map +1 -0
  254. package/dist/esm/core/http.spec.native.js +1399 -0
  255. package/dist/esm/core/http.spec.native.js.map +1 -0
  256. package/dist/esm/core/types.mjs +26 -0
  257. package/dist/esm/core/types.mjs.map +1 -0
  258. package/dist/esm/core/types.native.js +148 -0
  259. package/dist/esm/core/types.native.js.map +1 -0
  260. package/dist/esm/core/wire.mjs +23 -0
  261. package/dist/esm/core/wire.mjs.map +1 -0
  262. package/dist/esm/core/wire.native.js +23 -0
  263. package/dist/esm/core/wire.native.js.map +1 -0
  264. package/dist/esm/core/wire.spec.mjs +479 -0
  265. package/dist/esm/core/wire.spec.mjs.map +1 -0
  266. package/dist/esm/core/wire.spec.native.js +480 -0
  267. package/dist/esm/core/wire.spec.native.js.map +1 -0
  268. package/dist/esm/db.mjs +329 -0
  269. package/dist/esm/db.mjs.map +1 -0
  270. package/dist/esm/db.native.js +440 -0
  271. package/dist/esm/db.native.js.map +1 -0
  272. package/dist/esm/db.spec.mjs +863 -0
  273. package/dist/esm/db.spec.mjs.map +1 -0
  274. package/dist/esm/db.spec.native.js +863 -0
  275. package/dist/esm/db.spec.native.js.map +1 -0
  276. package/dist/esm/devtools/FrappeDevtoolsPanel.mjs +813 -0
  277. package/dist/esm/devtools/FrappeDevtoolsPanel.mjs.map +1 -0
  278. package/dist/esm/devtools/FrappeDevtoolsPanel.native.js +880 -0
  279. package/dist/esm/devtools/FrappeDevtoolsPanel.native.js.map +1 -0
  280. package/dist/esm/devtools/index.mjs +4 -0
  281. package/dist/esm/devtools/index.mjs.map +1 -0
  282. package/dist/esm/devtools/index.native.js +4 -0
  283. package/dist/esm/devtools/index.native.js.map +1 -0
  284. package/dist/esm/devtools/plugin.mjs +14 -0
  285. package/dist/esm/devtools/plugin.mjs.map +1 -0
  286. package/dist/esm/devtools/plugin.native.js +17 -0
  287. package/dist/esm/devtools/plugin.native.js.map +1 -0
  288. package/dist/esm/devtools/theme.mjs +30 -0
  289. package/dist/esm/devtools/theme.mjs.map +1 -0
  290. package/dist/esm/devtools/theme.native.js +30 -0
  291. package/dist/esm/devtools/theme.native.js.map +1 -0
  292. package/dist/esm/doctype.mjs +381 -0
  293. package/dist/esm/doctype.mjs.map +1 -0
  294. package/dist/esm/doctype.native.js +489 -0
  295. package/dist/esm/doctype.native.js.map +1 -0
  296. package/dist/esm/doctype.spec.mjs +461 -0
  297. package/dist/esm/doctype.spec.mjs.map +1 -0
  298. package/dist/esm/doctype.spec.native.js +536 -0
  299. package/dist/esm/doctype.spec.native.js.map +1 -0
  300. package/dist/esm/file.mjs +16 -0
  301. package/dist/esm/file.mjs.map +1 -0
  302. package/dist/esm/file.native.js +56 -0
  303. package/dist/esm/file.native.js.map +1 -0
  304. package/dist/esm/file.spec.mjs +316 -0
  305. package/dist/esm/file.spec.mjs.map +1 -0
  306. package/dist/esm/file.spec.native.js +340 -0
  307. package/dist/esm/file.spec.native.js.map +1 -0
  308. package/dist/esm/fixtureDb.mjs +187 -0
  309. package/dist/esm/fixtureDb.mjs.map +1 -0
  310. package/dist/esm/fixtureDb.native.js +285 -0
  311. package/dist/esm/fixtureDb.native.js.map +1 -0
  312. package/dist/esm/fixtures.mjs +174 -0
  313. package/dist/esm/fixtures.mjs.map +1 -0
  314. package/dist/esm/fixtures.native.js +372 -0
  315. package/dist/esm/fixtures.native.js.map +1 -0
  316. package/dist/esm/frappeApp.mjs +92 -0
  317. package/dist/esm/frappeApp.mjs.map +1 -0
  318. package/dist/esm/frappeApp.native.js +151 -0
  319. package/dist/esm/frappeApp.native.js.map +1 -0
  320. package/dist/esm/frappeApp.spec.mjs +307 -0
  321. package/dist/esm/frappeApp.spec.mjs.map +1 -0
  322. package/dist/esm/frappeApp.spec.native.js +306 -0
  323. package/dist/esm/frappeApp.spec.native.js.map +1 -0
  324. package/dist/esm/frappeReact.mjs +286 -0
  325. package/dist/esm/frappeReact.mjs.map +1 -0
  326. package/dist/esm/frappeReact.native.js +320 -0
  327. package/dist/esm/frappeReact.native.js.map +1 -0
  328. package/dist/esm/frappeReact.spec.mjs +532 -0
  329. package/dist/esm/frappeReact.spec.mjs.map +1 -0
  330. package/dist/esm/frappeReact.spec.native.js +668 -0
  331. package/dist/esm/frappeReact.spec.native.js.map +1 -0
  332. package/dist/esm/index.mjs +25 -0
  333. package/dist/esm/index.mjs.map +1 -0
  334. package/dist/esm/index.native.js +25 -0
  335. package/dist/esm/index.native.js.map +1 -0
  336. package/dist/esm/optimistic.mjs +3 -0
  337. package/dist/esm/optimistic.mjs.map +1 -0
  338. package/dist/esm/optimistic.native.js +3 -0
  339. package/dist/esm/optimistic.native.js.map +1 -0
  340. package/dist/esm/optimistic.spec.mjs +12 -0
  341. package/dist/esm/optimistic.spec.mjs.map +1 -0
  342. package/dist/esm/optimistic.spec.native.js +17 -0
  343. package/dist/esm/optimistic.spec.native.js.map +1 -0
  344. package/dist/esm/pacer.mjs +173 -0
  345. package/dist/esm/pacer.mjs.map +1 -0
  346. package/dist/esm/pacer.native.js +244 -0
  347. package/dist/esm/pacer.native.js.map +1 -0
  348. package/dist/esm/pacer.spec.mjs +447 -0
  349. package/dist/esm/pacer.spec.mjs.map +1 -0
  350. package/dist/esm/pacer.spec.native.js +511 -0
  351. package/dist/esm/pacer.spec.native.js.map +1 -0
  352. package/dist/esm/plugin/index.mjs +99 -0
  353. package/dist/esm/plugin/index.mjs.map +1 -0
  354. package/dist/esm/plugin/index.native.js +165 -0
  355. package/dist/esm/plugin/index.native.js.map +1 -0
  356. package/dist/esm/realtime.mjs +239 -0
  357. package/dist/esm/realtime.mjs.map +1 -0
  358. package/dist/esm/realtime.native.js +358 -0
  359. package/dist/esm/realtime.native.js.map +1 -0
  360. package/dist/esm/realtime.spec.mjs +327 -0
  361. package/dist/esm/realtime.spec.mjs.map +1 -0
  362. package/dist/esm/realtime.spec.native.js +390 -0
  363. package/dist/esm/realtime.spec.native.js.map +1 -0
  364. package/dist/esm/sync/backfill.mjs +287 -0
  365. package/dist/esm/sync/backfill.mjs.map +1 -0
  366. package/dist/esm/sync/backfill.native.js +457 -0
  367. package/dist/esm/sync/backfill.native.js.map +1 -0
  368. package/dist/esm/sync/backfill.spec.mjs +563 -0
  369. package/dist/esm/sync/backfill.spec.mjs.map +1 -0
  370. package/dist/esm/sync/backfill.spec.native.js +686 -0
  371. package/dist/esm/sync/backfill.spec.native.js.map +1 -0
  372. package/dist/esm/sync/debug.spec.mjs +102 -0
  373. package/dist/esm/sync/debug.spec.mjs.map +1 -0
  374. package/dist/esm/sync/debug.spec.native.js +107 -0
  375. package/dist/esm/sync/debug.spec.native.js.map +1 -0
  376. package/dist/esm/sync/filters.mjs +276 -0
  377. package/dist/esm/sync/filters.mjs.map +1 -0
  378. package/dist/esm/sync/filters.native.js +408 -0
  379. package/dist/esm/sync/filters.native.js.map +1 -0
  380. package/dist/esm/sync/filters.spec.mjs +169 -0
  381. package/dist/esm/sync/filters.spec.mjs.map +1 -0
  382. package/dist/esm/sync/filters.spec.native.js +171 -0
  383. package/dist/esm/sync/filters.spec.native.js.map +1 -0
  384. package/dist/esm/sync/index.mjs +278 -0
  385. package/dist/esm/sync/index.mjs.map +1 -0
  386. package/dist/esm/sync/index.native.js +434 -0
  387. package/dist/esm/sync/index.native.js.map +1 -0
  388. package/dist/esm/sync/merge.mjs +396 -0
  389. package/dist/esm/sync/merge.mjs.map +1 -0
  390. package/dist/esm/sync/merge.native.js +675 -0
  391. package/dist/esm/sync/merge.native.js.map +1 -0
  392. package/dist/esm/sync/merge.spec.mjs +909 -0
  393. package/dist/esm/sync/merge.spec.mjs.map +1 -0
  394. package/dist/esm/sync/merge.spec.native.js +935 -0
  395. package/dist/esm/sync/merge.spec.native.js.map +1 -0
  396. package/dist/esm/sync/multiOrderBy.spec.mjs +166 -0
  397. package/dist/esm/sync/multiOrderBy.spec.mjs.map +1 -0
  398. package/dist/esm/sync/multiOrderBy.spec.native.js +227 -0
  399. package/dist/esm/sync/multiOrderBy.spec.native.js.map +1 -0
  400. package/dist/esm/sync/mutationEngine.mjs +756 -0
  401. package/dist/esm/sync/mutationEngine.mjs.map +1 -0
  402. package/dist/esm/sync/mutationEngine.native.js +1131 -0
  403. package/dist/esm/sync/mutationEngine.native.js.map +1 -0
  404. package/dist/esm/sync/mutationEngine.spec.mjs +1159 -0
  405. package/dist/esm/sync/mutationEngine.spec.mjs.map +1 -0
  406. package/dist/esm/sync/mutationEngine.spec.native.js +1171 -0
  407. package/dist/esm/sync/mutationEngine.spec.native.js.map +1 -0
  408. package/dist/esm/sync/mutationJournal.mjs +124 -0
  409. package/dist/esm/sync/mutationJournal.mjs.map +1 -0
  410. package/dist/esm/sync/mutationJournal.native.js +253 -0
  411. package/dist/esm/sync/mutationJournal.native.js.map +1 -0
  412. package/dist/esm/sync/mutationJournal.spec.mjs +331 -0
  413. package/dist/esm/sync/mutationJournal.spec.mjs.map +1 -0
  414. package/dist/esm/sync/mutationJournal.spec.native.js +331 -0
  415. package/dist/esm/sync/mutationJournal.spec.native.js.map +1 -0
  416. package/dist/esm/sync/mutations.spec.mjs +328 -0
  417. package/dist/esm/sync/mutations.spec.mjs.map +1 -0
  418. package/dist/esm/sync/mutations.spec.native.js +328 -0
  419. package/dist/esm/sync/mutations.spec.native.js.map +1 -0
  420. package/dist/esm/sync/normalizedCache.mjs +115 -0
  421. package/dist/esm/sync/normalizedCache.mjs.map +1 -0
  422. package/dist/esm/sync/normalizedCache.native.js +201 -0
  423. package/dist/esm/sync/normalizedCache.native.js.map +1 -0
  424. package/dist/esm/sync/normalizedCache.spec.mjs +303 -0
  425. package/dist/esm/sync/normalizedCache.spec.mjs.map +1 -0
  426. package/dist/esm/sync/normalizedCache.spec.native.js +309 -0
  427. package/dist/esm/sync/normalizedCache.spec.native.js.map +1 -0
  428. package/dist/esm/sync/persistence.mjs +602 -0
  429. package/dist/esm/sync/persistence.mjs.map +1 -0
  430. package/dist/esm/sync/persistence.native.js +883 -0
  431. package/dist/esm/sync/persistence.native.js.map +1 -0
  432. package/dist/esm/sync/persistence.spec.mjs +563 -0
  433. package/dist/esm/sync/persistence.spec.mjs.map +1 -0
  434. package/dist/esm/sync/persistence.spec.native.js +570 -0
  435. package/dist/esm/sync/persistence.spec.native.js.map +1 -0
  436. package/dist/esm/sync/realtime.mjs +189 -0
  437. package/dist/esm/sync/realtime.mjs.map +1 -0
  438. package/dist/esm/sync/realtime.native.js +312 -0
  439. package/dist/esm/sync/realtime.native.js.map +1 -0
  440. package/dist/esm/sync/realtime.spec.mjs +500 -0
  441. package/dist/esm/sync/realtime.spec.mjs.map +1 -0
  442. package/dist/esm/sync/realtime.spec.native.js +510 -0
  443. package/dist/esm/sync/realtime.spec.native.js.map +1 -0
  444. package/dist/esm/sync/rehydration.mjs +298 -0
  445. package/dist/esm/sync/rehydration.mjs.map +1 -0
  446. package/dist/esm/sync/rehydration.native.js +503 -0
  447. package/dist/esm/sync/rehydration.native.js.map +1 -0
  448. package/dist/esm/sync/rehydration.spec.mjs +732 -0
  449. package/dist/esm/sync/rehydration.spec.mjs.map +1 -0
  450. package/dist/esm/sync/rehydration.spec.native.js +734 -0
  451. package/dist/esm/sync/rehydration.spec.native.js.map +1 -0
  452. package/dist/esm/sync/storage.mjs +116 -0
  453. package/dist/esm/sync/storage.mjs.map +1 -0
  454. package/dist/esm/sync/storage.native.js +180 -0
  455. package/dist/esm/sync/storage.native.js.map +1 -0
  456. package/dist/esm/sync/storage.spec.mjs +423 -0
  457. package/dist/esm/sync/storage.spec.mjs.map +1 -0
  458. package/dist/esm/sync/storage.spec.native.js +444 -0
  459. package/dist/esm/sync/storage.spec.native.js.map +1 -0
  460. package/dist/esm/sync/subscriptionManager.mjs +462 -0
  461. package/dist/esm/sync/subscriptionManager.mjs.map +1 -0
  462. package/dist/esm/sync/subscriptionManager.native.js +920 -0
  463. package/dist/esm/sync/subscriptionManager.native.js.map +1 -0
  464. package/dist/esm/sync/subscriptionManager.spec.mjs +1079 -0
  465. package/dist/esm/sync/subscriptionManager.spec.mjs.map +1 -0
  466. package/dist/esm/sync/subscriptionManager.spec.native.js +1110 -0
  467. package/dist/esm/sync/subscriptionManager.spec.native.js.map +1 -0
  468. package/dist/esm/sync/subscriptions.spec.mjs +914 -0
  469. package/dist/esm/sync/subscriptions.spec.mjs.map +1 -0
  470. package/dist/esm/sync/subscriptions.spec.native.js +943 -0
  471. package/dist/esm/sync/subscriptions.spec.native.js.map +1 -0
  472. package/dist/esm/sync/syncModule.spec.mjs +207 -0
  473. package/dist/esm/sync/syncModule.spec.mjs.map +1 -0
  474. package/dist/esm/sync/syncModule.spec.native.js +220 -0
  475. package/dist/esm/sync/syncModule.spec.native.js.map +1 -0
  476. package/dist/esm/sync/types.mjs +65 -0
  477. package/dist/esm/sync/types.mjs.map +1 -0
  478. package/dist/esm/sync/types.native.js +65 -0
  479. package/dist/esm/sync/types.native.js.map +1 -0
  480. package/dist/esm/sync/types.spec.mjs +247 -0
  481. package/dist/esm/sync/types.spec.mjs.map +1 -0
  482. package/dist/esm/sync/types.spec.native.js +254 -0
  483. package/dist/esm/sync/types.spec.native.js.map +1 -0
  484. package/dist/esm/sync/virtualPageManager.mjs +794 -0
  485. package/dist/esm/sync/virtualPageManager.mjs.map +1 -0
  486. package/dist/esm/sync/virtualPageManager.native.js +1095 -0
  487. package/dist/esm/sync/virtualPageManager.native.js.map +1 -0
  488. package/dist/esm/sync/virtualPageManager.spec.mjs +802 -0
  489. package/dist/esm/sync/virtualPageManager.spec.mjs.map +1 -0
  490. package/dist/esm/sync/virtualPageManager.spec.native.js +871 -0
  491. package/dist/esm/sync/virtualPageManager.spec.native.js.map +1 -0
  492. package/dist/esm/util.mjs +6 -0
  493. package/dist/esm/util.mjs.map +1 -0
  494. package/dist/esm/util.native.js +6 -0
  495. package/dist/esm/util.native.js.map +1 -0
  496. package/dist/esm/util.spec.mjs +20 -0
  497. package/dist/esm/util.spec.mjs.map +1 -0
  498. package/dist/esm/util.spec.native.js +22 -0
  499. package/dist/esm/util.spec.native.js.map +1 -0
  500. package/dist/jsx/auth.mjs +25 -0
  501. package/dist/jsx/auth.mjs.map +1 -0
  502. package/dist/jsx/auth.native.js +100 -0
  503. package/dist/jsx/auth.native.js.map +1 -0
  504. package/dist/jsx/auth.spec.mjs +323 -0
  505. package/dist/jsx/auth.spec.mjs.map +1 -0
  506. package/dist/jsx/auth.spec.native.js +329 -0
  507. package/dist/jsx/auth.spec.native.js.map +1 -0
  508. package/dist/jsx/call.mjs +20 -0
  509. package/dist/jsx/call.mjs.map +1 -0
  510. package/dist/jsx/call.native.js +93 -0
  511. package/dist/jsx/call.native.js.map +1 -0
  512. package/dist/jsx/call.spec.mjs +428 -0
  513. package/dist/jsx/call.spec.mjs.map +1 -0
  514. package/dist/jsx/call.spec.native.js +430 -0
  515. package/dist/jsx/call.spec.native.js.map +1 -0
  516. package/dist/jsx/collection.mjs +250 -0
  517. package/dist/jsx/collection.mjs.map +1 -0
  518. package/dist/jsx/collection.native.js +494 -0
  519. package/dist/jsx/collection.native.js.map +1 -0
  520. package/dist/jsx/collection.spec.mjs +187 -0
  521. package/dist/jsx/collection.spec.mjs.map +1 -0
  522. package/dist/jsx/collection.spec.native.js +216 -0
  523. package/dist/jsx/collection.spec.native.js.map +1 -0
  524. package/dist/jsx/common/types.mjs +2 -0
  525. package/dist/jsx/common/types.mjs.map +1 -0
  526. package/dist/jsx/common/types.native.js +21 -0
  527. package/dist/jsx/common/types.native.js.map +1 -0
  528. package/dist/jsx/common/types.spec.mjs +267 -0
  529. package/dist/jsx/common/types.spec.mjs.map +1 -0
  530. package/dist/jsx/common/types.spec.native.js +271 -0
  531. package/dist/jsx/common/types.spec.native.js.map +1 -0
  532. package/dist/jsx/core/http.mjs +258 -0
  533. package/dist/jsx/core/http.mjs.map +1 -0
  534. package/dist/jsx/core/http.native.js +484 -0
  535. package/dist/jsx/core/http.native.js.map +1 -0
  536. package/dist/jsx/core/http.spec.mjs +1260 -0
  537. package/dist/jsx/core/http.spec.mjs.map +1 -0
  538. package/dist/jsx/core/http.spec.native.js +1401 -0
  539. package/dist/jsx/core/http.spec.native.js.map +1 -0
  540. package/dist/jsx/core/types.mjs +26 -0
  541. package/dist/jsx/core/types.mjs.map +1 -0
  542. package/dist/jsx/core/types.native.js +178 -0
  543. package/dist/jsx/core/types.native.js.map +1 -0
  544. package/dist/jsx/core/wire.mjs +23 -0
  545. package/dist/jsx/core/wire.mjs.map +1 -0
  546. package/dist/jsx/core/wire.native.js +56 -0
  547. package/dist/jsx/core/wire.native.js.map +1 -0
  548. package/dist/jsx/core/wire.spec.mjs +479 -0
  549. package/dist/jsx/core/wire.spec.mjs.map +1 -0
  550. package/dist/jsx/core/wire.spec.native.js +482 -0
  551. package/dist/jsx/core/wire.spec.native.js.map +1 -0
  552. package/dist/jsx/db.mjs +329 -0
  553. package/dist/jsx/db.mjs.map +1 -0
  554. package/dist/jsx/db.native.js +469 -0
  555. package/dist/jsx/db.native.js.map +1 -0
  556. package/dist/jsx/db.spec.mjs +863 -0
  557. package/dist/jsx/db.spec.mjs.map +1 -0
  558. package/dist/jsx/db.spec.native.js +865 -0
  559. package/dist/jsx/db.spec.native.js.map +1 -0
  560. package/dist/jsx/devtools/FrappeDevtoolsPanel.mjs +813 -0
  561. package/dist/jsx/devtools/FrappeDevtoolsPanel.mjs.map +1 -0
  562. package/dist/jsx/devtools/FrappeDevtoolsPanel.native.js +919 -0
  563. package/dist/jsx/devtools/FrappeDevtoolsPanel.native.js.map +1 -0
  564. package/dist/jsx/devtools/index.mjs +4 -0
  565. package/dist/jsx/devtools/index.mjs.map +1 -0
  566. package/dist/jsx/devtools/index.native.js +33 -0
  567. package/dist/jsx/devtools/index.native.js.map +1 -0
  568. package/dist/jsx/devtools/plugin.mjs +14 -0
  569. package/dist/jsx/devtools/plugin.mjs.map +1 -0
  570. package/dist/jsx/devtools/plugin.native.js +56 -0
  571. package/dist/jsx/devtools/plugin.native.js.map +1 -0
  572. package/dist/jsx/devtools/theme.mjs +30 -0
  573. package/dist/jsx/devtools/theme.mjs.map +1 -0
  574. package/dist/jsx/devtools/theme.native.js +58 -0
  575. package/dist/jsx/devtools/theme.native.js.map +1 -0
  576. package/dist/jsx/doctype.mjs +381 -0
  577. package/dist/jsx/doctype.mjs.map +1 -0
  578. package/dist/jsx/doctype.native.js +521 -0
  579. package/dist/jsx/doctype.native.js.map +1 -0
  580. package/dist/jsx/doctype.spec.mjs +461 -0
  581. package/dist/jsx/doctype.spec.mjs.map +1 -0
  582. package/dist/jsx/doctype.spec.native.js +538 -0
  583. package/dist/jsx/doctype.spec.native.js.map +1 -0
  584. package/dist/jsx/file.mjs +16 -0
  585. package/dist/jsx/file.mjs.map +1 -0
  586. package/dist/jsx/file.native.js +84 -0
  587. package/dist/jsx/file.native.js.map +1 -0
  588. package/dist/jsx/file.spec.mjs +316 -0
  589. package/dist/jsx/file.spec.mjs.map +1 -0
  590. package/dist/jsx/file.spec.native.js +342 -0
  591. package/dist/jsx/file.spec.native.js.map +1 -0
  592. package/dist/jsx/fixtureDb.mjs +187 -0
  593. package/dist/jsx/fixtureDb.mjs.map +1 -0
  594. package/dist/jsx/fixtureDb.native.js +313 -0
  595. package/dist/jsx/fixtureDb.native.js.map +1 -0
  596. package/dist/jsx/fixtures.mjs +174 -0
  597. package/dist/jsx/fixtures.mjs.map +1 -0
  598. package/dist/jsx/fixtures.native.js +400 -0
  599. package/dist/jsx/fixtures.native.js.map +1 -0
  600. package/dist/jsx/frappeApp.mjs +92 -0
  601. package/dist/jsx/frappeApp.mjs.map +1 -0
  602. package/dist/jsx/frappeApp.native.js +179 -0
  603. package/dist/jsx/frappeApp.native.js.map +1 -0
  604. package/dist/jsx/frappeApp.spec.mjs +307 -0
  605. package/dist/jsx/frappeApp.spec.mjs.map +1 -0
  606. package/dist/jsx/frappeApp.spec.native.js +308 -0
  607. package/dist/jsx/frappeApp.spec.native.js.map +1 -0
  608. package/dist/jsx/frappeReact.mjs +286 -0
  609. package/dist/jsx/frappeReact.mjs.map +1 -0
  610. package/dist/jsx/frappeReact.native.js +351 -0
  611. package/dist/jsx/frappeReact.native.js.map +1 -0
  612. package/dist/jsx/frappeReact.spec.mjs +532 -0
  613. package/dist/jsx/frappeReact.spec.mjs.map +1 -0
  614. package/dist/jsx/frappeReact.spec.native.js +670 -0
  615. package/dist/jsx/frappeReact.spec.native.js.map +1 -0
  616. package/dist/jsx/index.js +25 -0
  617. package/dist/jsx/index.js.map +1 -0
  618. package/dist/jsx/index.mjs +25 -0
  619. package/dist/jsx/index.mjs.map +1 -0
  620. package/dist/jsx/index.native.js +152 -0
  621. package/dist/jsx/index.native.js.map +1 -0
  622. package/dist/jsx/optimistic.mjs +3 -0
  623. package/dist/jsx/optimistic.mjs.map +1 -0
  624. package/dist/jsx/optimistic.native.js +31 -0
  625. package/dist/jsx/optimistic.native.js.map +1 -0
  626. package/dist/jsx/optimistic.spec.mjs +12 -0
  627. package/dist/jsx/optimistic.spec.mjs.map +1 -0
  628. package/dist/jsx/optimistic.spec.native.js +19 -0
  629. package/dist/jsx/optimistic.spec.native.js.map +1 -0
  630. package/dist/jsx/pacer.mjs +173 -0
  631. package/dist/jsx/pacer.mjs.map +1 -0
  632. package/dist/jsx/pacer.native.js +274 -0
  633. package/dist/jsx/pacer.native.js.map +1 -0
  634. package/dist/jsx/pacer.spec.mjs +447 -0
  635. package/dist/jsx/pacer.spec.mjs.map +1 -0
  636. package/dist/jsx/pacer.spec.native.js +537 -0
  637. package/dist/jsx/pacer.spec.native.js.map +1 -0
  638. package/dist/jsx/plugin/index.mjs +99 -0
  639. package/dist/jsx/plugin/index.mjs.map +1 -0
  640. package/dist/jsx/plugin/index.native.js +193 -0
  641. package/dist/jsx/plugin/index.native.js.map +1 -0
  642. package/dist/jsx/realtime.mjs +239 -0
  643. package/dist/jsx/realtime.mjs.map +1 -0
  644. package/dist/jsx/realtime.native.js +387 -0
  645. package/dist/jsx/realtime.native.js.map +1 -0
  646. package/dist/jsx/realtime.spec.mjs +327 -0
  647. package/dist/jsx/realtime.spec.mjs.map +1 -0
  648. package/dist/jsx/realtime.spec.native.js +392 -0
  649. package/dist/jsx/realtime.spec.native.js.map +1 -0
  650. package/dist/jsx/sync/backfill.mjs +287 -0
  651. package/dist/jsx/sync/backfill.mjs.map +1 -0
  652. package/dist/jsx/sync/backfill.native.js +487 -0
  653. package/dist/jsx/sync/backfill.native.js.map +1 -0
  654. package/dist/jsx/sync/backfill.spec.mjs +563 -0
  655. package/dist/jsx/sync/backfill.spec.mjs.map +1 -0
  656. package/dist/jsx/sync/backfill.spec.native.js +712 -0
  657. package/dist/jsx/sync/backfill.spec.native.js.map +1 -0
  658. package/dist/jsx/sync/debug.spec.mjs +102 -0
  659. package/dist/jsx/sync/debug.spec.mjs.map +1 -0
  660. package/dist/jsx/sync/debug.spec.native.js +133 -0
  661. package/dist/jsx/sync/debug.spec.native.js.map +1 -0
  662. package/dist/jsx/sync/filters.mjs +276 -0
  663. package/dist/jsx/sync/filters.mjs.map +1 -0
  664. package/dist/jsx/sync/filters.native.js +446 -0
  665. package/dist/jsx/sync/filters.native.js.map +1 -0
  666. package/dist/jsx/sync/filters.spec.mjs +169 -0
  667. package/dist/jsx/sync/filters.spec.mjs.map +1 -0
  668. package/dist/jsx/sync/filters.spec.native.js +173 -0
  669. package/dist/jsx/sync/filters.spec.native.js.map +1 -0
  670. package/dist/jsx/sync/index.mjs +278 -0
  671. package/dist/jsx/sync/index.mjs.map +1 -0
  672. package/dist/jsx/sync/index.native.js +462 -0
  673. package/dist/jsx/sync/index.native.js.map +1 -0
  674. package/dist/jsx/sync/merge.mjs +396 -0
  675. package/dist/jsx/sync/merge.mjs.map +1 -0
  676. package/dist/jsx/sync/merge.native.js +717 -0
  677. package/dist/jsx/sync/merge.native.js.map +1 -0
  678. package/dist/jsx/sync/merge.spec.mjs +909 -0
  679. package/dist/jsx/sync/merge.spec.mjs.map +1 -0
  680. package/dist/jsx/sync/merge.spec.native.js +937 -0
  681. package/dist/jsx/sync/merge.spec.native.js.map +1 -0
  682. package/dist/jsx/sync/multiOrderBy.spec.mjs +166 -0
  683. package/dist/jsx/sync/multiOrderBy.spec.mjs.map +1 -0
  684. package/dist/jsx/sync/multiOrderBy.spec.native.js +229 -0
  685. package/dist/jsx/sync/multiOrderBy.spec.native.js.map +1 -0
  686. package/dist/jsx/sync/mutationEngine.mjs +756 -0
  687. package/dist/jsx/sync/mutationEngine.mjs.map +1 -0
  688. package/dist/jsx/sync/mutationEngine.native.js +1159 -0
  689. package/dist/jsx/sync/mutationEngine.native.js.map +1 -0
  690. package/dist/jsx/sync/mutationEngine.spec.mjs +1159 -0
  691. package/dist/jsx/sync/mutationEngine.spec.mjs.map +1 -0
  692. package/dist/jsx/sync/mutationEngine.spec.native.js +1173 -0
  693. package/dist/jsx/sync/mutationEngine.spec.native.js.map +1 -0
  694. package/dist/jsx/sync/mutationJournal.mjs +124 -0
  695. package/dist/jsx/sync/mutationJournal.mjs.map +1 -0
  696. package/dist/jsx/sync/mutationJournal.native.js +282 -0
  697. package/dist/jsx/sync/mutationJournal.native.js.map +1 -0
  698. package/dist/jsx/sync/mutationJournal.spec.mjs +331 -0
  699. package/dist/jsx/sync/mutationJournal.spec.mjs.map +1 -0
  700. package/dist/jsx/sync/mutationJournal.spec.native.js +333 -0
  701. package/dist/jsx/sync/mutationJournal.spec.native.js.map +1 -0
  702. package/dist/jsx/sync/mutations.spec.mjs +328 -0
  703. package/dist/jsx/sync/mutations.spec.mjs.map +1 -0
  704. package/dist/jsx/sync/mutations.spec.native.js +330 -0
  705. package/dist/jsx/sync/mutations.spec.native.js.map +1 -0
  706. package/dist/jsx/sync/normalizedCache.mjs +115 -0
  707. package/dist/jsx/sync/normalizedCache.mjs.map +1 -0
  708. package/dist/jsx/sync/normalizedCache.native.js +229 -0
  709. package/dist/jsx/sync/normalizedCache.native.js.map +1 -0
  710. package/dist/jsx/sync/normalizedCache.spec.mjs +303 -0
  711. package/dist/jsx/sync/normalizedCache.spec.mjs.map +1 -0
  712. package/dist/jsx/sync/normalizedCache.spec.native.js +311 -0
  713. package/dist/jsx/sync/normalizedCache.spec.native.js.map +1 -0
  714. package/dist/jsx/sync/persistence.mjs +602 -0
  715. package/dist/jsx/sync/persistence.mjs.map +1 -0
  716. package/dist/jsx/sync/persistence.native.js +911 -0
  717. package/dist/jsx/sync/persistence.native.js.map +1 -0
  718. package/dist/jsx/sync/persistence.spec.mjs +563 -0
  719. package/dist/jsx/sync/persistence.spec.mjs.map +1 -0
  720. package/dist/jsx/sync/persistence.spec.native.js +572 -0
  721. package/dist/jsx/sync/persistence.spec.native.js.map +1 -0
  722. package/dist/jsx/sync/realtime.mjs +189 -0
  723. package/dist/jsx/sync/realtime.mjs.map +1 -0
  724. package/dist/jsx/sync/realtime.native.js +340 -0
  725. package/dist/jsx/sync/realtime.native.js.map +1 -0
  726. package/dist/jsx/sync/realtime.spec.mjs +500 -0
  727. package/dist/jsx/sync/realtime.spec.mjs.map +1 -0
  728. package/dist/jsx/sync/realtime.spec.native.js +512 -0
  729. package/dist/jsx/sync/realtime.spec.native.js.map +1 -0
  730. package/dist/jsx/sync/rehydration.mjs +298 -0
  731. package/dist/jsx/sync/rehydration.mjs.map +1 -0
  732. package/dist/jsx/sync/rehydration.native.js +531 -0
  733. package/dist/jsx/sync/rehydration.native.js.map +1 -0
  734. package/dist/jsx/sync/rehydration.spec.mjs +732 -0
  735. package/dist/jsx/sync/rehydration.spec.mjs.map +1 -0
  736. package/dist/jsx/sync/rehydration.spec.native.js +736 -0
  737. package/dist/jsx/sync/rehydration.spec.native.js.map +1 -0
  738. package/dist/jsx/sync/storage.mjs +116 -0
  739. package/dist/jsx/sync/storage.mjs.map +1 -0
  740. package/dist/jsx/sync/storage.native.js +209 -0
  741. package/dist/jsx/sync/storage.native.js.map +1 -0
  742. package/dist/jsx/sync/storage.spec.mjs +423 -0
  743. package/dist/jsx/sync/storage.spec.mjs.map +1 -0
  744. package/dist/jsx/sync/storage.spec.native.js +470 -0
  745. package/dist/jsx/sync/storage.spec.native.js.map +1 -0
  746. package/dist/jsx/sync/subscriptionManager.mjs +462 -0
  747. package/dist/jsx/sync/subscriptionManager.mjs.map +1 -0
  748. package/dist/jsx/sync/subscriptionManager.native.js +948 -0
  749. package/dist/jsx/sync/subscriptionManager.native.js.map +1 -0
  750. package/dist/jsx/sync/subscriptionManager.spec.mjs +1079 -0
  751. package/dist/jsx/sync/subscriptionManager.spec.mjs.map +1 -0
  752. package/dist/jsx/sync/subscriptionManager.spec.native.js +1136 -0
  753. package/dist/jsx/sync/subscriptionManager.spec.native.js.map +1 -0
  754. package/dist/jsx/sync/subscriptions.spec.mjs +914 -0
  755. package/dist/jsx/sync/subscriptions.spec.mjs.map +1 -0
  756. package/dist/jsx/sync/subscriptions.spec.native.js +969 -0
  757. package/dist/jsx/sync/subscriptions.spec.native.js.map +1 -0
  758. package/dist/jsx/sync/syncModule.spec.mjs +207 -0
  759. package/dist/jsx/sync/syncModule.spec.mjs.map +1 -0
  760. package/dist/jsx/sync/syncModule.spec.native.js +222 -0
  761. package/dist/jsx/sync/syncModule.spec.native.js.map +1 -0
  762. package/dist/jsx/sync/types.mjs +65 -0
  763. package/dist/jsx/sync/types.mjs.map +1 -0
  764. package/dist/jsx/sync/types.native.js +102 -0
  765. package/dist/jsx/sync/types.native.js.map +1 -0
  766. package/dist/jsx/sync/types.spec.mjs +247 -0
  767. package/dist/jsx/sync/types.spec.mjs.map +1 -0
  768. package/dist/jsx/sync/types.spec.native.js +256 -0
  769. package/dist/jsx/sync/types.spec.native.js.map +1 -0
  770. package/dist/jsx/sync/virtualPageManager.mjs +794 -0
  771. package/dist/jsx/sync/virtualPageManager.mjs.map +1 -0
  772. package/dist/jsx/sync/virtualPageManager.native.js +1125 -0
  773. package/dist/jsx/sync/virtualPageManager.native.js.map +1 -0
  774. package/dist/jsx/sync/virtualPageManager.spec.mjs +802 -0
  775. package/dist/jsx/sync/virtualPageManager.spec.mjs.map +1 -0
  776. package/dist/jsx/sync/virtualPageManager.spec.native.js +873 -0
  777. package/dist/jsx/sync/virtualPageManager.spec.native.js.map +1 -0
  778. package/dist/jsx/util.mjs +6 -0
  779. package/dist/jsx/util.mjs.map +1 -0
  780. package/dist/jsx/util.native.js +34 -0
  781. package/dist/jsx/util.native.js.map +1 -0
  782. package/dist/jsx/util.spec.mjs +20 -0
  783. package/dist/jsx/util.spec.mjs.map +1 -0
  784. package/dist/jsx/util.spec.native.js +48 -0
  785. package/dist/jsx/util.spec.native.js.map +1 -0
  786. package/package.json +96 -0
  787. package/src/auth.spec.ts +363 -0
  788. package/src/auth.ts +29 -0
  789. package/src/call.spec.ts +541 -0
  790. package/src/call.ts +21 -0
  791. package/src/collection.spec.ts +213 -0
  792. package/src/collection.ts +328 -0
  793. package/src/common/types.spec.ts +294 -0
  794. package/src/common/types.ts +41 -0
  795. package/src/core/http.spec.ts +1128 -0
  796. package/src/core/http.ts +324 -0
  797. package/src/core/types.ts +85 -0
  798. package/src/core/wire.spec.ts +570 -0
  799. package/src/core/wire.ts +487 -0
  800. package/src/db.spec.ts +1004 -0
  801. package/src/db.ts +589 -0
  802. package/src/devtools/FrappeDevtoolsPanel.tsx +873 -0
  803. package/src/devtools/index.ts +3 -0
  804. package/src/devtools/plugin.tsx +13 -0
  805. package/src/devtools/theme.ts +42 -0
  806. package/src/doctype.spec.ts +451 -0
  807. package/src/doctype.ts +828 -0
  808. package/src/file.spec.ts +347 -0
  809. package/src/file.ts +27 -0
  810. package/src/fixtureDb.ts +208 -0
  811. package/src/fixtures.ts +268 -0
  812. package/src/frappeApp.spec.ts +382 -0
  813. package/src/frappeApp.ts +125 -0
  814. package/src/frappeReact.spec.ts +505 -0
  815. package/src/frappeReact.ts +598 -0
  816. package/src/index.ts +215 -0
  817. package/src/optimistic.spec.ts +13 -0
  818. package/src/optimistic.ts +39 -0
  819. package/src/pacer.spec.ts +493 -0
  820. package/src/pacer.ts +426 -0
  821. package/src/plugin/README.md +162 -0
  822. package/src/plugin/index.ts +141 -0
  823. package/src/realtime.spec.ts +453 -0
  824. package/src/realtime.ts +279 -0
  825. package/src/sync/backfill.spec.ts +714 -0
  826. package/src/sync/backfill.ts +378 -0
  827. package/src/sync/debug.spec.ts +110 -0
  828. package/src/sync/filters.spec.ts +223 -0
  829. package/src/sync/filters.ts +513 -0
  830. package/src/sync/index.ts +412 -0
  831. package/src/sync/merge.spec.ts +812 -0
  832. package/src/sync/merge.ts +532 -0
  833. package/src/sync/multiOrderBy.spec.ts +187 -0
  834. package/src/sync/mutationEngine.spec.ts +1418 -0
  835. package/src/sync/mutationEngine.ts +957 -0
  836. package/src/sync/mutationJournal.spec.ts +337 -0
  837. package/src/sync/mutationJournal.ts +157 -0
  838. package/src/sync/mutations.spec.ts +358 -0
  839. package/src/sync/normalizedCache.spec.ts +262 -0
  840. package/src/sync/normalizedCache.ts +152 -0
  841. package/src/sync/persistence.spec.ts +908 -0
  842. package/src/sync/persistence.ts +802 -0
  843. package/src/sync/realtime.spec.ts +769 -0
  844. package/src/sync/realtime.ts +259 -0
  845. package/src/sync/rehydration.spec.ts +923 -0
  846. package/src/sync/rehydration.ts +362 -0
  847. package/src/sync/storage.spec.ts +473 -0
  848. package/src/sync/storage.ts +174 -0
  849. package/src/sync/subscriptionManager.spec.ts +1226 -0
  850. package/src/sync/subscriptionManager.ts +577 -0
  851. package/src/sync/subscriptions.spec.ts +1048 -0
  852. package/src/sync/syncModule.spec.ts +217 -0
  853. package/src/sync/types.spec.ts +276 -0
  854. package/src/sync/types.ts +384 -0
  855. package/src/sync/virtualPageManager.spec.ts +825 -0
  856. package/src/sync/virtualPageManager.ts +1069 -0
  857. package/src/util.spec.ts +17 -0
  858. package/src/util.ts +5 -0
@@ -0,0 +1,1401 @@
1
+ "use strict";
2
+
3
+ var import_vitest = require("vitest");
4
+ var import_http = require("./http.native.js");
5
+ var import_types = require("./types.native.js");
6
+ (0, import_vitest.describe)("HttpClient", function () {
7
+ var client;
8
+ var baseURL = "https://api.example.com";
9
+ var getMockFetch = function getMockFetch2() {
10
+ return import_vitest.vi.mocked(fetch);
11
+ };
12
+ (0, import_vitest.beforeEach)(function () {
13
+ client = new import_http.HttpClient(baseURL);
14
+ global.fetch = import_vitest.vi.fn();
15
+ });
16
+ (0, import_vitest.afterEach)(function () {
17
+ import_vitest.vi.restoreAllMocks();
18
+ });
19
+ (0, import_vitest.describe)("constructor", function () {
20
+ (0, import_vitest.it)("should initialize with base URL", function () {
21
+ var httpClient = new import_http.HttpClient(baseURL);
22
+ (0, import_vitest.expect)(httpClient).toBeDefined();
23
+ });
24
+ (0, import_vitest.it)("should accept auth config", function () {
25
+ var httpClient = new import_http.HttpClient(baseURL, {
26
+ useToken: true,
27
+ token: "test-token",
28
+ type: import_types.AuthType.Bearer
29
+ });
30
+ (0, import_vitest.expect)(httpClient).toBeDefined();
31
+ });
32
+ (0, import_vitest.it)("should accept retry config", function () {
33
+ var httpClient = new import_http.HttpClient(baseURL, void 0, {
34
+ maxRetries: 5,
35
+ baseDelayMs: 500,
36
+ exponentialBackoff: false
37
+ });
38
+ (0, import_vitest.expect)(httpClient).toBeDefined();
39
+ });
40
+ });
41
+ (0, import_vitest.describe)("request", function () {
42
+ (0, import_vitest.it)("should make basic GET request", async function () {
43
+ var mockPayload = {
44
+ data: "test"
45
+ };
46
+ var mockHeaders = new Headers({
47
+ "Content-Type": "application/json"
48
+ });
49
+ var mockRes = {
50
+ ok: true,
51
+ headers: mockHeaders,
52
+ status: 200,
53
+ json: async function json() {
54
+ return mockPayload;
55
+ }
56
+ };
57
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
58
+ var result = await client.request(import_types.HttpMethod.Get, "/test", {});
59
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
60
+ method: "GET",
61
+ credentials: "include"
62
+ }));
63
+ (0, import_vitest.expect)(result.payload).toEqual(mockPayload);
64
+ (0, import_vitest.expect)(result.headers).toBe(mockHeaders);
65
+ (0, import_vitest.expect)(result.status).toBe(200);
66
+ (0, import_vitest.expect)(result._res).toBe(mockRes);
67
+ });
68
+ (0, import_vitest.it)("should make POST request with JSON body", async function () {
69
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
70
+ var requestBody = {
71
+ foo: "bar",
72
+ nested: {
73
+ value: 123
74
+ }
75
+ };
76
+ var mockPayload = {
77
+ success: true
78
+ };
79
+ var mockHeaders = new Headers({
80
+ "Content-Type": "application/json"
81
+ });
82
+ var mockRes = {
83
+ ok: true,
84
+ headers: mockHeaders,
85
+ status: 200,
86
+ json: async function json() {
87
+ return mockPayload;
88
+ }
89
+ };
90
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
91
+ var result = await client.request(import_types.HttpMethod.Post, "/test", {
92
+ body: requestBody
93
+ });
94
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
95
+ method: "POST",
96
+ body: JSON.stringify(requestBody),
97
+ headers: import_vitest.expect.any(Headers),
98
+ credentials: "include"
99
+ }));
100
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
101
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("Content-Type")).toBe("application/json");
102
+ (0, import_vitest.expect)(result.payload).toEqual(mockPayload);
103
+ (0, import_vitest.expect)(result.status).toBe(200);
104
+ });
105
+ (0, import_vitest.it)("should handle FormData body", async function () {
106
+ var formData = new FormData();
107
+ formData.append("field", "value");
108
+ var mockRes = {
109
+ ok: true,
110
+ headers: new Headers({
111
+ "Content-Type": "application/json"
112
+ }),
113
+ status: 200,
114
+ json: async function json() {
115
+ return {
116
+ success: true
117
+ };
118
+ }
119
+ };
120
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
121
+ var result = await client.request(import_types.HttpMethod.Post, "/upload", {
122
+ body: formData
123
+ });
124
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/upload`, import_vitest.expect.objectContaining({
125
+ method: "POST",
126
+ body: formData,
127
+ headers: import_vitest.expect.any(Headers),
128
+ credentials: "include"
129
+ }));
130
+ (0, import_vitest.expect)(result.payload).toEqual({
131
+ success: true
132
+ });
133
+ });
134
+ (0, import_vitest.it)("should handle URLSearchParams body", async function () {
135
+ var params = new URLSearchParams();
136
+ params.append("key", "value");
137
+ var mockRes = {
138
+ ok: true,
139
+ headers: new Headers({
140
+ "Content-Type": "text/plain"
141
+ }),
142
+ status: 200,
143
+ text: async function text() {
144
+ return "success";
145
+ }
146
+ };
147
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
148
+ var result = await client.request(import_types.HttpMethod.Post, "/form", {
149
+ body: params
150
+ });
151
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/form`, import_vitest.expect.objectContaining({
152
+ method: "POST",
153
+ body: params,
154
+ credentials: "include"
155
+ }));
156
+ (0, import_vitest.expect)(result.payload).toBe("success");
157
+ });
158
+ (0, import_vitest.it)("should convert object to FormData when Content-Type is multipart/form-data", async function () {
159
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
160
+ var requestBody = {
161
+ field1: "value1",
162
+ field2: "value2"
163
+ };
164
+ var mockRes = {
165
+ ok: true,
166
+ headers: new Headers({
167
+ "Content-Type": "application/json"
168
+ }),
169
+ status: 200,
170
+ json: async function json() {
171
+ return {
172
+ success: true
173
+ };
174
+ }
175
+ };
176
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
177
+ await client.request(import_types.HttpMethod.Post, "/test", {
178
+ body: requestBody,
179
+ headers: {
180
+ "Content-Type": "multipart/form-data"
181
+ }
182
+ });
183
+ var calledBody = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body;
184
+ (0, import_vitest.expect)(calledBody).toBeInstanceOf(FormData);
185
+ });
186
+ (0, import_vitest.it)("should convert object to URLSearchParams when Content-Type is application/x-www-form-urlencoded", async function () {
187
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
188
+ var requestBody = {
189
+ field1: "value1",
190
+ field2: "value2"
191
+ };
192
+ var mockRes = {
193
+ ok: true,
194
+ headers: new Headers({
195
+ "Content-Type": "text/plain"
196
+ }),
197
+ status: 200,
198
+ text: async function text() {
199
+ return "success";
200
+ }
201
+ };
202
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
203
+ await client.request(import_types.HttpMethod.Post, "/test", {
204
+ body: requestBody,
205
+ headers: {
206
+ "Content-Type": "application/x-www-form-urlencoded"
207
+ }
208
+ });
209
+ var calledBody = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body;
210
+ (0, import_vitest.expect)(calledBody).toBe("field1=value1&field2=value2");
211
+ });
212
+ (0, import_vitest.it)("should handle text response", async function () {
213
+ var textResponse = "Plain text response";
214
+ var mockHeaders = new Headers({
215
+ "Content-Type": "text/plain"
216
+ });
217
+ var mockRes = {
218
+ ok: true,
219
+ headers: mockHeaders,
220
+ status: 200,
221
+ text: async function text() {
222
+ return textResponse;
223
+ }
224
+ };
225
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
226
+ var result = await client.request(import_types.HttpMethod.Get, "/text", {});
227
+ (0, import_vitest.expect)(result.payload).toBe(textResponse);
228
+ (0, import_vitest.expect)(result.headers).toBe(mockHeaders);
229
+ (0, import_vitest.expect)(result.status).toBe(200);
230
+ });
231
+ (0, import_vitest.it)("should throw FrappeError on non-ok response", async function () {
232
+ var errorPayload = {
233
+ message: "Bad Request",
234
+ details: "Invalid input"
235
+ };
236
+ global.fetch = import_vitest.vi.fn().mockResolvedValue({
237
+ ok: false,
238
+ status: 400,
239
+ statusText: "Bad Request",
240
+ headers: new Headers({
241
+ "Content-Type": "application/json"
242
+ }),
243
+ json: async function json() {
244
+ return errorPayload;
245
+ }
246
+ });
247
+ await (0, import_vitest.expect)(client.request(import_types.HttpMethod.Post, "/test", {})).rejects.toThrow(import_types.FrappeError);
248
+ try {
249
+ await client.request(import_types.HttpMethod.Post, "/test", {});
250
+ } catch (error) {
251
+ (0, import_vitest.expect)(error).toBeInstanceOf(import_types.FrappeError);
252
+ (0, import_vitest.expect)(error.status).toBe(400);
253
+ (0, import_vitest.expect)(error.message).toBe("Bad Request");
254
+ (0, import_vitest.expect)(error.data).toEqual(errorPayload);
255
+ }
256
+ });
257
+ (0, import_vitest.it)("should handle network errors", async function () {
258
+ var networkError = new Error("Network error");
259
+ global.fetch = import_vitest.vi.fn().mockRejectedValue(networkError);
260
+ await (0, import_vitest.expect)(client.request(import_types.HttpMethod.Get, "/test", {})).rejects.toThrow("Network error");
261
+ });
262
+ });
263
+ (0, import_vitest.describe)("authentication", function () {
264
+ (0, import_vitest.it)("should add Bearer token to headers", async function () {
265
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_, _getMockFetch_mock_calls__1, _getMockFetch_mock_calls_1;
266
+ var token = "test-bearer-token";
267
+ var authClient = new import_http.HttpClient(baseURL, {
268
+ useToken: true,
269
+ token,
270
+ type: import_types.AuthType.Bearer
271
+ });
272
+ var mockRes = {
273
+ ok: true,
274
+ headers: new Headers({
275
+ "Content-Type": "application/json"
276
+ }),
277
+ status: 200,
278
+ json: async function json() {
279
+ return {
280
+ success: true
281
+ };
282
+ }
283
+ };
284
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
285
+ await authClient.request(import_types.HttpMethod.Get, "/test", {});
286
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
287
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("Authorization")).toBe(`Bearer ${token}`);
288
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_1 = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_1 === void 0 ? void 0 : (_getMockFetch_mock_calls__1 = _getMockFetch_mock_calls_1[1]) === null || _getMockFetch_mock_calls__1 === void 0 ? void 0 : _getMockFetch_mock_calls__1.credentials).toBe("omit");
289
+ });
290
+ (0, import_vitest.it)("should add token auth to headers", async function () {
291
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
292
+ var token = "test-token";
293
+ var authClient = new import_http.HttpClient(baseURL, {
294
+ useToken: true,
295
+ token,
296
+ type: import_types.AuthType.Token
297
+ });
298
+ var mockRes = {
299
+ ok: true,
300
+ headers: new Headers({
301
+ "Content-Type": "application/json"
302
+ }),
303
+ status: 200,
304
+ json: async function json() {
305
+ return {
306
+ success: true
307
+ };
308
+ }
309
+ };
310
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
311
+ await authClient.request(import_types.HttpMethod.Get, "/test", {});
312
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
313
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("Authorization")).toBe(`token ${token}`);
314
+ });
315
+ (0, import_vitest.it)("should support token as function", async function () {
316
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
317
+ var token = "dynamic-token";
318
+ var authClient = new import_http.HttpClient(baseURL, {
319
+ useToken: true,
320
+ token: async function token1() {
321
+ return token;
322
+ },
323
+ type: import_types.AuthType.Bearer
324
+ });
325
+ var mockRes = {
326
+ ok: true,
327
+ headers: new Headers({
328
+ "Content-Type": "application/json"
329
+ }),
330
+ status: 200,
331
+ json: async function json() {
332
+ return {
333
+ success: true
334
+ };
335
+ }
336
+ };
337
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
338
+ await authClient.request(import_types.HttpMethod.Get, "/test", {});
339
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
340
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("Authorization")).toBe(`Bearer ${token}`);
341
+ });
342
+ (0, import_vitest.it)("should add CSRF token for non-GET requests without token auth", async function () {
343
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
344
+ var csrfToken = "csrf-test-token";
345
+ Object.defineProperty(global, "document", {
346
+ value: {
347
+ cookie: `frappe-csrf-token=${csrfToken}; path=/`
348
+ },
349
+ writable: true
350
+ });
351
+ Object.defineProperty(global, "window", {
352
+ value: {},
353
+ writable: true
354
+ });
355
+ var mockRes = {
356
+ ok: true,
357
+ headers: new Headers({
358
+ "Content-Type": "application/json"
359
+ }),
360
+ status: 200,
361
+ json: async function json() {
362
+ return {
363
+ success: true
364
+ };
365
+ }
366
+ };
367
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
368
+ await client.request(import_types.HttpMethod.Post, "/test", {});
369
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
370
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Frappe-CSRF-Token")).toBe(csrfToken);
371
+ Object.defineProperty(global, "document", {
372
+ value: void 0,
373
+ configurable: true
374
+ });
375
+ Object.defineProperty(global, "window", {
376
+ value: void 0,
377
+ configurable: true
378
+ });
379
+ });
380
+ (0, import_vitest.it)("should use credentials include when not using token auth", async function () {
381
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
382
+ var mockRes = {
383
+ ok: true,
384
+ headers: new Headers({
385
+ "Content-Type": "application/json"
386
+ }),
387
+ status: 200,
388
+ json: async function json() {
389
+ return {
390
+ success: true
391
+ };
392
+ }
393
+ };
394
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
395
+ await client.request(import_types.HttpMethod.Get, "/test", {});
396
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.credentials).toBe("include");
397
+ });
398
+ (0, import_vitest.it)("should set token dynamically via function", async function () {
399
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
400
+ var tokenFn = import_vitest.vi.fn().mockResolvedValue("new-token");
401
+ var authClient = new import_http.HttpClient(baseURL, {
402
+ useToken: true,
403
+ token: tokenFn
404
+ });
405
+ var mockRes = {
406
+ ok: true,
407
+ headers: new Headers({
408
+ "Content-Type": "application/json"
409
+ }),
410
+ status: 200,
411
+ json: async function json() {
412
+ return {
413
+ success: true
414
+ };
415
+ }
416
+ };
417
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
418
+ await authClient.request(import_types.HttpMethod.Get, "/test", {});
419
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
420
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("Authorization")).toBe("Bearer new-token");
421
+ (0, import_vitest.expect)(tokenFn).toHaveBeenCalledTimes(1);
422
+ });
423
+ });
424
+ (0, import_vitest.describe)("retry logic", function () {
425
+ (0, import_vitest.it)("should retry on retry-able status codes", async function () {
426
+ var retryClient = new import_http.HttpClient(baseURL, void 0, {
427
+ maxRetries: 2,
428
+ baseDelayMs: 10,
429
+ retryStatusCodes: [503]
430
+ });
431
+ var attempt = 0;
432
+ global.fetch = import_vitest.vi.fn().mockImplementation(async function () {
433
+ attempt++;
434
+ if (attempt < 3) {
435
+ return {
436
+ ok: false,
437
+ status: 503,
438
+ statusText: "Service Unavailable",
439
+ headers: new Headers({
440
+ "Content-Type": "text/plain"
441
+ }),
442
+ text: async function text() {
443
+ return "Service temporarily unavailable";
444
+ }
445
+ };
446
+ }
447
+ return {
448
+ ok: true,
449
+ headers: new Headers({
450
+ "Content-Type": "application/json"
451
+ }),
452
+ status: 200,
453
+ json: async function json() {
454
+ return {
455
+ success: true
456
+ };
457
+ }
458
+ };
459
+ });
460
+ var result = await retryClient.request(import_types.HttpMethod.Get, "/test", {});
461
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledTimes(3);
462
+ (0, import_vitest.expect)(result.payload).toEqual({
463
+ success: true
464
+ });
465
+ });
466
+ (0, import_vitest.it)("should retry on network errors when configured", async function () {
467
+ var retryClient = new import_http.HttpClient(baseURL, void 0, {
468
+ maxRetries: 1,
469
+ baseDelayMs: 10,
470
+ retryOnNetworkError: true
471
+ });
472
+ var attempt = 0;
473
+ global.fetch = import_vitest.vi.fn().mockImplementation(async function () {
474
+ attempt++;
475
+ if (attempt === 1) {
476
+ throw new Error("Network error");
477
+ }
478
+ return {
479
+ ok: true,
480
+ headers: new Headers({
481
+ "Content-Type": "application/json"
482
+ }),
483
+ status: 200,
484
+ json: async function json() {
485
+ return {
486
+ success: true
487
+ };
488
+ }
489
+ };
490
+ });
491
+ var result = await retryClient.request(import_types.HttpMethod.Get, "/test", {});
492
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledTimes(2);
493
+ (0, import_vitest.expect)(result.payload).toEqual({
494
+ success: true
495
+ });
496
+ });
497
+ (0, import_vitest.it)("should not retry on non-retry-able status codes", async function () {
498
+ var retryClient = new import_http.HttpClient(baseURL, void 0, {
499
+ maxRetries: 2,
500
+ baseDelayMs: 10,
501
+ retryStatusCodes: [503]
502
+ });
503
+ global.fetch = import_vitest.vi.fn().mockResolvedValue({
504
+ ok: false,
505
+ status: 400,
506
+ statusText: "Bad Request",
507
+ headers: new Headers({
508
+ "Content-Type": "text/plain"
509
+ }),
510
+ text: async function text() {
511
+ return "Bad request";
512
+ }
513
+ });
514
+ await (0, import_vitest.expect)(retryClient.request(import_types.HttpMethod.Get, "/test", {})).rejects.toThrow(import_types.FrappeError);
515
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledTimes(1);
516
+ });
517
+ (0, import_vitest.it)("should use exponential backoff when configured", async function () {
518
+ var retryClient = new import_http.HttpClient(baseURL, void 0, {
519
+ maxRetries: 3,
520
+ baseDelayMs: 100,
521
+ exponentialBackoff: true,
522
+ maxDelayMs: 500,
523
+ retryStatusCodes: [503]
524
+ });
525
+ var delays = [];
526
+ import_vitest.vi.spyOn(global, "setTimeout").mockImplementation(function (fn, delay) {
527
+ delays.push(delay || 0);
528
+ if (typeof fn === "function") fn();
529
+ return 0;
530
+ });
531
+ var attempt = 0;
532
+ global.fetch = import_vitest.vi.fn().mockImplementation(async function () {
533
+ attempt++;
534
+ if (attempt <= 3) {
535
+ return {
536
+ ok: false,
537
+ status: 503,
538
+ statusText: "Service Unavailable",
539
+ headers: new Headers({
540
+ "Content-Type": "text/plain"
541
+ }),
542
+ text: async function text() {
543
+ return "Service unavailable";
544
+ }
545
+ };
546
+ }
547
+ return {
548
+ ok: true,
549
+ headers: new Headers({
550
+ "Content-Type": "application/json"
551
+ }),
552
+ status: 200,
553
+ json: async function json() {
554
+ return {
555
+ success: true
556
+ };
557
+ }
558
+ };
559
+ });
560
+ var result = await retryClient.request(import_types.HttpMethod.Get, "/test", {});
561
+ (0, import_vitest.expect)(delays[0]).toBe(100);
562
+ (0, import_vitest.expect)(delays[1]).toBe(200);
563
+ (0, import_vitest.expect)(delays[2]).toBe(400);
564
+ (0, import_vitest.expect)(result.payload).toEqual({
565
+ success: true
566
+ });
567
+ });
568
+ (0, import_vitest.it)("should respect maxDelayMs", async function () {
569
+ var retryClient = new import_http.HttpClient(baseURL, void 0, {
570
+ maxRetries: 3,
571
+ baseDelayMs: 100,
572
+ exponentialBackoff: true,
573
+ maxDelayMs: 150,
574
+ retryStatusCodes: [503]
575
+ });
576
+ var delays = [];
577
+ import_vitest.vi.spyOn(global, "setTimeout").mockImplementation(function (fn, delay) {
578
+ delays.push(delay || 0);
579
+ if (typeof fn === "function") fn();
580
+ return 0;
581
+ });
582
+ var attempt = 0;
583
+ global.fetch = import_vitest.vi.fn().mockImplementation(async function () {
584
+ attempt++;
585
+ if (attempt <= 3) {
586
+ return {
587
+ ok: false,
588
+ status: 503,
589
+ statusText: "Service Unavailable",
590
+ headers: new Headers({
591
+ "Content-Type": "text/plain"
592
+ }),
593
+ text: async function text() {
594
+ return "Service unavailable";
595
+ }
596
+ };
597
+ }
598
+ return {
599
+ ok: true,
600
+ headers: new Headers({
601
+ "Content-Type": "application/json"
602
+ }),
603
+ status: 200,
604
+ json: async function json() {
605
+ return {
606
+ success: true
607
+ };
608
+ }
609
+ };
610
+ });
611
+ var result = await retryClient.request(import_types.HttpMethod.Get, "/test", {});
612
+ (0, import_vitest.expect)(delays[0]).toBe(100);
613
+ (0, import_vitest.expect)(delays[1]).toBe(150);
614
+ (0, import_vitest.expect)(delays[2]).toBe(150);
615
+ (0, import_vitest.expect)(result.payload).toEqual({
616
+ success: true
617
+ });
618
+ });
619
+ (0, import_vitest.it)("should use custom shouldRetry function", async function () {
620
+ var shouldRetry = import_vitest.vi.fn(function (_err, attempt2) {
621
+ return attempt2 < 2;
622
+ });
623
+ var retryClient = new import_http.HttpClient(baseURL, void 0, {
624
+ maxRetries: 3,
625
+ baseDelayMs: 10,
626
+ shouldRetry
627
+ });
628
+ var attempt = 0;
629
+ global.fetch = import_vitest.vi.fn().mockImplementation(async function () {
630
+ attempt++;
631
+ if (attempt < 3) {
632
+ return {
633
+ ok: false,
634
+ status: 500,
635
+ statusText: "Internal Server Error",
636
+ headers: new Headers({
637
+ "Content-Type": "text/plain"
638
+ }),
639
+ text: async function text() {
640
+ return "Server error";
641
+ }
642
+ };
643
+ }
644
+ return {
645
+ ok: true,
646
+ headers: new Headers({
647
+ "Content-Type": "application/json"
648
+ }),
649
+ status: 200,
650
+ json: async function json() {
651
+ return {
652
+ success: true
653
+ };
654
+ }
655
+ };
656
+ });
657
+ var result = await retryClient.request(import_types.HttpMethod.Get, "/test", {});
658
+ (0, import_vitest.expect)(shouldRetry).toHaveBeenCalledTimes(2);
659
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledTimes(3);
660
+ (0, import_vitest.expect)(result.payload).toEqual({
661
+ success: true
662
+ });
663
+ });
664
+ (0, import_vitest.it)("should throw last error after max retries", async function () {
665
+ var retryClient = new import_http.HttpClient(baseURL, void 0, {
666
+ maxRetries: 2,
667
+ baseDelayMs: 10,
668
+ retryStatusCodes: [503]
669
+ });
670
+ global.fetch = import_vitest.vi.fn().mockResolvedValue({
671
+ ok: false,
672
+ status: 503,
673
+ statusText: "Service Unavailable",
674
+ headers: new Headers({
675
+ "Content-Type": "text/plain"
676
+ }),
677
+ text: async function text() {
678
+ return "Service unavailable";
679
+ }
680
+ });
681
+ await (0, import_vitest.expect)(retryClient.request(import_types.HttpMethod.Get, "/test", {})).rejects.toThrow(import_types.FrappeError);
682
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledTimes(3);
683
+ });
684
+ });
685
+ (0, import_vitest.describe)("convenience methods", function () {
686
+ (0, import_vitest.beforeEach)(function () {
687
+ var mockRes = {
688
+ ok: true,
689
+ headers: new Headers({
690
+ "Content-Type": "application/json"
691
+ }),
692
+ status: 200,
693
+ json: async function json() {
694
+ return {
695
+ success: true
696
+ };
697
+ }
698
+ };
699
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
700
+ });
701
+ (0, import_vitest.describe)("get", function () {
702
+ (0, import_vitest.it)("should make GET request without params", async function () {
703
+ var result = await client.get("/test");
704
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
705
+ method: "GET"
706
+ }));
707
+ (0, import_vitest.expect)(result.payload).toEqual({
708
+ success: true
709
+ });
710
+ });
711
+ (0, import_vitest.it)("should make GET request with params", async function () {
712
+ await client.get("/test", {
713
+ foo: "bar",
714
+ num: 123,
715
+ bool: true,
716
+ nullValue: null,
717
+ undefinedValue: void 0
718
+ });
719
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test?foo=bar&num=123&bool=true`, import_vitest.expect.objectContaining({
720
+ method: "GET"
721
+ }));
722
+ });
723
+ (0, import_vitest.it)("should handle complex params", async function () {
724
+ await client.get("/test", {
725
+ array: [1, 2, 3],
726
+ object: {
727
+ nested: "value"
728
+ }
729
+ });
730
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test?array=%5B1%2C2%2C3%5D&object=%7B%22nested%22%3A%22value%22%7D`, import_vitest.expect.objectContaining({
731
+ method: "GET"
732
+ }));
733
+ });
734
+ (0, import_vitest.it)("should pass custom headers", async function () {
735
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
736
+ await client.get("/test", {}, {
737
+ "X-Custom": "header"
738
+ });
739
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
740
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Custom")).toBe("header");
741
+ });
742
+ });
743
+ (0, import_vitest.describe)("post", function () {
744
+ (0, import_vitest.it)("should make POST request without body", async function () {
745
+ var result = await client.post("/test");
746
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
747
+ method: "POST"
748
+ }));
749
+ (0, import_vitest.expect)(result.payload).toEqual({
750
+ success: true
751
+ });
752
+ });
753
+ (0, import_vitest.it)("should make POST request with body", async function () {
754
+ var body = {
755
+ data: "test"
756
+ };
757
+ var result = await client.post("/test", body);
758
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
759
+ method: "POST",
760
+ body: JSON.stringify(body)
761
+ }));
762
+ (0, import_vitest.expect)(result.payload).toEqual({
763
+ success: true
764
+ });
765
+ });
766
+ (0, import_vitest.it)("should pass custom headers", async function () {
767
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
768
+ await client.post("/test", {}, {
769
+ "X-Custom": "header"
770
+ });
771
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
772
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Custom")).toBe("header");
773
+ });
774
+ });
775
+ (0, import_vitest.describe)("put", function () {
776
+ (0, import_vitest.it)("should make PUT request", async function () {
777
+ var body = {
778
+ data: "test"
779
+ };
780
+ var result = await client.put("/test", body);
781
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
782
+ method: "PUT",
783
+ body: JSON.stringify(body)
784
+ }));
785
+ (0, import_vitest.expect)(result.payload).toEqual({
786
+ success: true
787
+ });
788
+ });
789
+ (0, import_vitest.it)("should pass custom headers", async function () {
790
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
791
+ await client.put("/test", {}, {
792
+ "X-Custom": "header"
793
+ });
794
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
795
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Custom")).toBe("header");
796
+ });
797
+ });
798
+ (0, import_vitest.describe)("delete", function () {
799
+ (0, import_vitest.it)("should make DELETE request", async function () {
800
+ var result = await client.delete("/test");
801
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
802
+ method: "DELETE"
803
+ }));
804
+ (0, import_vitest.expect)(result.payload).toEqual({
805
+ success: true
806
+ });
807
+ });
808
+ (0, import_vitest.it)("should make DELETE request with body", async function () {
809
+ var body = {
810
+ id: "123"
811
+ };
812
+ var result = await client.delete("/test", body);
813
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
814
+ method: "DELETE",
815
+ body: JSON.stringify(body)
816
+ }));
817
+ (0, import_vitest.expect)(result.payload).toEqual({
818
+ success: true
819
+ });
820
+ });
821
+ (0, import_vitest.it)("should pass custom headers", async function () {
822
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
823
+ await client.delete("/test", void 0, {
824
+ "X-Custom": "header"
825
+ });
826
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
827
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Custom")).toBe("header");
828
+ });
829
+ });
830
+ (0, import_vitest.describe)("head", function () {
831
+ (0, import_vitest.it)("should make HEAD request and return response", async function () {
832
+ var mockRes = {
833
+ ok: true,
834
+ headers: new Headers({
835
+ "Content-Type": "application/json",
836
+ "Content-Length": "1234"
837
+ }),
838
+ status: 200,
839
+ text: async function text() {
840
+ return "";
841
+ },
842
+ json: async function json() {
843
+ return {};
844
+ }
845
+ };
846
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
847
+ var response = await client.head("/test");
848
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test`, import_vitest.expect.objectContaining({
849
+ method: "HEAD"
850
+ }));
851
+ (0, import_vitest.expect)(response.headers.get("Content-Type")).toBe("application/json");
852
+ (0, import_vitest.expect)(response.headers.get("Content-Length")).toBe("1234");
853
+ (0, import_vitest.expect)(response.status).toBe(200);
854
+ });
855
+ (0, import_vitest.it)("should make HEAD request with params", async function () {
856
+ var mockRes = {
857
+ ok: true,
858
+ headers: new Headers(),
859
+ status: 200,
860
+ text: async function text() {
861
+ return "";
862
+ },
863
+ json: async function json() {
864
+ return {};
865
+ }
866
+ };
867
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
868
+ var response = await client.head("/test", {
869
+ check: "true"
870
+ });
871
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/test?check=true`, import_vitest.expect.objectContaining({
872
+ method: "HEAD"
873
+ }));
874
+ (0, import_vitest.expect)(response.status).toBe(200);
875
+ });
876
+ (0, import_vitest.it)("should pass custom headers", async function () {
877
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
878
+ var mockRes = {
879
+ ok: true,
880
+ headers: new Headers(),
881
+ status: 200,
882
+ text: async function text() {
883
+ return "";
884
+ },
885
+ json: async function json() {
886
+ return {};
887
+ }
888
+ };
889
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
890
+ await client.head("/test", {}, {
891
+ "X-Custom": "header"
892
+ });
893
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
894
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Custom")).toBe("header");
895
+ });
896
+ (0, import_vitest.it)("should throw FrappeError on non-ok response", async function () {
897
+ global.fetch = import_vitest.vi.fn().mockResolvedValue({
898
+ ok: false,
899
+ status: 404,
900
+ statusText: "Not Found",
901
+ headers: new Headers(),
902
+ text: async function text() {
903
+ return "Not found";
904
+ }
905
+ });
906
+ await (0, import_vitest.expect)(client.head("/test")).rejects.toThrow(import_types.FrappeError);
907
+ try {
908
+ await client.head("/test");
909
+ } catch (error) {
910
+ (0, import_vitest.expect)(error).toBeInstanceOf(import_types.FrappeError);
911
+ (0, import_vitest.expect)(error.status).toBe(404);
912
+ (0, import_vitest.expect)(error.message).toBe("Not Found");
913
+ }
914
+ });
915
+ (0, import_vitest.it)("should use credentials include when not using token auth", async function () {
916
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
917
+ var mockRes = {
918
+ ok: true,
919
+ headers: new Headers(),
920
+ status: 200,
921
+ text: async function text() {
922
+ return "";
923
+ },
924
+ json: async function json() {
925
+ return {};
926
+ }
927
+ };
928
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
929
+ await client.head("/test");
930
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.credentials).toBe("include");
931
+ });
932
+ (0, import_vitest.it)("should use credentials omit and add auth header when using token auth", async function () {
933
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_, _getMockFetch_mock_calls__1, _getMockFetch_mock_calls_1;
934
+ var authClient = new import_http.HttpClient(baseURL, {
935
+ useToken: true,
936
+ token: "test-token",
937
+ type: import_types.AuthType.Bearer
938
+ });
939
+ var mockRes = {
940
+ ok: true,
941
+ headers: new Headers(),
942
+ status: 200,
943
+ text: async function text() {
944
+ return "";
945
+ },
946
+ json: async function json() {
947
+ return {};
948
+ }
949
+ };
950
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
951
+ await authClient.head("/test");
952
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.credentials).toBe("omit");
953
+ var calledHeaders = (_getMockFetch_mock_calls_1 = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_1 === void 0 ? void 0 : (_getMockFetch_mock_calls__1 = _getMockFetch_mock_calls_1[1]) === null || _getMockFetch_mock_calls__1 === void 0 ? void 0 : _getMockFetch_mock_calls__1.headers;
954
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("Authorization")).toBe("Bearer test-token");
955
+ });
956
+ });
957
+ });
958
+ (0, import_vitest.describe)("edge cases", function () {
959
+ (0, import_vitest.it)("should handle empty response", async function () {
960
+ var mockRes = {
961
+ ok: true,
962
+ headers: new Headers(),
963
+ status: 200,
964
+ text: async function text() {
965
+ return "";
966
+ },
967
+ json: async function json() {
968
+ throw new Error("Invalid JSON");
969
+ }
970
+ };
971
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
972
+ var result = await client.request(import_types.HttpMethod.Get, "/empty", {});
973
+ (0, import_vitest.expect)(result.payload).toBe("");
974
+ (0, import_vitest.expect)(result.status).toBe(200);
975
+ });
976
+ (0, import_vitest.it)("should handle ArrayBuffer body", async function () {
977
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
978
+ var buffer = new ArrayBuffer(8);
979
+ var mockRes = {
980
+ ok: true,
981
+ headers: new Headers({
982
+ "Content-Type": "application/json"
983
+ }),
984
+ status: 200,
985
+ json: async function json() {
986
+ return {
987
+ success: true
988
+ };
989
+ }
990
+ };
991
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
992
+ await client.request(import_types.HttpMethod.Post, "/binary", {
993
+ body: buffer
994
+ });
995
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body).toBe(buffer);
996
+ });
997
+ (0, import_vitest.it)("should handle Blob body", async function () {
998
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
999
+ var blob = new Blob(["test"], {
1000
+ type: "text/plain"
1001
+ });
1002
+ var mockRes = {
1003
+ ok: true,
1004
+ headers: new Headers({
1005
+ "Content-Type": "application/json"
1006
+ }),
1007
+ status: 200,
1008
+ json: async function json() {
1009
+ return {
1010
+ success: true
1011
+ };
1012
+ }
1013
+ };
1014
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1015
+ await client.request(import_types.HttpMethod.Post, "/blob", {
1016
+ body: blob
1017
+ });
1018
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body).toBe(blob);
1019
+ });
1020
+ (0, import_vitest.it)("should handle ArrayBufferView body", async function () {
1021
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1022
+ var uint8Array = new Uint8Array([1, 2, 3, 4]);
1023
+ var mockRes = {
1024
+ ok: true,
1025
+ headers: new Headers({
1026
+ "Content-Type": "application/json"
1027
+ }),
1028
+ status: 200,
1029
+ json: async function json() {
1030
+ return {
1031
+ success: true
1032
+ };
1033
+ }
1034
+ };
1035
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1036
+ await client.request(import_types.HttpMethod.Post, "/typed-array", {
1037
+ body: uint8Array
1038
+ });
1039
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body).toBe(uint8Array);
1040
+ });
1041
+ (0, import_vitest.it)("should handle relative paths", async function () {
1042
+ var mockRes = {
1043
+ ok: true,
1044
+ headers: new Headers({
1045
+ "Content-Type": "application/json"
1046
+ }),
1047
+ status: 200,
1048
+ json: async function json() {
1049
+ return {
1050
+ success: true
1051
+ };
1052
+ }
1053
+ };
1054
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1055
+ await client.request(import_types.HttpMethod.Get, "relative/path", {});
1056
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/relative/path`, import_vitest.expect.any(Object));
1057
+ });
1058
+ (0, import_vitest.it)("should handle absolute paths", async function () {
1059
+ var mockRes = {
1060
+ ok: true,
1061
+ headers: new Headers({
1062
+ "Content-Type": "application/json"
1063
+ }),
1064
+ status: 200,
1065
+ json: async function json() {
1066
+ return {
1067
+ success: true
1068
+ };
1069
+ }
1070
+ };
1071
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1072
+ await client.request(import_types.HttpMethod.Get, "/absolute/path", {});
1073
+ (0, import_vitest.expect)(fetch).toHaveBeenCalledWith(`${baseURL}/absolute/path`, import_vitest.expect.any(Object));
1074
+ });
1075
+ (0, import_vitest.it)("should handle error response with _server_messages", async function () {
1076
+ var errorPayload = {
1077
+ _server_messages: "Server error messages",
1078
+ exc: "Exception details",
1079
+ message: "Error message"
1080
+ };
1081
+ global.fetch = import_vitest.vi.fn().mockResolvedValue({
1082
+ ok: false,
1083
+ status: 500,
1084
+ statusText: "Internal Server Error",
1085
+ headers: new Headers({
1086
+ "Content-Type": "application/json"
1087
+ }),
1088
+ json: async function json() {
1089
+ return errorPayload;
1090
+ }
1091
+ });
1092
+ try {
1093
+ await client.request(import_types.HttpMethod.Post, "/test", {});
1094
+ } catch (error) {
1095
+ (0, import_vitest.expect)(error).toBeInstanceOf(import_types.FrappeError);
1096
+ (0, import_vitest.expect)(error.message).toBe("Error message");
1097
+ }
1098
+ });
1099
+ (0, import_vitest.it)("should handle error response with exc", async function () {
1100
+ var errorPayload = {
1101
+ exc: "Exception details"
1102
+ };
1103
+ global.fetch = import_vitest.vi.fn().mockResolvedValue({
1104
+ ok: false,
1105
+ status: 500,
1106
+ statusText: "Internal Server Error",
1107
+ headers: new Headers({
1108
+ "Content-Type": "application/json"
1109
+ }),
1110
+ json: async function json() {
1111
+ return errorPayload;
1112
+ }
1113
+ });
1114
+ try {
1115
+ await client.request(import_types.HttpMethod.Post, "/test", {});
1116
+ } catch (error) {
1117
+ (0, import_vitest.expect)(error).toBeInstanceOf(import_types.FrappeError);
1118
+ (0, import_vitest.expect)(error.message).toBe("Exception details");
1119
+ }
1120
+ });
1121
+ (0, import_vitest.it)("should handle FormData with Blob values", async function () {
1122
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1123
+ var blob = new Blob(["file content"], {
1124
+ type: "text/plain"
1125
+ });
1126
+ var requestBody = {
1127
+ field: "value",
1128
+ file: blob
1129
+ };
1130
+ var mockRes = {
1131
+ ok: true,
1132
+ headers: new Headers({
1133
+ "Content-Type": "application/json"
1134
+ }),
1135
+ status: 200,
1136
+ json: async function json() {
1137
+ return {
1138
+ success: true
1139
+ };
1140
+ }
1141
+ };
1142
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1143
+ await client.request(import_types.HttpMethod.Post, "/upload", {
1144
+ body: requestBody,
1145
+ headers: {
1146
+ "Content-Type": "multipart/form-data"
1147
+ }
1148
+ });
1149
+ var calledBody = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body;
1150
+ (0, import_vitest.expect)(calledBody).toBeInstanceOf(FormData);
1151
+ });
1152
+ (0, import_vitest.it)("should skip non-string values in URLSearchParams conversion", async function () {
1153
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1154
+ var requestBody = {
1155
+ field1: "value1",
1156
+ field2: 123,
1157
+ field3: null,
1158
+ field4: void 0
1159
+ };
1160
+ var mockRes = {
1161
+ ok: true,
1162
+ headers: new Headers({
1163
+ "Content-Type": "text/plain"
1164
+ }),
1165
+ status: 200,
1166
+ text: async function text() {
1167
+ return "success";
1168
+ }
1169
+ };
1170
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1171
+ await client.request(import_types.HttpMethod.Post, "/test", {
1172
+ body: requestBody,
1173
+ headers: {
1174
+ "Content-Type": "application/x-www-form-urlencoded"
1175
+ }
1176
+ });
1177
+ var calledBody = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body;
1178
+ (0, import_vitest.expect)(calledBody).toBe("field1=value1");
1179
+ });
1180
+ (0, import_vitest.it)("should handle ReadableStream body", async function () {
1181
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1182
+ var stream = new ReadableStream();
1183
+ var mockRes = {
1184
+ ok: true,
1185
+ headers: new Headers({
1186
+ "Content-Type": "application/json"
1187
+ }),
1188
+ status: 200,
1189
+ json: async function json() {
1190
+ return {
1191
+ success: true
1192
+ };
1193
+ }
1194
+ };
1195
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1196
+ await client.request(import_types.HttpMethod.Post, "/stream", {
1197
+ body: stream
1198
+ });
1199
+ (0, import_vitest.expect)((_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.body).toBe(stream);
1200
+ });
1201
+ (0, import_vitest.it)("should handle global frappe csrf token", async function () {
1202
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1203
+ Object.defineProperty(global, "document", {
1204
+ value: {
1205
+ cookie: ""
1206
+ },
1207
+ writable: true,
1208
+ configurable: true
1209
+ });
1210
+ Object.defineProperty(global, "window", {
1211
+ value: {},
1212
+ writable: true,
1213
+ configurable: true
1214
+ });
1215
+ Object.defineProperty(global, "frappe", {
1216
+ value: {
1217
+ csrf_token: "global-csrf-token"
1218
+ },
1219
+ writable: true,
1220
+ configurable: true
1221
+ });
1222
+ var mockRes = {
1223
+ ok: true,
1224
+ headers: new Headers({
1225
+ "Content-Type": "application/json"
1226
+ }),
1227
+ status: 200,
1228
+ json: async function json() {
1229
+ return {
1230
+ success: true
1231
+ };
1232
+ }
1233
+ };
1234
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1235
+ await client.request(import_types.HttpMethod.Post, "/test", {});
1236
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
1237
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Frappe-CSRF-Token")).toBe("global-csrf-token");
1238
+ Object.defineProperty(global, "document", {
1239
+ value: void 0,
1240
+ configurable: true
1241
+ });
1242
+ Object.defineProperty(global, "window", {
1243
+ value: void 0,
1244
+ configurable: true
1245
+ });
1246
+ Object.defineProperty(global, "frappe", {
1247
+ value: void 0,
1248
+ configurable: true
1249
+ });
1250
+ });
1251
+ (0, import_vitest.it)("should prefer frappe-csrf-token cookie over csrf_token", async function () {
1252
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1253
+ Object.defineProperty(global, "document", {
1254
+ value: {
1255
+ cookie: "frappe-csrf-token=preferred; csrf_token=fallback"
1256
+ },
1257
+ writable: true
1258
+ });
1259
+ Object.defineProperty(global, "window", {
1260
+ value: {},
1261
+ writable: true
1262
+ });
1263
+ var mockRes = {
1264
+ ok: true,
1265
+ headers: new Headers({
1266
+ "Content-Type": "application/json"
1267
+ }),
1268
+ status: 200,
1269
+ json: async function json() {
1270
+ return {
1271
+ success: true
1272
+ };
1273
+ }
1274
+ };
1275
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1276
+ await client.request(import_types.HttpMethod.Post, "/test", {});
1277
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
1278
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Frappe-CSRF-Token")).toBe("preferred");
1279
+ Object.defineProperty(global, "document", {
1280
+ value: void 0,
1281
+ configurable: true
1282
+ });
1283
+ Object.defineProperty(global, "window", {
1284
+ value: void 0,
1285
+ configurable: true
1286
+ });
1287
+ });
1288
+ (0, import_vitest.it)("should use csrf_token cookie as fallback", async function () {
1289
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1290
+ Object.defineProperty(global, "document", {
1291
+ value: {
1292
+ cookie: "csrf_token=fallback"
1293
+ },
1294
+ writable: true
1295
+ });
1296
+ Object.defineProperty(global, "window", {
1297
+ value: {},
1298
+ writable: true
1299
+ });
1300
+ var mockRes = {
1301
+ ok: true,
1302
+ headers: new Headers({
1303
+ "Content-Type": "application/json"
1304
+ }),
1305
+ status: 200,
1306
+ json: async function json() {
1307
+ return {
1308
+ success: true
1309
+ };
1310
+ }
1311
+ };
1312
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1313
+ await client.request(import_types.HttpMethod.Post, "/test", {});
1314
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
1315
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Frappe-CSRF-Token")).toBe("fallback");
1316
+ Object.defineProperty(global, "document", {
1317
+ value: void 0,
1318
+ configurable: true
1319
+ });
1320
+ Object.defineProperty(global, "window", {
1321
+ value: void 0,
1322
+ configurable: true
1323
+ });
1324
+ });
1325
+ (0, import_vitest.it)("should not add CSRF token for GET requests", async function () {
1326
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1327
+ Object.defineProperty(global, "document", {
1328
+ value: {
1329
+ cookie: "frappe-csrf-token=test-token"
1330
+ },
1331
+ writable: true
1332
+ });
1333
+ Object.defineProperty(global, "window", {
1334
+ value: {},
1335
+ writable: true
1336
+ });
1337
+ var mockRes = {
1338
+ ok: true,
1339
+ headers: new Headers({
1340
+ "Content-Type": "application/json"
1341
+ }),
1342
+ status: 200,
1343
+ json: async function json() {
1344
+ return {
1345
+ success: true
1346
+ };
1347
+ }
1348
+ };
1349
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1350
+ await client.request(import_types.HttpMethod.Get, "/test", {});
1351
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
1352
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Frappe-CSRF-Token")).toBeNull();
1353
+ Object.defineProperty(global, "document", {
1354
+ value: void 0,
1355
+ configurable: true
1356
+ });
1357
+ Object.defineProperty(global, "window", {
1358
+ value: void 0,
1359
+ configurable: true
1360
+ });
1361
+ });
1362
+ (0, import_vitest.it)("should handle cookie with special characters", async function () {
1363
+ var _getMockFetch_mock_calls__, _getMockFetch_mock_calls_;
1364
+ Object.defineProperty(global, "document", {
1365
+ value: {
1366
+ cookie: "frappe-csrf-token=%2Ftest%2Ftoken%3D"
1367
+ },
1368
+ writable: true
1369
+ });
1370
+ Object.defineProperty(global, "window", {
1371
+ value: {},
1372
+ writable: true
1373
+ });
1374
+ var mockRes = {
1375
+ ok: true,
1376
+ headers: new Headers({
1377
+ "Content-Type": "application/json"
1378
+ }),
1379
+ status: 200,
1380
+ json: async function json() {
1381
+ return {
1382
+ success: true
1383
+ };
1384
+ }
1385
+ };
1386
+ global.fetch = import_vitest.vi.fn().mockResolvedValue(mockRes);
1387
+ await client.request(import_types.HttpMethod.Post, "/test", {});
1388
+ var calledHeaders = (_getMockFetch_mock_calls_ = getMockFetch().mock.calls[0]) === null || _getMockFetch_mock_calls_ === void 0 ? void 0 : (_getMockFetch_mock_calls__ = _getMockFetch_mock_calls_[1]) === null || _getMockFetch_mock_calls__ === void 0 ? void 0 : _getMockFetch_mock_calls__.headers;
1389
+ (0, import_vitest.expect)(calledHeaders === null || calledHeaders === void 0 ? void 0 : calledHeaders.get("X-Frappe-CSRF-Token")).toBe("/test/token=");
1390
+ Object.defineProperty(global, "document", {
1391
+ value: void 0,
1392
+ configurable: true
1393
+ });
1394
+ Object.defineProperty(global, "window", {
1395
+ value: void 0,
1396
+ configurable: true
1397
+ });
1398
+ });
1399
+ });
1400
+ });
1401
+ //# sourceMappingURL=http.spec.native.js.map