@warp-drive/core 5.9.0-beta.0 → 5.9.0-beta.1

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 (436) hide show
  1. package/declarations/aliases-BWYW5EhX.d.ts +17 -0
  2. package/declarations/aliases-BWYW5EhX.d.ts.map +1 -0
  3. package/declarations/build-config/babel-macros.d.ts +2 -1
  4. package/declarations/build-config/canary-features.d.ts +1 -1
  5. package/declarations/build-config/debugging.d.ts +1 -1
  6. package/declarations/build-config/deprecations.d.ts +1 -1
  7. package/declarations/build-config/env.d.ts +2 -1
  8. package/declarations/build-config/macros.d.ts +2 -1
  9. package/declarations/build-config.d.ts +2 -18
  10. package/declarations/change-C7kqv2kW.d.ts +41 -0
  11. package/declarations/change-C7kqv2kW.d.ts.map +1 -0
  12. package/declarations/concepts-LHsLJZMl.d.ts +77 -0
  13. package/declarations/concepts-LHsLJZMl.d.ts.map +1 -0
  14. package/declarations/configure-B_F639tN.d.ts +134 -0
  15. package/declarations/configure-B_F639tN.d.ts.map +1 -0
  16. package/declarations/configure.d.ts +2 -7
  17. package/declarations/document-BEn91SwT.d.ts +129 -0
  18. package/declarations/document-BEn91SwT.d.ts.map +1 -0
  19. package/declarations/error-50OSEhsF.d.ts +77 -0
  20. package/declarations/error-50OSEhsF.d.ts.map +1 -0
  21. package/declarations/fields-FM7peCiM.d.ts +2327 -0
  22. package/declarations/fields-FM7peCiM.d.ts.map +1 -0
  23. package/declarations/graph/-private.d.ts +2 -13
  24. package/declarations/graph-DLqYXP2z.d.ts +186 -0
  25. package/declarations/graph-DLqYXP2z.d.ts.map +1 -0
  26. package/declarations/identifier-DQnqOSJK.d.ts +112 -0
  27. package/declarations/identifier-DQnqOSJK.d.ts.map +1 -0
  28. package/declarations/index.d.ts +2 -96
  29. package/declarations/internal-Cz-893zD.d.ts +8690 -0
  30. package/declarations/internal-Cz-893zD.d.ts.map +1 -0
  31. package/declarations/json-api-raw-C5APJHHB.d.ts +378 -0
  32. package/declarations/json-api-raw-C5APJHHB.d.ts.map +1 -0
  33. package/declarations/mutations-CqtoGB4t.d.ts +165 -0
  34. package/declarations/mutations-CqtoGB4t.d.ts.map +1 -0
  35. package/declarations/operations-D1qA6r0_.d.ts +244 -0
  36. package/declarations/operations-D1qA6r0_.d.ts.map +1 -0
  37. package/declarations/params-DrEx3bf8.d.ts +41 -0
  38. package/declarations/params-DrEx3bf8.d.ts.map +1 -0
  39. package/declarations/raw-D5hnjiq7.d.ts +31 -0
  40. package/declarations/raw-D5hnjiq7.d.ts.map +1 -0
  41. package/declarations/reactive/-private.d.ts +2 -2
  42. package/declarations/reactive.d.ts +2 -286
  43. package/declarations/record-D3QQcaIR.d.ts +254 -0
  44. package/declarations/record-D3QQcaIR.d.ts.map +1 -0
  45. package/declarations/relationship-CmHzMPKf.d.ts +65 -0
  46. package/declarations/relationship-CmHzMPKf.d.ts.map +1 -0
  47. package/declarations/request.d.ts +2 -52
  48. package/declarations/signals/-leaked.d.ts +63 -2
  49. package/declarations/signals/-leaked.d.ts.map +1 -0
  50. package/declarations/store/-private.d.ts +2 -24
  51. package/declarations/store.d.ts +8358 -2
  52. package/declarations/store.d.ts.map +1 -0
  53. package/declarations/symbols-DjRDCeX0.d.ts +88 -0
  54. package/declarations/symbols-DjRDCeX0.d.ts.map +1 -0
  55. package/declarations/types/-private.d.ts +71 -17
  56. package/declarations/types/-private.d.ts.map +1 -0
  57. package/declarations/types/cache/aliases.d.ts +2 -1
  58. package/declarations/types/cache/change.d.ts +2 -6
  59. package/declarations/types/cache/mutations.d.ts +2 -38
  60. package/declarations/types/cache/operations.d.ts +2 -168
  61. package/declarations/types/cache/relationship.d.ts +2 -13
  62. package/declarations/types/cache.d.ts +2 -429
  63. package/declarations/types/graph.d.ts +2 -47
  64. package/declarations/types/identifier.d.ts +2 -86
  65. package/declarations/types/json/raw.d.ts +2 -6
  66. package/declarations/types/params.d.ts +2 -8
  67. package/declarations/types/record.d.ts +2 -269
  68. package/declarations/types/request.d.ts +2 -367
  69. package/declarations/types/runtime.d.ts +53 -12
  70. package/declarations/types/runtime.d.ts.map +1 -0
  71. package/declarations/types/schema/concepts.d.ts +2 -23
  72. package/declarations/types/schema/fields.d.ts +2 -2200
  73. package/declarations/types/schema/fields.type-test.d.ts +1 -1
  74. package/declarations/types/schema/schema-service.d.ts +2 -380
  75. package/declarations/types/spec/document.d.ts +2 -67
  76. package/declarations/types/spec/error.d.ts +2 -18
  77. package/declarations/types/spec/json-api-raw.d.ts +2 -139
  78. package/declarations/types/symbols.d.ts +2 -78
  79. package/declarations/types/utils.d.ts +2 -5
  80. package/declarations/types.d.ts +3 -11
  81. package/declarations/utils/string.d.ts +51 -44
  82. package/declarations/utils/string.d.ts.map +1 -0
  83. package/declarations/utils-BtURiy8l.d.ts +24 -0
  84. package/declarations/utils-BtURiy8l.d.ts.map +1 -0
  85. package/dist/-private-DMzvF_Q6.js +120 -0
  86. package/dist/-private-DMzvF_Q6.js.map +1 -0
  87. package/dist/-private-HjaQ1wp1.js +1695 -0
  88. package/dist/-private-HjaQ1wp1.js.map +1 -0
  89. package/dist/-private-b1g4dhl0.js +22 -0
  90. package/dist/-private-b1g4dhl0.js.map +1 -0
  91. package/dist/build-config/babel-macros.js +3 -1
  92. package/dist/build-config/canary-features.js +1 -1
  93. package/dist/build-config/debugging.js +1 -1
  94. package/dist/build-config/deprecations.js +1 -1
  95. package/dist/build-config/env.js +3 -1
  96. package/dist/build-config/macros.js +3 -1
  97. package/dist/build-config.js +3 -1
  98. package/dist/configure.js +3 -2
  99. package/dist/graph/-private.js +2183 -3192
  100. package/dist/graph/-private.js.map +1 -0
  101. package/dist/index.js +3 -8
  102. package/dist/reactive/-private.js +3 -1
  103. package/dist/reactive.js +5 -4
  104. package/dist/request--vRFALbQ.js +766 -0
  105. package/dist/request--vRFALbQ.js.map +1 -0
  106. package/dist/request.js +2 -48
  107. package/dist/signals/-leaked.js +3 -1
  108. package/dist/src-Dex_phWI.js +9088 -0
  109. package/dist/src-Dex_phWI.js.map +1 -0
  110. package/dist/store/-private.js +3 -1
  111. package/dist/store-DNF9Rgoh.js +462 -0
  112. package/dist/store-DNF9Rgoh.js.map +1 -0
  113. package/dist/store.js +3 -1
  114. package/dist/types/-private.js +1 -77
  115. package/dist/types/identifier.js +60 -52
  116. package/dist/types/identifier.js.map +1 -0
  117. package/dist/types/record.js +211 -181
  118. package/dist/types/record.js.map +1 -0
  119. package/dist/types/request.js +138 -69
  120. package/dist/types/request.js.map +1 -0
  121. package/dist/types/runtime.js +54 -26
  122. package/dist/types/runtime.js.map +1 -0
  123. package/dist/types/schema/fields.js +501 -495
  124. package/dist/types/schema/fields.js.map +1 -0
  125. package/dist/types/schema/fields.type-test.js +79 -0
  126. package/dist/types/schema/fields.type-test.js.map +1 -0
  127. package/dist/types/symbols.js +84 -77
  128. package/dist/types/symbols.js.map +1 -0
  129. package/dist/unpkg/dev/-private-2RfQ2761.js +111 -0
  130. package/dist/unpkg/dev/-private-2RfQ2761.js.map +1 -0
  131. package/dist/unpkg/dev/-private-CM1zxNws.js +1684 -0
  132. package/dist/unpkg/dev/-private-CM1zxNws.js.map +1 -0
  133. package/dist/unpkg/dev/-private-DL4tfrv9.js +22 -0
  134. package/dist/unpkg/dev/-private-DL4tfrv9.js.map +1 -0
  135. package/dist/unpkg/dev/build-config/babel-macros.js +3 -1
  136. package/dist/unpkg/dev/build-config/canary-features.js +1 -1
  137. package/dist/unpkg/dev/build-config/debugging.js +1 -1
  138. package/dist/unpkg/dev/build-config/deprecations.js +1 -1
  139. package/dist/unpkg/dev/build-config/env.js +3 -1
  140. package/dist/unpkg/dev/build-config/macros.js +3 -1
  141. package/dist/unpkg/dev/build-config.js +3 -1
  142. package/dist/unpkg/dev/configure.js +3 -1
  143. package/dist/unpkg/dev/graph/-private.js +1941 -2949
  144. package/dist/unpkg/dev/graph/-private.js.map +1 -0
  145. package/dist/unpkg/dev/index.js +3 -6
  146. package/dist/unpkg/dev/reactive/-private.js +3 -1
  147. package/dist/unpkg/dev/reactive.js +5 -3
  148. package/dist/unpkg/dev/request-DAuXbfYi.js +756 -0
  149. package/dist/unpkg/dev/request-DAuXbfYi.js.map +1 -0
  150. package/dist/unpkg/dev/request.js +2 -48
  151. package/dist/unpkg/dev/runtime-EoVKAhTv.js +110 -0
  152. package/dist/unpkg/dev/runtime-EoVKAhTv.js.map +1 -0
  153. package/dist/unpkg/dev/signals/-leaked.js +3 -1
  154. package/dist/unpkg/dev/src-Bxlr_vue.js +8192 -0
  155. package/dist/unpkg/dev/src-Bxlr_vue.js.map +1 -0
  156. package/dist/unpkg/dev/store/-private.js +3 -55
  157. package/dist/unpkg/dev/store-DmiFvT1B.js +427 -0
  158. package/dist/unpkg/dev/store-DmiFvT1B.js.map +1 -0
  159. package/dist/unpkg/dev/store.js +1 -556
  160. package/dist/unpkg/dev/types/-private.js +1 -67
  161. package/dist/unpkg/dev/types/identifier.js +63 -56
  162. package/dist/unpkg/dev/types/identifier.js.map +1 -0
  163. package/dist/unpkg/dev/types/record.js +211 -181
  164. package/dist/unpkg/dev/types/record.js.map +1 -0
  165. package/dist/unpkg/dev/types/request.js +138 -69
  166. package/dist/unpkg/dev/types/request.js.map +1 -0
  167. package/dist/unpkg/dev/types/runtime.js +54 -26
  168. package/dist/unpkg/dev/types/runtime.js.map +1 -0
  169. package/dist/unpkg/dev/types/schema/fields.js +501 -495
  170. package/dist/unpkg/dev/types/schema/fields.js.map +1 -0
  171. package/dist/unpkg/dev/types/schema/fields.type-test.js +79 -0
  172. package/dist/unpkg/dev/types/schema/fields.type-test.js.map +1 -0
  173. package/dist/unpkg/dev/types/symbols.js +84 -77
  174. package/dist/unpkg/dev/types/symbols.js.map +1 -0
  175. package/dist/unpkg/dev/utils/string.js +79 -85
  176. package/dist/unpkg/dev/utils/string.js.map +1 -0
  177. package/dist/unpkg/dev-deprecated/-private-2RfQ2761.js +111 -0
  178. package/dist/unpkg/dev-deprecated/-private-2RfQ2761.js.map +1 -0
  179. package/dist/unpkg/dev-deprecated/-private-CM1zxNws.js +1684 -0
  180. package/dist/unpkg/dev-deprecated/-private-CM1zxNws.js.map +1 -0
  181. package/dist/unpkg/dev-deprecated/-private-DL4tfrv9.js +22 -0
  182. package/dist/unpkg/dev-deprecated/-private-DL4tfrv9.js.map +1 -0
  183. package/dist/unpkg/dev-deprecated/build-config/babel-macros.js +3 -1
  184. package/dist/unpkg/dev-deprecated/build-config/canary-features.js +1 -1
  185. package/dist/unpkg/dev-deprecated/build-config/debugging.js +1 -1
  186. package/dist/unpkg/dev-deprecated/build-config/deprecations.js +1 -1
  187. package/dist/unpkg/dev-deprecated/build-config/env.js +3 -1
  188. package/dist/unpkg/dev-deprecated/build-config/macros.js +3 -1
  189. package/dist/unpkg/dev-deprecated/build-config.js +3 -1
  190. package/dist/unpkg/dev-deprecated/configure.js +3 -1
  191. package/dist/unpkg/dev-deprecated/graph/-private.js +2060 -3143
  192. package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -0
  193. package/dist/unpkg/dev-deprecated/index.js +3 -5
  194. package/dist/unpkg/dev-deprecated/reactive/-private.js +3 -1
  195. package/dist/unpkg/dev-deprecated/reactive.js +5 -3
  196. package/dist/unpkg/dev-deprecated/request-DAuXbfYi.js +756 -0
  197. package/dist/unpkg/dev-deprecated/request-DAuXbfYi.js.map +1 -0
  198. package/dist/unpkg/dev-deprecated/request.js +2 -48
  199. package/dist/unpkg/dev-deprecated/runtime-BacZMq1r.js +110 -0
  200. package/dist/unpkg/dev-deprecated/runtime-BacZMq1r.js.map +1 -0
  201. package/dist/unpkg/dev-deprecated/signals/-leaked.js +3 -1
  202. package/dist/unpkg/dev-deprecated/src-DEl2Ca3T.js +8745 -0
  203. package/dist/unpkg/dev-deprecated/src-DEl2Ca3T.js.map +1 -0
  204. package/dist/unpkg/dev-deprecated/store/-private.js +3 -1
  205. package/dist/unpkg/dev-deprecated/store-TcP2H4Af.js +427 -0
  206. package/dist/unpkg/dev-deprecated/store-TcP2H4Af.js.map +1 -0
  207. package/dist/unpkg/dev-deprecated/store.js +1 -556
  208. package/dist/unpkg/dev-deprecated/types/-private.js +1 -67
  209. package/dist/unpkg/dev-deprecated/types/identifier.js +63 -56
  210. package/dist/unpkg/dev-deprecated/types/identifier.js.map +1 -0
  211. package/dist/unpkg/dev-deprecated/types/record.js +211 -181
  212. package/dist/unpkg/dev-deprecated/types/record.js.map +1 -0
  213. package/dist/unpkg/dev-deprecated/types/request.js +138 -69
  214. package/dist/unpkg/dev-deprecated/types/request.js.map +1 -0
  215. package/dist/unpkg/dev-deprecated/types/runtime.js +54 -26
  216. package/dist/unpkg/dev-deprecated/types/runtime.js.map +1 -0
  217. package/dist/unpkg/dev-deprecated/types/schema/fields.js +501 -495
  218. package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -0
  219. package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +79 -0
  220. package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js.map +1 -0
  221. package/dist/unpkg/dev-deprecated/types/symbols.js +84 -77
  222. package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -0
  223. package/dist/unpkg/dev-deprecated/utils/string.js +79 -85
  224. package/dist/unpkg/dev-deprecated/utils/string.js.map +1 -0
  225. package/dist/unpkg/prod/-private-BK71-uXR.js +99 -0
  226. package/dist/unpkg/prod/-private-BK71-uXR.js.map +1 -0
  227. package/dist/unpkg/prod/-private-TNaS5Piv.js +1494 -0
  228. package/dist/unpkg/prod/-private-TNaS5Piv.js.map +1 -0
  229. package/dist/unpkg/prod/-private-Z9i0icpE.js +22 -0
  230. package/dist/unpkg/prod/-private-Z9i0icpE.js.map +1 -0
  231. package/dist/unpkg/prod/build-config/babel-macros.js +3 -1
  232. package/dist/unpkg/prod/build-config/canary-features.js +1 -1
  233. package/dist/unpkg/prod/build-config/debugging.js +1 -1
  234. package/dist/unpkg/prod/build-config/deprecations.js +1 -1
  235. package/dist/unpkg/prod/build-config/env.js +3 -1
  236. package/dist/unpkg/prod/build-config/macros.js +3 -1
  237. package/dist/unpkg/prod/build-config.js +3 -1
  238. package/dist/unpkg/prod/configure.js +3 -2
  239. package/dist/unpkg/prod/graph/-private.js +1475 -2095
  240. package/dist/unpkg/prod/graph/-private.js.map +1 -0
  241. package/dist/unpkg/prod/index.js +2 -482
  242. package/dist/unpkg/prod/reactive/-private.js +3 -1
  243. package/dist/unpkg/prod/reactive.js +5 -30
  244. package/dist/unpkg/prod/request-BcJNzSgv.js +480 -0
  245. package/dist/unpkg/prod/request-BcJNzSgv.js.map +1 -0
  246. package/dist/unpkg/prod/request.js +3 -2
  247. package/dist/unpkg/prod/signals/-leaked.js +3 -1
  248. package/dist/unpkg/prod/src-Dzz-j6pp.js +6799 -0
  249. package/dist/unpkg/prod/src-Dzz-j6pp.js.map +1 -0
  250. package/dist/unpkg/prod/store/-private.js +3 -126
  251. package/dist/unpkg/prod/store-BWhmb7Ob.js +359 -0
  252. package/dist/unpkg/prod/store-BWhmb7Ob.js.map +1 -0
  253. package/dist/unpkg/prod/store.js +1 -435
  254. package/dist/unpkg/prod/types/-private.js +1 -47
  255. package/dist/unpkg/prod/types/identifier.js +63 -56
  256. package/dist/unpkg/prod/types/identifier.js.map +1 -0
  257. package/dist/unpkg/prod/types/record.js +211 -181
  258. package/dist/unpkg/prod/types/record.js.map +1 -0
  259. package/dist/unpkg/prod/types/request.js +138 -69
  260. package/dist/unpkg/prod/types/request.js.map +1 -0
  261. package/dist/unpkg/prod/types/runtime.js +54 -26
  262. package/dist/unpkg/prod/types/runtime.js.map +1 -0
  263. package/dist/unpkg/prod/types/schema/fields.js +501 -495
  264. package/dist/unpkg/prod/types/schema/fields.js.map +1 -0
  265. package/dist/unpkg/prod/types/schema/fields.type-test.js +79 -0
  266. package/dist/unpkg/prod/types/schema/fields.type-test.js.map +1 -0
  267. package/dist/unpkg/prod/types/symbols.js +84 -77
  268. package/dist/unpkg/prod/types/symbols.js.map +1 -0
  269. package/dist/unpkg/prod/utils/string.js +70 -66
  270. package/dist/unpkg/prod/utils/string.js.map +1 -0
  271. package/dist/unpkg/prod-deprecated/-private-BK71-uXR.js +99 -0
  272. package/dist/unpkg/prod-deprecated/-private-BK71-uXR.js.map +1 -0
  273. package/dist/unpkg/prod-deprecated/-private-TNaS5Piv.js +1494 -0
  274. package/dist/unpkg/prod-deprecated/-private-TNaS5Piv.js.map +1 -0
  275. package/dist/unpkg/prod-deprecated/-private-Z9i0icpE.js +22 -0
  276. package/dist/unpkg/prod-deprecated/-private-Z9i0icpE.js.map +1 -0
  277. package/dist/unpkg/prod-deprecated/build-config/babel-macros.js +3 -1
  278. package/dist/unpkg/prod-deprecated/build-config/canary-features.js +1 -1
  279. package/dist/unpkg/prod-deprecated/build-config/debugging.js +1 -1
  280. package/dist/unpkg/prod-deprecated/build-config/deprecations.js +1 -1
  281. package/dist/unpkg/prod-deprecated/build-config/env.js +3 -1
  282. package/dist/unpkg/prod-deprecated/build-config/macros.js +3 -1
  283. package/dist/unpkg/prod-deprecated/build-config.js +3 -1
  284. package/dist/unpkg/prod-deprecated/configure.js +3 -2
  285. package/dist/unpkg/prod-deprecated/graph/-private.js +1586 -2266
  286. package/dist/unpkg/prod-deprecated/graph/-private.js.map +1 -0
  287. package/dist/unpkg/prod-deprecated/index.js +2 -482
  288. package/dist/unpkg/prod-deprecated/reactive/-private.js +3 -1
  289. package/dist/unpkg/prod-deprecated/reactive.js +5 -5
  290. package/dist/unpkg/prod-deprecated/request-BcJNzSgv.js +480 -0
  291. package/dist/unpkg/prod-deprecated/request-BcJNzSgv.js.map +1 -0
  292. package/dist/unpkg/prod-deprecated/request.js +3 -2
  293. package/dist/unpkg/prod-deprecated/signals/-leaked.js +3 -1
  294. package/dist/unpkg/prod-deprecated/src-BOifHFQ5.js +7232 -0
  295. package/dist/unpkg/prod-deprecated/src-BOifHFQ5.js.map +1 -0
  296. package/dist/unpkg/prod-deprecated/store/-private.js +3 -88
  297. package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js +359 -0
  298. package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +1 -0
  299. package/dist/unpkg/prod-deprecated/store.js +1 -435
  300. package/dist/unpkg/prod-deprecated/types/-private.js +1 -47
  301. package/dist/unpkg/prod-deprecated/types/identifier.js +63 -56
  302. package/dist/unpkg/prod-deprecated/types/identifier.js.map +1 -0
  303. package/dist/unpkg/prod-deprecated/types/record.js +211 -181
  304. package/dist/unpkg/prod-deprecated/types/record.js.map +1 -0
  305. package/dist/unpkg/prod-deprecated/types/request.js +138 -69
  306. package/dist/unpkg/prod-deprecated/types/request.js.map +1 -0
  307. package/dist/unpkg/prod-deprecated/types/runtime.js +54 -26
  308. package/dist/unpkg/prod-deprecated/types/runtime.js.map +1 -0
  309. package/dist/unpkg/prod-deprecated/types/schema/fields.js +501 -495
  310. package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -0
  311. package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +79 -0
  312. package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js.map +1 -0
  313. package/dist/unpkg/prod-deprecated/types/symbols.js +84 -77
  314. package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -0
  315. package/dist/unpkg/prod-deprecated/utils/string.js +70 -66
  316. package/dist/unpkg/prod-deprecated/utils/string.js.map +1 -0
  317. package/dist/utils/string.js +84 -85
  318. package/dist/utils/string.js.map +1 -0
  319. package/package.json +9 -9
  320. package/declarations/graph/-private/-diff.d.ts +0 -19
  321. package/declarations/graph/-private/-edge-definition.d.ts +0 -149
  322. package/declarations/graph/-private/-state.d.ts +0 -9
  323. package/declarations/graph/-private/-utils.d.ts +0 -25
  324. package/declarations/graph/-private/coerce-id.d.ts +0 -4
  325. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -6
  326. package/declarations/graph/-private/edges/collection.d.ts +0 -39
  327. package/declarations/graph/-private/edges/implicit.d.ts +0 -43
  328. package/declarations/graph/-private/edges/resource.d.ts +0 -23
  329. package/declarations/graph/-private/graph.d.ts +0 -56
  330. package/declarations/graph/-private/normalize-link.d.ts +0 -2
  331. package/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
  332. package/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
  333. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
  334. package/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
  335. package/declarations/graph/-private/operations/replace-related-records.d.ts +0 -7
  336. package/declarations/graph/-private/operations/update-relationship.d.ts +0 -9
  337. package/declarations/reactive/-private/default-mode.d.ts +0 -73
  338. package/declarations/reactive/-private/document.d.ts +0 -142
  339. package/declarations/reactive/-private/fields/extension.d.ts +0 -8
  340. package/declarations/reactive/-private/fields/get-field-key.d.ts +0 -8
  341. package/declarations/reactive/-private/fields/managed-array.d.ts +0 -18
  342. package/declarations/reactive/-private/fields/managed-object.d.ts +0 -17
  343. package/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
  344. package/declarations/reactive/-private/hooks.d.ts +0 -5
  345. package/declarations/reactive/-private/kind/alias-field.d.ts +0 -4
  346. package/declarations/reactive/-private/kind/array-field.d.ts +0 -4
  347. package/declarations/reactive/-private/kind/attribute-field.d.ts +0 -4
  348. package/declarations/reactive/-private/kind/belongs-to-field.d.ts +0 -4
  349. package/declarations/reactive/-private/kind/collection-field.d.ts +0 -4
  350. package/declarations/reactive/-private/kind/derived-field.d.ts +0 -4
  351. package/declarations/reactive/-private/kind/generic-field.d.ts +0 -4
  352. package/declarations/reactive/-private/kind/has-many-field.d.ts +0 -4
  353. package/declarations/reactive/-private/kind/hash-field.d.ts +0 -4
  354. package/declarations/reactive/-private/kind/identity-field.d.ts +0 -4
  355. package/declarations/reactive/-private/kind/local-field.d.ts +0 -4
  356. package/declarations/reactive/-private/kind/object-field.d.ts +0 -4
  357. package/declarations/reactive/-private/kind/resource-field.d.ts +0 -4
  358. package/declarations/reactive/-private/kind/schema-array-field.d.ts +0 -4
  359. package/declarations/reactive/-private/kind/schema-object-field.d.ts +0 -4
  360. package/declarations/reactive/-private/record.d.ts +0 -83
  361. package/declarations/reactive/-private/schema.d.ts +0 -326
  362. package/declarations/reactive/-private/symbols.d.ts +0 -5
  363. package/declarations/request/-private/context.d.ts +0 -39
  364. package/declarations/request/-private/debug.d.ts +0 -4
  365. package/declarations/request/-private/fetch.d.ts +0 -33
  366. package/declarations/request/-private/future.d.ts +0 -7
  367. package/declarations/request/-private/manager.d.ts +0 -158
  368. package/declarations/request/-private/promise-cache.d.ts +0 -28
  369. package/declarations/request/-private/types.d.ts +0 -234
  370. package/declarations/request/-private/utils.d.ts +0 -57
  371. package/declarations/signals/-private.d.ts +0 -6
  372. package/declarations/signals/promise-state.d.ts +0 -264
  373. package/declarations/signals/reactivity/configure.d.ts +0 -138
  374. package/declarations/signals/reactivity/internal.d.ts +0 -154
  375. package/declarations/signals/reactivity/signal.d.ts +0 -56
  376. package/declarations/signals/request-state.d.ts +0 -372
  377. package/declarations/signals/request-subscription.d.ts +0 -177
  378. package/declarations/store/-private/cache-handler/handler.d.ts +0 -56
  379. package/declarations/store/-private/cache-handler/types.d.ts +0 -84
  380. package/declarations/store/-private/cache-handler/utils.d.ts +0 -31
  381. package/declarations/store/-private/caches/instance-cache.d.ts +0 -58
  382. package/declarations/store/-private/caches/resource-utils.d.ts +0 -9
  383. package/declarations/store/-private/debug/utils.d.ts +0 -7
  384. package/declarations/store/-private/default-cache-policy.d.ts +0 -387
  385. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -34
  386. package/declarations/store/-private/managers/cache-key-manager.d.ts +0 -304
  387. package/declarations/store/-private/managers/cache-manager.d.ts +0 -367
  388. package/declarations/store/-private/managers/notification-manager.d.ts +0 -83
  389. package/declarations/store/-private/managers/record-array-manager.d.ts +0 -100
  390. package/declarations/store/-private/network/request-cache.d.ts +0 -103
  391. package/declarations/store/-private/record-arrays/-utils.d.ts +0 -80
  392. package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +0 -81
  393. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +0 -133
  394. package/declarations/store/-private/record-arrays/legacy-query.d.ts +0 -81
  395. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -3
  396. package/declarations/store/-private/record-arrays/resource-array.d.ts +0 -67
  397. package/declarations/store/-private/store-service.d.ts +0 -874
  398. package/declarations/store/-private/utils/coerce-id.d.ts +0 -4
  399. package/declarations/store/-private/utils/construct-resource.d.ts +0 -6
  400. package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
  401. package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
  402. package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
  403. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -90
  404. package/declarations/store/-types/q/identifier.d.ts +0 -23
  405. package/declarations/store/-types/q/record-instance.d.ts +0 -22
  406. package/declarations/store/-types/q/store.d.ts +0 -31
  407. package/declarations/store/deprecated/-private.d.ts +0 -223
  408. package/declarations/store/deprecated/store.d.ts +0 -784
  409. package/dist/configure-DPUFCemT.js +0 -1940
  410. package/dist/default-cache-policy-D7_u4YRH.js +0 -572
  411. package/dist/future-BKkJJkj7.js +0 -678
  412. package/dist/index-CQP2NSqg.js +0 -9982
  413. package/dist/symbols-3C1OkYtZ.js +0 -39
  414. package/dist/unpkg/dev/-leaked-Co0EI6Go.js +0 -1939
  415. package/dist/unpkg/dev/-private-sql1_mdx.js +0 -39
  416. package/dist/unpkg/dev/future-DFfOzSoe.js +0 -672
  417. package/dist/unpkg/dev/index-BzcBOnw9.js +0 -9392
  418. package/dist/unpkg/dev/runtime-E1M51_-O.js +0 -135
  419. package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +0 -1939
  420. package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +0 -39
  421. package/dist/unpkg/dev-deprecated/future-DFfOzSoe.js +0 -672
  422. package/dist/unpkg/dev-deprecated/index-6TnTv-WG.js +0 -10007
  423. package/dist/unpkg/dev-deprecated/runtime-DAu5b0IR.js +0 -135
  424. package/dist/unpkg/prod/-leaked-DUONXQDB.js +0 -1676
  425. package/dist/unpkg/prod/-private-sql1_mdx.js +0 -39
  426. package/dist/unpkg/prod/handler-EU_8ncB2.js +0 -1619
  427. package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +0 -19
  428. package/dist/unpkg/prod/request-BrJSCG6r.js +0 -421
  429. package/dist/unpkg/prod/schema-BSkHyoWz.js +0 -5219
  430. package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +0 -1676
  431. package/dist/unpkg/prod-deprecated/-private-3C1OkYtZ.js +0 -39
  432. package/dist/unpkg/prod-deprecated/handler-CCIu4sQ3.js +0 -334
  433. package/dist/unpkg/prod-deprecated/hooks-Dv4Np0MY.js +0 -26
  434. package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +0 -19
  435. package/dist/unpkg/prod-deprecated/request-BrJSCG6r.js +0 -421
  436. package/dist/unpkg/prod-deprecated/schema-CJcjHv0E.js +0 -6939
@@ -0,0 +1,766 @@
1
+ import { n as getOrSetUniversal, t as getOrSetGlobal } from "./-private-DMzvF_Q6.js";
2
+ import { IS_FUTURE, STRUCTURED, SkipCache } from "./types/request.js";
3
+ import { CACHE_OWNER } from "./types/identifier.js";
4
+ import { getGlobalConfig, macroCondition } from "@embroider/macros";
5
+
6
+ //#region src/request/-private/debug.ts
7
+ const BODY_TYPES = {
8
+ type: "string",
9
+ klass: [
10
+ "Blob",
11
+ "ArrayBuffer",
12
+ "TypedArray",
13
+ "DataView",
14
+ "FormData",
15
+ "URLSearchParams",
16
+ "ReadableStream"
17
+ ]
18
+ };
19
+ const ValidKeys = /* @__PURE__ */ new Map([
20
+ ["duplex", ["half"]],
21
+ ["records", "array"],
22
+ ["data", "json"],
23
+ ["body", BODY_TYPES],
24
+ ["disableTestWaiter", "boolean"],
25
+ ["options", "object"],
26
+ ["cacheOptions", "object"],
27
+ ["priority", [
28
+ "high",
29
+ "low",
30
+ "auto"
31
+ ]],
32
+ ["op", "string"],
33
+ ["store", "object"],
34
+ ["url", "string"],
35
+ ["cache", [
36
+ "default",
37
+ "force-cache",
38
+ "no-cache",
39
+ "no-store",
40
+ "only-if-cached",
41
+ "reload"
42
+ ]],
43
+ ["credentials", [
44
+ "include",
45
+ "omit",
46
+ "same-origin"
47
+ ]],
48
+ ["destination", [
49
+ "",
50
+ "object",
51
+ "audio",
52
+ "audioworklet",
53
+ "document",
54
+ "embed",
55
+ "font",
56
+ "frame",
57
+ "iframe",
58
+ "image",
59
+ "manifest",
60
+ "paintworklet",
61
+ "report",
62
+ "script",
63
+ "sharedworker",
64
+ "style",
65
+ "track",
66
+ "video",
67
+ "worker",
68
+ "xslt"
69
+ ]],
70
+ ["headers", "headers"],
71
+ ["integrity", "string"],
72
+ ["keepalive", "boolean"],
73
+ ["method", [
74
+ "QUERY",
75
+ "GET",
76
+ "PUT",
77
+ "PATCH",
78
+ "DELETE",
79
+ "POST",
80
+ "OPTIONS",
81
+ "HEAD",
82
+ "CONNECT",
83
+ "TRACE"
84
+ ]],
85
+ ["mode", [
86
+ "same-origin",
87
+ "cors",
88
+ "navigate",
89
+ "no-cors"
90
+ ]],
91
+ ["redirect", [
92
+ "error",
93
+ "follow",
94
+ "manual"
95
+ ]],
96
+ ["referrer", "string"],
97
+ ["signal", "AbortSignal"],
98
+ ["controller", "AbortController"],
99
+ ["referrerPolicy", [
100
+ "",
101
+ "same-origin",
102
+ "no-referrer",
103
+ "no-referrer-when-downgrade",
104
+ "origin",
105
+ "origin-when-cross-origin",
106
+ "strict-origin",
107
+ "strict-origin-when-cross-origin",
108
+ "unsafe-url"
109
+ ]]
110
+ ]);
111
+ const IS_FROZEN = getOrSetGlobal("IS_FROZEN", Symbol("FROZEN"));
112
+ const IS_COLLECTION = getOrSetGlobal("IS_COLLECTION", Symbol.for("Collection"));
113
+ function freezeHeaders(headers) {
114
+ headers.delete = headers.set = headers.append = () => {
115
+ throw new Error(`Cannot Mutate Immutatable Headers, use headers.clone to get a copy`);
116
+ };
117
+ upgradeHeaders(headers);
118
+ return headers;
119
+ }
120
+ function deepFreeze(value) {
121
+ if (value && value[IS_FROZEN]) return value;
122
+ switch (typeof value) {
123
+ case "boolean":
124
+ case "string":
125
+ case "number":
126
+ case "symbol":
127
+ case "undefined":
128
+ case "bigint": return value;
129
+ case "function": throw new Error(`Cannot deep-freeze a function`);
130
+ case "object": switch (niceTypeOf(value)) {
131
+ case "array": {
132
+ if (value[IS_COLLECTION]) return value;
133
+ const arr = value.map(deepFreeze);
134
+ arr[IS_FROZEN] = true;
135
+ return Object.freeze(arr);
136
+ }
137
+ case "null": return value;
138
+ case "object":
139
+ Object.keys(value).forEach((key) => {
140
+ try {
141
+ value[key] = deepFreeze(value[key]);
142
+ } catch {}
143
+ });
144
+ value[IS_FROZEN] = true;
145
+ return Object.freeze(value);
146
+ case "headers": return freezeHeaders(value);
147
+ case "Collection":
148
+ case "Store":
149
+ case "AbortSignal":
150
+ case "identifier": return value;
151
+ default: return value;
152
+ }
153
+ }
154
+ }
155
+ function isMaybeContext(request) {
156
+ if (request && typeof request === "object") {
157
+ const keys = Object.keys(request);
158
+ if (keys.length === 1 && keys[0] === "request") return true;
159
+ }
160
+ return false;
161
+ }
162
+ function niceTypeOf(v) {
163
+ if (v === null) return "null";
164
+ if (typeof v === "string") return v ? "non-empty-string" : "empty-string";
165
+ if (!v) return typeof v;
166
+ if (Array.isArray(v)) return "array";
167
+ if (v instanceof Date) return "date";
168
+ if (v instanceof Map) return "map";
169
+ if (v instanceof Set) return "set";
170
+ if (v instanceof Error) return "error";
171
+ if (v instanceof ReadableStream || v instanceof WritableStream || v instanceof TransformStream) return "stream";
172
+ if (v instanceof Headers) return "headers";
173
+ if (typeof v === "object" && CACHE_OWNER in v) return "identifier";
174
+ if (typeof v === "object" && v.constructor && v.constructor.name !== "Object") return v.constructor.name;
175
+ return typeof v;
176
+ }
177
+ function validateKey(key, value, errors) {
178
+ const schema = ValidKeys.get(key);
179
+ if (!schema && !IgnoredKeys.has(key)) {
180
+ errors.push(`InvalidKey: '${key}'`);
181
+ return;
182
+ }
183
+ if (schema) {
184
+ if (schema === BODY_TYPES) {
185
+ if (typeof value === "string" || value instanceof ReadableStream) return;
186
+ const type = niceTypeOf(value);
187
+ if (schema.klass.includes(type)) return;
188
+ errors.push(`InvalidValue: key 'body' should be a string or one of '${schema.klass.join("', '")}', received ${"<a value of type " + niceTypeOf(value) + ">"}`);
189
+ return;
190
+ }
191
+ if (Array.isArray(schema)) {
192
+ if (!schema.includes(value)) errors.push(`InvalidValue: key ${key} should be one of '${schema.join("', '")}', received ${typeof value === "string" ? value : "<a value of type " + niceTypeOf(value) + ">"}`);
193
+ return;
194
+ } else if (schema === "json") {
195
+ try {
196
+ JSON.stringify(value);
197
+ } catch (e) {
198
+ errors.push(`InvalidValue: key ${key} should be a JSON serializable value, but failed to serialize with Error - ${e.message}`);
199
+ }
200
+ return;
201
+ } else if (schema === "headers") {
202
+ if (!(value instanceof Headers)) errors.push(`InvalidValue: key ${key} should be an instance of Headers, received ${niceTypeOf(value)}`);
203
+ return;
204
+ } else if (schema === "record") {
205
+ if (!value || typeof value !== "object" || value.constructor && value.constructor !== Object) {
206
+ errors.push(`InvalidValue: key ${key} should be a dictionary of string keys to string values, received ${niceTypeOf(value)}`);
207
+ return;
208
+ }
209
+ Object.keys(value).forEach((k) => {
210
+ const v = value[k];
211
+ if (typeof k !== "string") errors.push(`\tThe key ${String(k)} on ${key} should be a string key`);
212
+ else if (typeof v !== "string") errors.push(`\tThe value of ${key}.${k} should be a string not ${niceTypeOf(v)}`);
213
+ });
214
+ return;
215
+ } else if (schema === "string") {
216
+ if (typeof value !== "string" || value.length === 0) errors.push(`InvalidValue: key ${key} should be a non-empty string, received ${typeof value === "string" ? "''" : typeof value}`);
217
+ return;
218
+ } else if (schema === "object") {
219
+ if (!value || Array.isArray(value) || typeof value !== "object") errors.push(`InvalidValue: key ${key} should be an object`);
220
+ return;
221
+ } else if (schema === "boolean") {
222
+ if (typeof value !== "boolean") errors.push(`InvalidValue: key ${key} should be a boolean, received ${typeof value}`);
223
+ return;
224
+ } else if (schema === "array") {
225
+ if (!Array.isArray(value)) errors.push(`InvalidValue: key ${key} should be an array, received ${typeof value}`);
226
+ return;
227
+ }
228
+ }
229
+ }
230
+ const IgnoredKeys = /* @__PURE__ */ new Set([]);
231
+ function assertValidRequest(request, isTopLevel) {
232
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
233
+ if (!request) throw new Error(`Expected ${isTopLevel ? "RequestManager.request" : "next"}(<request>) to be called with a request, but none was provided.`);
234
+ if (Array.isArray(request) || typeof request !== "object") throw new Error(`The \`request\` passed to \`${isTopLevel ? "RequestManager.request" : "next"}(<request>)\` should be an object, received \`${niceTypeOf(request)}\``);
235
+ if (Object.keys(request).length === 0) throw new Error(`The \`request\` passed to \`${isTopLevel ? "RequestManager.request" : "next"}(<request>)\` was empty (\`{}\`). Requests need at least one valid key.`);
236
+ if (request instanceof Context) throw new Error(`Expected a request passed to \`${isTopLevel ? "RequestManager.request" : "next"}(<request>)\` but received the previous handler's context instead`);
237
+ if (isMaybeContext(request)) throw new Error(`Expected a request passed to \`${isTopLevel ? "RequestManager.request" : "next"}(<request>)\` but received an object with a request key instead.`);
238
+ const keys = Object.keys(request);
239
+ const validationErrors = [];
240
+ const isLegacyRequest = Boolean("op" in request && !request.url);
241
+ keys.forEach((key) => {
242
+ if (isLegacyRequest && key === "data") return;
243
+ validateKey(key, request[key], validationErrors);
244
+ });
245
+ if (validationErrors.length) {
246
+ const error = /* @__PURE__ */ new Error(`Invalid Request passed to \`${isTopLevel ? "RequestManager.request" : "next"}(<request>)\`.\n\nThe following issues were found:\n\n\t${validationErrors.join("\n ")}`);
247
+ error.errors = validationErrors;
248
+ throw error;
249
+ }
250
+ }
251
+ }
252
+
253
+ //#endregion
254
+ //#region src/request/-private/context.ts
255
+ function upgradeHeaders(headers) {
256
+ headers.clone = () => {
257
+ return new Headers(headers);
258
+ };
259
+ headers.toJSON = () => {
260
+ return Array.from(headers);
261
+ };
262
+ return headers;
263
+ }
264
+ function cloneResponseProperties(response) {
265
+ const { headers, ok, redirected, status, statusText, type, url } = response;
266
+ upgradeHeaders(headers);
267
+ return {
268
+ headers,
269
+ ok,
270
+ redirected,
271
+ status,
272
+ statusText,
273
+ type,
274
+ url
275
+ };
276
+ }
277
+ var ContextOwner = class {
278
+ hasSetStream = false;
279
+ hasSetResponse = false;
280
+ hasSubscribers = false;
281
+ stream = createDeferred();
282
+ response = null;
283
+ nextCalled = 0;
284
+ constructor(request, god, isRoot = false) {
285
+ this.isRoot = isRoot;
286
+ this.requestId = god.id;
287
+ this.controller = request.controller || god.controller;
288
+ this.stream.promise.sizeHint = 0;
289
+ if (request.controller) {
290
+ if (request.controller !== god.controller) god.controller.signal.addEventListener("abort", () => {
291
+ this.controller.abort(god.controller.signal.reason);
292
+ });
293
+ delete request.controller;
294
+ }
295
+ let enhancedRequest = Object.assign({ signal: this.controller.signal }, request);
296
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
297
+ if (!request?.cacheOptions?.[SkipCache]) {
298
+ request = deepFreeze(request);
299
+ enhancedRequest = deepFreeze(enhancedRequest);
300
+ }
301
+ } else if (request.headers) upgradeHeaders(request.headers);
302
+ this.enhancedRequest = enhancedRequest;
303
+ this.request = request;
304
+ this.god = god;
305
+ this.stream.promise = this.stream.promise.then((stream) => {
306
+ if (this.god.stream === stream && this.hasSubscribers) this.god.stream = null;
307
+ return stream;
308
+ });
309
+ }
310
+ get hasRequestedStream() {
311
+ return this.god.hasRequestedStream;
312
+ }
313
+ getResponse() {
314
+ if (this.hasSetResponse) return this.response;
315
+ if (this.nextCalled === 1) return this.god.response;
316
+ return null;
317
+ }
318
+ getStream() {
319
+ if (this.isRoot) this.god.hasRequestedStream = true;
320
+ if (!this.hasSetResponse) {
321
+ const hint = this.god.response?.headers?.get("content-length");
322
+ this.stream.promise.sizeHint = hint ? parseInt(hint, 10) : 0;
323
+ }
324
+ this.hasSubscribers = true;
325
+ return this.stream.promise;
326
+ }
327
+ abort(reason) {
328
+ this.controller.abort(reason);
329
+ }
330
+ setStream(stream) {
331
+ if (!this.hasSetStream) {
332
+ this.hasSetStream = true;
333
+ if (!(stream instanceof Promise)) this.god.stream = stream;
334
+ this.stream.resolve(stream);
335
+ }
336
+ }
337
+ resolveStream() {
338
+ this.setStream(this.nextCalled === 1 ? this.god.stream : null);
339
+ }
340
+ setResponse(response) {
341
+ if (this.hasSetResponse) {
342
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) throw new Error(`Cannot setResponse when a response has already been set`);
343
+ return;
344
+ }
345
+ this.hasSetResponse = true;
346
+ if (response instanceof Response) {
347
+ let responseData = cloneResponseProperties(response);
348
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) responseData = deepFreeze(responseData);
349
+ this.response = responseData;
350
+ this.god.response = responseData;
351
+ const sizeHint = response.headers?.get("content-length");
352
+ this.stream.promise.sizeHint = sizeHint ? parseInt(sizeHint, 10) : 0;
353
+ } else {
354
+ this.response = response;
355
+ this.god.response = response;
356
+ }
357
+ }
358
+ };
359
+ /**
360
+ * The context object given to each {@link Handler} (or {@link CacheHandler})
361
+ * as it processes a request. It exposes the (immutable, enhanced) request
362
+ * along with the methods a handler uses to build up the {@link Future} and
363
+ * {@link StructuredDataDocument} that will ultimately be returned by the
364
+ * {@link RequestManager}.
365
+ *
366
+ * @public
367
+ */
368
+ var Context = class {
369
+ /** @internal */
370
+ /**
371
+ * A readonly, immutable version of the request being handled, including
372
+ * any defaults or enhancements applied by the {@link RequestManager}.
373
+ *
374
+ * @public
375
+ */
376
+ /**
377
+ * The id of this request as assigned by the {@link RequestManager}. Not
378
+ * unique across manager instances.
379
+ *
380
+ * @public
381
+ */
382
+ /** @internal */
383
+ /** @internal */
384
+ constructor(owner, isCacheHandler) {
385
+ this.id = owner.requestId;
386
+ this.___owner = owner;
387
+ this.request = owner.enhancedRequest;
388
+ this._isCacheHandler = isCacheHandler;
389
+ this._finalized = false;
390
+ }
391
+ /**
392
+ * Set the response stream for this request. May be called at most once,
393
+ * and may be called at any point up until the handler's `request` method
394
+ * resolves.
395
+ *
396
+ * @public
397
+ */
398
+ setStream(stream) {
399
+ this.___owner.setStream(stream);
400
+ }
401
+ /**
402
+ * Set the {@link ResponseInfo} (or raw `Response`) associated with this
403
+ * request. Used to populate the response information available on the
404
+ * resulting {@link StructuredDataDocument}.
405
+ *
406
+ * @public
407
+ */
408
+ setResponse(response) {
409
+ this.___owner.setResponse(response);
410
+ }
411
+ /**
412
+ * Associate a {@link RequestKey} with this request. May only be called
413
+ * synchronously from a {@link CacheHandler}.
414
+ *
415
+ * @public
416
+ */
417
+ setIdentifier(identifier) {
418
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) && ((test) => {
419
+ if (!test) throw new Error(`setIdentifier may only be used synchronously from a CacheHandler`);
420
+ })(identifier && this._isCacheHandler && !this._finalized);
421
+ this.___owner.god.identifier = identifier;
422
+ }
423
+ /**
424
+ * Whether the application (or a downstream handler) has requested access
425
+ * to the response stream via {@link Future.getStream}. Handlers can use
426
+ * this to avoid the cost of streaming when nothing will consume it.
427
+ *
428
+ * @public
429
+ */
430
+ get hasRequestedStream() {
431
+ return this.___owner.hasRequestedStream;
432
+ }
433
+ /** @private */
434
+ _finalize() {
435
+ this._finalized = true;
436
+ }
437
+ };
438
+
439
+ //#endregion
440
+ //#region src/request/-private/promise-cache.ts
441
+ /**
442
+ * The minimal, structural subset of the `Promise` interface required to be
443
+ * cached and inspected by {@link setPromiseResult} / {@link getPromiseResult}
444
+ * (and by `getPromiseState`). Anything that is at least `then`/`catch`/`finally`
445
+ * "shaped" (including a real `Promise` or {@link Future}) satisfies this.
446
+ *
447
+ * @public
448
+ */
449
+ const PromiseCache = getOrSetUniversal("PromiseCache", /* @__PURE__ */ new WeakMap());
450
+ const RequestMap = getOrSetUniversal("RequestMap", /* @__PURE__ */ new Map());
451
+ function setRequestResult(requestId, result) {
452
+ RequestMap.set(requestId, result);
453
+ }
454
+ function clearRequestResult(requestId) {
455
+ RequestMap.delete(requestId);
456
+ }
457
+ function getRequestResult(requestId) {
458
+ return RequestMap.get(requestId);
459
+ }
460
+ /**
461
+ * Cache the settled result (or error) of a promise-like value so that its
462
+ * outcome can be synchronously read later via {@link getPromiseResult},
463
+ * without needing to await it again.
464
+ *
465
+ * @public
466
+ */
467
+ function setPromiseResult(promise, result) {
468
+ PromiseCache.set(promise, result);
469
+ }
470
+ /**
471
+ * Synchronously read the settled result (or error) previously recorded for
472
+ * a promise-like value via {@link setPromiseResult}, if any.
473
+ *
474
+ * @public
475
+ */
476
+ function getPromiseResult(promise) {
477
+ return PromiseCache.get(promise);
478
+ }
479
+
480
+ //#endregion
481
+ //#region src/request/-private/utils.ts
482
+ const IS_CACHE_HANDLER = getOrSetGlobal("IS_CACHE_HANDLER", Symbol("IS_CACHE_HANDLER"));
483
+ /**
484
+ * A ponyfill for the global {@link DOMException} constructor.
485
+ *
486
+ * Some non-DOM environments (e.g. React Native, some Node/worker
487
+ * environments) don't provide `DOMException` as a global, which would
488
+ * otherwise throw a `ReferenceError` the first time any code referenced it
489
+ * (for instance when classifying an abort/network error). `DOMError` falls
490
+ * back to the global {@link Error} constructor in that case so callers can
491
+ * uniformly use `new DOMError(...)` / `error instanceof DOMError` without
492
+ * guarding for the global's presence themselves.
493
+ *
494
+ * @internal
495
+ */
496
+ const DOMError = typeof DOMException !== "undefined" ? DOMException : Error;
497
+ function curryFuture(owner, inbound, outbound) {
498
+ owner.setStream(inbound.getStream());
499
+ inbound.then((doc) => {
500
+ const document = {
501
+ [STRUCTURED]: true,
502
+ request: owner.request,
503
+ response: doc.response,
504
+ content: doc.content
505
+ };
506
+ outbound.resolve(document);
507
+ }, (error) => {
508
+ if (isDoc(error)) owner.setStream(owner.god.stream);
509
+ if (!error || !(error instanceof Error)) try {
510
+ throw new Error(error ? error : `Request Rejected with an Unknown Error`);
511
+ } catch (e) {
512
+ if (error && typeof error === "object") {
513
+ Object.assign(e, error);
514
+ e.message = error.message || `Request Rejected with an Unknown Error`;
515
+ }
516
+ error = e;
517
+ }
518
+ error[STRUCTURED] = true;
519
+ error.request = owner.request;
520
+ error.response = owner.getResponse();
521
+ error.error = error.error || error.message;
522
+ outbound.reject(error);
523
+ });
524
+ return outbound.promise;
525
+ }
526
+ function isDoc(doc) {
527
+ return doc && doc[STRUCTURED] === true;
528
+ }
529
+ function ensureDoc(owner, content, isError) {
530
+ if (isDoc(content)) return content;
531
+ if (isError) return {
532
+ [STRUCTURED]: true,
533
+ request: owner.request,
534
+ response: owner.getResponse(),
535
+ error: content
536
+ };
537
+ return {
538
+ [STRUCTURED]: true,
539
+ request: owner.request,
540
+ response: owner.getResponse(),
541
+ content
542
+ };
543
+ }
544
+ /**
545
+ * Additional properties exposed on errors thrown by the
546
+ * {@link Fetch | Fetch Handler}.
547
+ *
548
+ * In the case of an Abort or system/browser level issue,
549
+ * this extends {@link DOMException}.
550
+ *
551
+ * Else it extends from {@link AggregateError} if the
552
+ * response includes an array of errors, falling back
553
+ * to {@link Error} as its base.
554
+ */
555
+ function enhanceReason(reason) {
556
+ const error = new DOMError(reason || "The user aborted a request.", "AbortError");
557
+ if (error.name !== "AbortError") error.name = "AbortError";
558
+ return error;
559
+ }
560
+ function handleOutcome(owner, inbound, outbound) {
561
+ inbound.then((content) => {
562
+ if (owner.controller.signal.aborted) {
563
+ outbound.reject(enhanceReason(owner.controller.signal.reason));
564
+ return;
565
+ }
566
+ if (isDoc(content)) {
567
+ owner.setStream(owner.god.stream);
568
+ content = content.content;
569
+ }
570
+ const document = {
571
+ [STRUCTURED]: true,
572
+ request: owner.request,
573
+ response: owner.getResponse(),
574
+ content
575
+ };
576
+ outbound.resolve(document);
577
+ }, (error) => {
578
+ if (isDoc(error)) owner.setStream(owner.god.stream);
579
+ if (!error || !(error instanceof Error)) try {
580
+ throw new Error(error ? error : `Request Rejected with an Unknown Error`);
581
+ } catch (e) {
582
+ if (error && typeof error === "object") {
583
+ Object.assign(e, error);
584
+ e.message = error.message || `Request Rejected with an Unknown Error`;
585
+ }
586
+ error = e;
587
+ }
588
+ error[STRUCTURED] = true;
589
+ error.request = owner.request;
590
+ error.response = owner.getResponse();
591
+ error.error = error.error || error.message;
592
+ outbound.reject(error);
593
+ });
594
+ return outbound.promise;
595
+ }
596
+ function isCacheHandler(handler, index) {
597
+ return index === 0 && Boolean(handler[IS_CACHE_HANDLER]);
598
+ }
599
+ function executeNextHandler(wares, request, i, god) {
600
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
601
+ if (i === wares.length) throw new Error(`No handler was able to handle this request.`);
602
+ assertValidRequest(request, false);
603
+ }
604
+ const owner = new ContextOwner(request, god, i === 0);
605
+ function next(r) {
606
+ owner.nextCalled++;
607
+ return executeNextHandler(wares, r, i + 1, god);
608
+ }
609
+ const _isCacheHandler = isCacheHandler(wares[i], i);
610
+ const context = new Context(owner, _isCacheHandler);
611
+ let outcome;
612
+ try {
613
+ outcome = wares[i].request(context, next);
614
+ if (_isCacheHandler) context._finalize();
615
+ if (!!outcome && _isCacheHandler) {
616
+ if (!(outcome instanceof Promise)) {
617
+ setRequestResult(owner.requestId, {
618
+ isError: false,
619
+ result: ensureDoc(owner, outcome, false)
620
+ });
621
+ outcome = Promise.resolve(outcome);
622
+ }
623
+ } else if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
624
+ if (!outcome || !(outcome instanceof Promise) && !(typeof outcome === "object" && "then" in outcome)) {
625
+ console.log({
626
+ request,
627
+ handler: wares[i],
628
+ outcome
629
+ });
630
+ if (outcome === void 0) throw new Error(`Expected handler.request to return a promise, instead received undefined.`);
631
+ throw new Error(`Expected handler.request to return a promise, instead received a synchronous value.`);
632
+ }
633
+ }
634
+ } catch (e) {
635
+ if (_isCacheHandler) setRequestResult(owner.requestId, {
636
+ isError: true,
637
+ result: ensureDoc(owner, e, true)
638
+ });
639
+ outcome = Promise.reject(e);
640
+ }
641
+ const future = createFuture(owner);
642
+ if (isFuture(outcome)) return curryFuture(owner, outcome, future);
643
+ return handleOutcome(owner, outcome, future);
644
+ }
645
+
646
+ //#endregion
647
+ //#region src/request/-private/future.ts
648
+ function isFuture(maybe) {
649
+ return Boolean(maybe && maybe instanceof Promise && maybe[IS_FUTURE] === true);
650
+ }
651
+ /**
652
+ * Create a {@link Deferred}: a promise along with the `resolve`/`reject`
653
+ * callbacks that settle it, so the promise can be handed out before the
654
+ * work that will settle it has started.
655
+ *
656
+ * @public
657
+ */
658
+ function createDeferred() {
659
+ let resolve;
660
+ let reject;
661
+ const promise = new Promise((res, rej) => {
662
+ resolve = res;
663
+ reject = rej;
664
+ });
665
+ return {
666
+ resolve,
667
+ reject,
668
+ promise
669
+ };
670
+ }
671
+ function upgradePromise(promise, future) {
672
+ promise[IS_FUTURE] = true;
673
+ promise.getStream = future.getStream;
674
+ promise.abort = future.abort;
675
+ promise.onFinalize = future.onFinalize;
676
+ promise.id = future.id;
677
+ promise.lid = future.lid;
678
+ promise.requester = future.requester;
679
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) promise.toJSON = () => {
680
+ const id = "Future<" + promise.id + ">";
681
+ if (promise.lid) return `${id} (${promise.lid.lid})`;
682
+ return id;
683
+ };
684
+ return promise;
685
+ }
686
+ function createFuture(owner) {
687
+ const deferred = createDeferred();
688
+ let { promise } = deferred;
689
+ let cbs;
690
+ promise = promise.finally(() => {
691
+ owner.resolveStream();
692
+ if (cbs) cbs.forEach((cb) => cb());
693
+ });
694
+ promise.onFinalize = (fn) => {
695
+ cbs = cbs || [];
696
+ cbs.push(fn);
697
+ };
698
+ promise[IS_FUTURE] = true;
699
+ promise.getStream = () => {
700
+ return owner.getStream();
701
+ };
702
+ promise.abort = (reason) => {
703
+ owner.abort(enhanceReason(reason));
704
+ };
705
+ promise.id = owner.requestId;
706
+ promise.lid = owner.god.identifier;
707
+ promise.requester = owner.god.requester;
708
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) promise.toJSON = () => {
709
+ const id = "Future<" + promise.id + ">";
710
+ if (promise.lid) return `${id} (${promise.lid.lid})`;
711
+ return id;
712
+ };
713
+ deferred.promise = promise;
714
+ return deferred;
715
+ }
716
+
717
+ //#endregion
718
+ //#region src/request.ts
719
+ /**
720
+ * Brands the supplied object with the supplied response type.
721
+ *
722
+ * ```ts
723
+ * import type { ReactiveDataDocument } from '@warp-drive/core/reactive';
724
+ * import { withResponseType } from '@warp-drive/core/request';
725
+ * import type { User } from '#/data/user.ts'
726
+ *
727
+ * const result = await store.request(
728
+ * withResponseType<ReactiveDataDocument<User>>({ url: '/users/1' })
729
+ * );
730
+ *
731
+ * result.content.data; // will have type User
732
+ * ```
733
+ *
734
+ */
735
+ function withResponseType(obj) {
736
+ return obj;
737
+ }
738
+ /**
739
+ * Brands the supplied object with the supplied response type
740
+ * wrapped in {@link ReactiveDataDocument}. This is a convenience for
741
+ * the common case of using {@link withResponseType} with `ReactiveDataDocument`.
742
+ *
743
+ * ```ts
744
+ * import { withReactiveResponse } from '@warp-drive/core/request';
745
+ * import type { User } from '#/data/user.ts'
746
+ *
747
+ * const result = await store.request(
748
+ * withReactiveResponse<User>({ url: '/users/1' })
749
+ * );
750
+ *
751
+ * result.content.data; // will have type User
752
+ * ```
753
+ *
754
+ * @public
755
+ */
756
+ function withReactiveResponse(obj) {
757
+ return obj;
758
+ }
759
+ /**
760
+ * @deprecated use {@link withResponseType} instead
761
+ */
762
+ const withBrand = withResponseType;
763
+
764
+ //#endregion
765
+ export { upgradePromise as a, executeNextHandler as c, getRequestResult as d, setPromiseResult as f, createDeferred as i, clearRequestResult as l, assertValidRequest as m, withReactiveResponse as n, DOMError as o, cloneResponseProperties as p, withResponseType as r, IS_CACHE_HANDLER as s, withBrand as t, getPromiseResult as u };
766
+ //# sourceMappingURL=request--vRFALbQ.js.map