@warp-drive-mirror/core 5.9.0-alpha.2 → 5.9.0-alpha.21

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-WybCP5W2.d.ts +41 -0
  11. package/declarations/change-WybCP5W2.d.ts.map +1 -0
  12. package/declarations/concepts-CFfLCQr6.d.ts +77 -0
  13. package/declarations/concepts-CFfLCQr6.d.ts.map +1 -0
  14. package/declarations/configure-DI1HqQpX.d.ts +164 -0
  15. package/declarations/configure-DI1HqQpX.d.ts.map +1 -0
  16. package/declarations/configure.d.ts +2 -7
  17. package/declarations/document-CRPmGrsO.d.ts +129 -0
  18. package/declarations/document-CRPmGrsO.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-Di3nFhg0.d.ts +186 -0
  25. package/declarations/graph-Di3nFhg0.d.ts.map +1 -0
  26. package/declarations/identifier-DyEvjMjb.d.ts +120 -0
  27. package/declarations/identifier-DyEvjMjb.d.ts.map +1 -0
  28. package/declarations/index.d.ts +2 -96
  29. package/declarations/internal-DMxLqCZa.d.ts +9389 -0
  30. package/declarations/internal-DMxLqCZa.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-al42_Yzp.d.ts +165 -0
  34. package/declarations/mutations-al42_Yzp.d.ts.map +1 -0
  35. package/declarations/operations-Do63dgrL.d.ts +244 -0
  36. package/declarations/operations-Do63dgrL.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-DCFv3y1J.d.ts +258 -0
  44. package/declarations/record-DCFv3y1J.d.ts.map +1 -0
  45. package/declarations/relationship-CT9mFtav.d.ts +65 -0
  46. package/declarations/relationship-CT9mFtav.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 +10363 -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 -371
  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-D4dQm2VC.js +22 -0
  86. package/dist/-private-D4dQm2VC.js.map +1 -0
  87. package/dist/-private-DDz7mWBO.js +1725 -0
  88. package/dist/-private-DDz7mWBO.js.map +1 -0
  89. package/dist/-private-DYCb3vir.js +120 -0
  90. package/dist/-private-DYCb3vir.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-CclbTH_w.js +766 -0
  105. package/dist/request-CclbTH_w.js.map +1 -0
  106. package/dist/request.js +2 -48
  107. package/dist/signals/-leaked.js +3 -1
  108. package/dist/src-DgZnLlik.js +9090 -0
  109. package/dist/src-DgZnLlik.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-9CIgW-DA.js +111 -0
  130. package/dist/unpkg/dev/-private-9CIgW-DA.js.map +1 -0
  131. package/dist/unpkg/dev/-private-B2Am6Oqc.js +22 -0
  132. package/dist/unpkg/dev/-private-B2Am6Oqc.js.map +1 -0
  133. package/dist/unpkg/dev/-private-C1QTxlMX.js +1714 -0
  134. package/dist/unpkg/dev/-private-C1QTxlMX.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-4Qkr-Uqq.js +756 -0
  149. package/dist/unpkg/dev/request-4Qkr-Uqq.js.map +1 -0
  150. package/dist/unpkg/dev/request.js +2 -48
  151. package/dist/unpkg/dev/runtime-DCk-f6iq.js +110 -0
  152. package/dist/unpkg/dev/runtime-DCk-f6iq.js.map +1 -0
  153. package/dist/unpkg/dev/signals/-leaked.js +3 -1
  154. package/dist/unpkg/dev/src-Dq17geGK.js +8194 -0
  155. package/dist/unpkg/dev/src-Dq17geGK.js.map +1 -0
  156. package/dist/unpkg/dev/store/-private.js +3 -55
  157. package/dist/unpkg/dev/store-1Jt0pxEL.js +427 -0
  158. package/dist/unpkg/dev/store-1Jt0pxEL.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-9CIgW-DA.js +111 -0
  178. package/dist/unpkg/dev-deprecated/-private-9CIgW-DA.js.map +1 -0
  179. package/dist/unpkg/dev-deprecated/-private-B2Am6Oqc.js +22 -0
  180. package/dist/unpkg/dev-deprecated/-private-B2Am6Oqc.js.map +1 -0
  181. package/dist/unpkg/dev-deprecated/-private-C1QTxlMX.js +1714 -0
  182. package/dist/unpkg/dev-deprecated/-private-C1QTxlMX.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-4Qkr-Uqq.js +756 -0
  197. package/dist/unpkg/dev-deprecated/request-4Qkr-Uqq.js.map +1 -0
  198. package/dist/unpkg/dev-deprecated/request.js +2 -48
  199. package/dist/unpkg/dev-deprecated/runtime-BmPBYlvC.js +110 -0
  200. package/dist/unpkg/dev-deprecated/runtime-BmPBYlvC.js.map +1 -0
  201. package/dist/unpkg/dev-deprecated/signals/-leaked.js +3 -1
  202. package/dist/unpkg/dev-deprecated/src-n5P9tTX4.js +8747 -0
  203. package/dist/unpkg/dev-deprecated/src-n5P9tTX4.js.map +1 -0
  204. package/dist/unpkg/dev-deprecated/store/-private.js +3 -1
  205. package/dist/unpkg/dev-deprecated/store-GrkCubY2.js +427 -0
  206. package/dist/unpkg/dev-deprecated/store-GrkCubY2.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-B2hz13Ei.js +22 -0
  226. package/dist/unpkg/prod/-private-B2hz13Ei.js.map +1 -0
  227. package/dist/unpkg/prod/-private-CFXr06QP.js +1524 -0
  228. package/dist/unpkg/prod/-private-CFXr06QP.js.map +1 -0
  229. package/dist/unpkg/prod/-private-o67f3_hS.js +99 -0
  230. package/dist/unpkg/prod/-private-o67f3_hS.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-xXJYO0jK.js +480 -0
  245. package/dist/unpkg/prod/request-xXJYO0jK.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-BXphJ7nX.js +6801 -0
  249. package/dist/unpkg/prod/src-BXphJ7nX.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-B2hz13Ei.js +22 -0
  272. package/dist/unpkg/prod-deprecated/-private-B2hz13Ei.js.map +1 -0
  273. package/dist/unpkg/prod-deprecated/-private-CFXr06QP.js +1524 -0
  274. package/dist/unpkg/prod-deprecated/-private-CFXr06QP.js.map +1 -0
  275. package/dist/unpkg/prod-deprecated/-private-o67f3_hS.js +99 -0
  276. package/dist/unpkg/prod-deprecated/-private-o67f3_hS.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-xXJYO0jK.js +480 -0
  291. package/dist/unpkg/prod-deprecated/request-xXJYO0jK.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-Bzk95Vdj.js +7234 -0
  295. package/dist/unpkg/prod-deprecated/src-Bzk95Vdj.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-BlQ9ebNX.js +0 -1940
  410. package/dist/default-cache-policy-D7_u4YRH.js +0 -572
  411. package/dist/future-CPfkKOvf.js +0 -678
  412. package/dist/index-D4jKuR0r.js +0 -10000
  413. package/dist/symbols-3C1OkYtZ.js +0 -39
  414. package/dist/unpkg/dev/-leaked-BYj8zMi0.js +0 -1939
  415. package/dist/unpkg/dev/-private-sql1_mdx.js +0 -39
  416. package/dist/unpkg/dev/future-DUuPqyLj.js +0 -672
  417. package/dist/unpkg/dev/index-BrSRAfLa.js +0 -9410
  418. package/dist/unpkg/dev/runtime-DGG4CvlW.js +0 -135
  419. package/dist/unpkg/dev-deprecated/-leaked-D0KHC8Qz.js +0 -1939
  420. package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +0 -39
  421. package/dist/unpkg/dev-deprecated/future-DUuPqyLj.js +0 -672
  422. package/dist/unpkg/dev-deprecated/index-RnWJEamT.js +0 -10025
  423. package/dist/unpkg/dev-deprecated/runtime-DfhJzpZH.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-DeouKoRZ.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-DlxmDxns.js +0 -5237
  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-BVKoq9bM.js +0 -334
  433. package/dist/unpkg/prod-deprecated/hooks-CfCFjO7d.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-_W00LRDb.js +0 -6957
@@ -0,0 +1,1714 @@
1
+ import { a as setTransient, r as peekTransient, t as getOrSetGlobal } from "./-private-9CIgW-DA.js";
2
+ import { f as setPromiseResult, o as DOMError, u as getPromiseResult } from "./request-4Qkr-Uqq.js";
3
+
4
+ //#region src/signals/reactivity/configure.ts
5
+ const ARRAY_SIGNAL = getOrSetGlobal("#[]", Symbol("#[]"));
6
+ const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
7
+ /**
8
+ * Requirements:
9
+ *
10
+ * Signal:
11
+ *
12
+ * - signal: a way of creating a reference that we can dirty when we desire to notify
13
+ * - @signal: a way of creating an accessor on an object that subscribes to a signal on access
14
+ * and notifies the signal on set, or of upgrading a descriptor to be such an accessor
15
+ * - defineSignal: a way of creating a signal on an object
16
+ * - notifySignal: a way of notifying the underlying signal that it has been dirtied
17
+ * - peekSignal: a way of inspecting the signal without notifying it
18
+ *
19
+ * - gate: a memoized getter function that re-runs when on access if its signal is dirty
20
+ * conceptually, a gate is a tightly coupled signal and memo
21
+ * - @gate: a way of creating a gate on an object or upgrading a descriptor with a getter
22
+ * to be a gate
23
+ * - defineGate: a way of creating a gate on an object
24
+ * - notifySignal: a way of notifying the signal for a gate that it has been dirtied
25
+ *
26
+ * - memo:
27
+ * - @memo: a way of creating a memoized getter on an object or upgrading a descriptor with a getter
28
+ * to be a memo
29
+ * - defineMemo: a way of creating a memo on an object
30
+ *
31
+ * - signalStore: storage bucket for signals associated to an object
32
+ * - withSignalStore: a way of pre-creating a signal store on an object
33
+ *
34
+ *
35
+ * @internal
36
+ */
37
+ /**
38
+ * An Opaque type that represents a framework specific or TC39 signal.
39
+ *
40
+ * It may be an array of signals or a single signal.
41
+ *
42
+ * @private
43
+ */
44
+ /**
45
+ * The hooks which MUST be configured in order to use reactive arrays,
46
+ * resources and documents with framework specfic signals or TC39 signals.
47
+ *
48
+ * Support for multiple frameworks simultaneously can be done via
49
+ * this abstraction by returning multiple signals from the `createSignal`
50
+ * method, and consuming the correct one via the correct framework via
51
+ * the `consumeSignal` and `notifySignal` methods.
52
+ *
53
+ * Unlike many signals implementations, WarpDrive does not wrap values as
54
+ * signals directly, but instead uses signals to alert the reactive layer
55
+ * to changes in the underlying cache. E.g. a signal is associated to a value,
56
+ * but does not serve as the cache for that value directly. We refer to this as
57
+ * a "gate", the pattern has also been called "side-signals".
58
+ *
59
+ * A no-op implementation is allowed, though it may lead to performance issues
60
+ * in locations that use createMemo as no memoization would be done. This is
61
+ * typically desirable only when integrating with a framework that does its own
62
+ * memoization and does not integrate with any signals-like primitive. For these
63
+ * scenarios you may also be interested in integrating with the {@link NotificationManager}
64
+ * more directly.
65
+ *
66
+ * @public
67
+ */
68
+ /**
69
+ * Contains information a {@link SignalHooks} implementation may want
70
+ * to use, such as the specialized key used for the signal
71
+ * representing an array's contents / length.
72
+ *
73
+ * ```ts
74
+ * interface HooksOptions {
75
+ * wellknown: {
76
+ * Array: symbol | string;
77
+ * }
78
+ * }
79
+ * ```
80
+ *
81
+ * @public
82
+ */
83
+ /**
84
+ * Configures the signals implementation to use. Supports multiple
85
+ * implementations simultaneously.
86
+ *
87
+ * See {@link HooksOptions} for the options passed to the provided function
88
+ * when called.
89
+ *
90
+ * See {@link SignalHooks} for the implementation the callback function should
91
+ * return.
92
+ *
93
+ * @public
94
+ * @param buildConfig - a function that takes options and returns a configuration object
95
+ */
96
+ function setupSignals(buildConfig) {
97
+ const hooks = buildConfig({ wellknown: { Array: ARRAY_SIGNAL } });
98
+ setTransient("signalHooks", hooks);
99
+ }
100
+ /**
101
+ * Internal method for consuming the configured `createSignal` hook
102
+ *
103
+ * @private
104
+ */
105
+ function createSignal(obj, key) {
106
+ const signalHooks = peekTransient("signalHooks");
107
+ ((test) => {
108
+ if (!test) throw new Error(`Signal hooks not configured`);
109
+ })(signalHooks);
110
+ return signalHooks.createSignal(obj, key);
111
+ }
112
+ /**
113
+ * Internal method for consuming the configured `consumeSignal` hook
114
+ *
115
+ * @private
116
+ */
117
+ function consumeSignal(signal) {
118
+ const signalHooks = peekTransient("signalHooks");
119
+ ((test) => {
120
+ if (!test) throw new Error(`Signal hooks not configured`);
121
+ })(signalHooks);
122
+ return signalHooks.consumeSignal(signal);
123
+ }
124
+ /**
125
+ * Internal method for consuming the configured `notifySignal` hook
126
+ *
127
+ * @private
128
+ */
129
+ function notifySignal(signal) {
130
+ const signalHooks = peekTransient("signalHooks");
131
+ ((test) => {
132
+ if (!test) throw new Error(`Signal hooks not configured`);
133
+ })(signalHooks);
134
+ return signalHooks.notifySignal(signal);
135
+ }
136
+ function createMemo(object, key, fn) {
137
+ const signalHooks = peekTransient("signalHooks");
138
+ ((test) => {
139
+ if (!test) throw new Error(`Signal hooks not configured`);
140
+ })(signalHooks);
141
+ return signalHooks.createMemo(object, key, fn);
142
+ }
143
+ function willSyncFlushWatchers() {
144
+ const signalHooks = peekTransient("signalHooks");
145
+ ((test) => {
146
+ if (!test) throw new Error(`Signal hooks not configured`);
147
+ })(signalHooks);
148
+ return signalHooks.willSyncFlushWatchers();
149
+ }
150
+ /**
151
+ * Wraps `promise` using the configured {@link SignalHooks.waitFor}, if any,
152
+ * for things like test-waiters. Returns `promise` unchanged if no
153
+ * `waitFor` hook is configured.
154
+ */
155
+ function waitFor(promise) {
156
+ const signalHooks = peekTransient("signalHooks");
157
+ if (signalHooks?.waitFor) return signalHooks.waitFor(promise);
158
+ return promise;
159
+ }
160
+
161
+ //#endregion
162
+ //#region src/signals/reactivity/internal.ts
163
+ const INITIALIZER_PROTO = { isInitializer: true };
164
+ /**
165
+ * Wraps `fn` so that a signal can recognize it as a lazy initializer
166
+ * for its value rather than the value itself, deferring the call to
167
+ * `fn` until the signal is first accessed.
168
+ */
169
+ function makeInitializer(fn) {
170
+ return Object.assign(Object.create(INITIALIZER_PROTO), { value: fn });
171
+ }
172
+ function isInitializer(obj) {
173
+ return typeof obj === "object" && obj !== null && Object.getPrototypeOf(obj) === INITIALIZER_PROTO;
174
+ }
175
+ /**
176
+ * A WarpDriveSignal is a wrapper around a framework specific or TC39 signal
177
+ * that enables us to store and manage the signal in a universal way.
178
+ *
179
+ * WarpDrive uses signals to manage three separate concepts:
180
+ *
181
+ * - as a `storage` for a value local to the object that we want to be reactive
182
+ * (see `@local` schema field for an example)
183
+ * - as a `gate` for a memoized getter that we want to act as a reactive property
184
+ * but whose value is computed/pulled from a non-reactive source elsewhere
185
+ * and whose latest value is stored in the signal
186
+ * (see `field` schema field for an example)
187
+ * - as a `gate` with a manually managed value updated on pull when `isStale` is true
188
+ *
189
+ *
190
+ * It offers
191
+ *
192
+ * - a non-reactive way to access/update the current value
193
+ * - a non-reactive way to mark the signal as dirtied
194
+ * - a non-reactive way to store content for why the signal was dirtied
195
+ * - access to the underlying Signal(s) in-use
196
+ *
197
+ * For debugging:
198
+ * - the "key" or "name" of the signal
199
+ * - the "object identity" or "context" to which the signal is attached
200
+ *
201
+ * @private
202
+ */
203
+ /**
204
+ * We attach signals to their context object via
205
+ * a Map attached to the object via this symbol.
206
+ *
207
+ * This allows us to store multiple signals
208
+ * on the same object with smaller memory
209
+ * overhead and no WeakMap lookups.
210
+ *
211
+ * Performance sensitive objects should
212
+ * pre-warm their shape by assigning this
213
+ * during initialization.
214
+ *
215
+ * ```ts
216
+ * initializeSignalStore(obj);
217
+ * ```
218
+ *
219
+ * @private
220
+ */
221
+ const Signals = getOrSetGlobal("Signals", Symbol("Signals"));
222
+ /**
223
+ * A type util to recast the object as having a signal store.
224
+ *
225
+ * @private
226
+ */
227
+ function upgradeWithSignals(obj) {}
228
+ /**
229
+ * A util that will create a signal store on the object
230
+ * if it does not already exist and returns the associated
231
+ * signal store.
232
+ *
233
+ * @private
234
+ */
235
+ function withSignalStore(obj) {
236
+ /* @__PURE__ */ upgradeWithSignals(obj);
237
+ if (!obj[Signals]) initializeSignalStore(obj);
238
+ return obj[Signals];
239
+ }
240
+ /**
241
+ * A util that will create a signal store on the object
242
+ * if it does not already exist.
243
+ *
244
+ * Useful for pre-warming the shape of an object to ensure
245
+ * a key-transition to add it is not required later.
246
+ *
247
+ * @private
248
+ */
249
+ function initializeSignalStore(obj) {
250
+ /* @__PURE__ */ upgradeWithSignals(obj);
251
+ ((test) => {
252
+ if (!test) throw new Error(`Signal store already exists on object`);
253
+ })(!obj[Signals]);
254
+ obj[Signals] = /* @__PURE__ */ new Map();
255
+ }
256
+ function createInternalSignal(signals, obj, key, initialValue) {
257
+ const warpDriveSignal = {
258
+ key,
259
+ context: obj,
260
+ signal: createSignal(obj, key),
261
+ value: isInitializer(initialValue) ? initialValue.value.call(obj) : initialValue,
262
+ isStale: false
263
+ };
264
+ signals.set(key, warpDriveSignal);
265
+ return warpDriveSignal;
266
+ }
267
+ function getOrCreateInternalSignal(signals, obj, key, initialValue) {
268
+ let signal = peekInternalSignal(signals, key);
269
+ if (!signal) signal = createInternalSignal(signals, obj, key, initialValue);
270
+ return signal;
271
+ }
272
+ function createInternalMemo(signals, object, key, fn) {
273
+ ((test) => {
274
+ if (!test) throw new Error(`Expected no signal/memo to exist for key "${String(key)}"`);
275
+ })(!peekInternalSignal(signals, key));
276
+ return withFrame(signals, object, key, fn);
277
+ }
278
+ /**
279
+ * Looks up the {@link WarpDriveSignal} stored for `key` in `signals`,
280
+ * if one has already been created, without creating or consuming it.
281
+ */
282
+ function peekInternalSignal(signals, key) {
283
+ return signals?.get(key);
284
+ }
285
+ function consumeInternalSignal(signal) {
286
+ TrackingFrame?.signals.add(signal);
287
+ consumeSignal(signal.signal);
288
+ }
289
+ /**
290
+ * Marks `signal` as stale and notifies its underlying framework/TC39
291
+ * signal, scheduling any of its consumers for re-render/re-computation.
292
+ */
293
+ function notifyInternalSignal(signal) {
294
+ if (signal) {
295
+ signal.isStale = true;
296
+ notifySignal(signal.signal);
297
+ }
298
+ }
299
+ let TrackingFrame = null;
300
+ /**
301
+ * This is currently just for signals debugging, but it could be used in production
302
+ * if we wanted to eliminate the need for frameworks to implement createMemo / to
303
+ * allow us to add our own Watcher.
304
+ *
305
+ * @internal
306
+ */
307
+ function withFrame(signals, object, key, fn) {
308
+ const frameSignals = /* @__PURE__ */ new Set();
309
+ const frameFn = () => {
310
+ if (frameSignals.size) frameSignals.clear();
311
+ TrackingFrame = {
312
+ object,
313
+ key,
314
+ signals: frameSignals,
315
+ parent: TrackingFrame
316
+ };
317
+ try {
318
+ return fn();
319
+ } finally {
320
+ TrackingFrame = TrackingFrame.parent;
321
+ }
322
+ };
323
+ const memo = createMemo(object, key, frameFn);
324
+ memo.signals = frameSignals;
325
+ signals.set(key, memo);
326
+ return memo;
327
+ }
328
+ function isMemo(obj) {
329
+ return typeof obj === "function" && obj.signals instanceof Set;
330
+ }
331
+ globalThis.debugWarpDriveSignals = (obj, key) => {
332
+ /* @__PURE__ */ upgradeWithSignals(obj);
333
+ const signals = obj[Signals];
334
+ if (!signals) {
335
+ log("The object has no associated signals");
336
+ return false;
337
+ }
338
+ if (key) {
339
+ const signal = signals.get(key);
340
+ if (!signal) {
341
+ log(`No signal found for key "${String(key)}"`);
342
+ return false;
343
+ }
344
+ log(signal);
345
+ if (isMemo(signal)) {
346
+ colorizeLines(printMemo(signal, key));
347
+ return true;
348
+ } else {
349
+ colorizeLines(printSignal(signal, key));
350
+ return true;
351
+ }
352
+ }
353
+ const lines = [];
354
+ for (const [k, signal] of signals) {
355
+ if (isMemo(signal)) continue;
356
+ printSignal(signal, k, lines);
357
+ }
358
+ for (const [k, signal] of signals) if (isMemo(signal)) printMemo(signal, k, lines);
359
+ log(signals);
360
+ colorizeLines(lines);
361
+ return true;
362
+ };
363
+ const LightColors = {
364
+ red: "color: red;",
365
+ green: "color: green;",
366
+ reset: "color: inherit;"
367
+ };
368
+ const DarkColors = {
369
+ red: "color: red;",
370
+ green: "color: lightgreen;",
371
+ reset: "color: inherit;"
372
+ };
373
+ function isLightMode() {
374
+ if (window?.matchMedia?.("(prefers-color-scheme: light)").matches) return true;
375
+ return false;
376
+ }
377
+ const RED = {};
378
+ const GREEN = {};
379
+ const RESET = {};
380
+ const EOL = {};
381
+ function colorizeLines(lines) {
382
+ const Colors = isLightMode() ? LightColors : DarkColors;
383
+ const colors = [];
384
+ let line = "";
385
+ for (const str of lines) if (str === RED) {
386
+ colors.push(Colors.red);
387
+ line += "%c";
388
+ } else if (str === GREEN) {
389
+ colors.push(Colors.green);
390
+ line += "%c";
391
+ } else if (str === RESET) {
392
+ colors.push(Colors.reset);
393
+ line += "%c";
394
+ } else if (str === EOL) line += "\n";
395
+ else line += str;
396
+ log(line, ...colors);
397
+ }
398
+ function log(...args) {
399
+ console.log(...args);
400
+ }
401
+ function isDirty(signal) {
402
+ return signal.isStale;
403
+ }
404
+ function isDirtyMemo(memo) {
405
+ for (const signal of memo.signals) {
406
+ if (isMemo(signal)) continue;
407
+ if (isDirty(signal)) return true;
408
+ }
409
+ for (const signal of memo.signals) if (isMemo(signal)) return isDirtyMemo(signal);
410
+ return false;
411
+ }
412
+ function printSignal(signal, key, lines = [], depth = 0) {
413
+ const _dirty = isDirty(signal);
414
+ lines.push(`${"".padStart(depth * 2, " ")}${_dirty ? "❌" : "✅"} `, _dirty ? RED : GREEN, `${String(key)}`, RESET, EOL);
415
+ return lines;
416
+ }
417
+ function printMemo(memo, key, lines = [], depth = 0) {
418
+ const _dirty = isDirtyMemo(memo);
419
+ lines.push(`${"".padStart(depth * 2, " ")}${_dirty ? "❌" : "✅"} `, _dirty ? RED : GREEN, `<memo> ${String(key)}`, RESET, `: (consumes ${memo.signals.size} signals)`, EOL);
420
+ for (const signal of memo.signals) {
421
+ if (isMemo(signal)) continue;
422
+ printSignal(signal, signal.key, lines, depth + 1);
423
+ }
424
+ for (const signal of memo.signals) if (isMemo(signal)) printMemo(signal, signal.key, lines, depth + 1);
425
+ return lines;
426
+ }
427
+
428
+ //#endregion
429
+ //#region src/signals/reactivity/signal.ts
430
+ /**
431
+ * Creates a signal for the key/object pairing and subscribes to the signal.
432
+ *
433
+ * Use when you need to ensure a signal exists and is subscribed to.
434
+ *
435
+ * @private
436
+ */
437
+ function entangleSignal(signals, obj, key, initialValue) {
438
+ let internalSignal = peekInternalSignal(signals, key);
439
+ if (!internalSignal) internalSignal = createInternalSignal(signals, obj, key, initialValue);
440
+ consumeInternalSignal(internalSignal);
441
+ return internalSignal;
442
+ }
443
+ function entangleInitiallyStaleSignal(signals, obj, key, initialValue) {
444
+ let internalSignal = peekInternalSignal(signals, key);
445
+ if (!internalSignal) {
446
+ internalSignal = createInternalSignal(signals, obj, key, initialValue);
447
+ internalSignal.isStale = true;
448
+ }
449
+ consumeInternalSignal(internalSignal);
450
+ return internalSignal;
451
+ }
452
+ function createSignalDescriptor(key, intialValue) {
453
+ return {
454
+ enumerable: true,
455
+ configurable: false,
456
+ get() {
457
+ const internalSignal = entangleSignal(withSignalStore(this), this, key, intialValue);
458
+ internalSignal.isStale = false;
459
+ return internalSignal.value;
460
+ },
461
+ set(value) {
462
+ const signals = withSignalStore(this);
463
+ const internalSignal = getOrCreateInternalSignal(signals, this, key, intialValue);
464
+ if (internalSignal.value !== value) {
465
+ internalSignal.value = value;
466
+ notifyInternalSignal(internalSignal);
467
+ }
468
+ }
469
+ };
470
+ }
471
+ /**
472
+ * define an enumerable signal property.
473
+ *
474
+ * Akin to Object.defineProperty.
475
+ *
476
+ * The signal will be lazily created when accessed and scoped to the
477
+ * instance of the object.
478
+ *
479
+ * @private
480
+ */
481
+ function defineSignal(obj, key, v) {
482
+ Object.defineProperty(obj, key, createSignalDescriptor(key, v));
483
+ }
484
+ /**
485
+ * Define a non-enumerable signal property.
486
+ *
487
+ * @private
488
+ */
489
+ function defineNonEnumerableSignal(obj, key, v) {
490
+ const desc = createSignalDescriptor(key, v);
491
+ desc.enumerable = false;
492
+ Object.defineProperty(obj, key, desc);
493
+ }
494
+ /**
495
+ * Decorator version of creating a signal.
496
+ */
497
+ function signal(target, key, descriptor) {
498
+ ((test) => {
499
+ if (!test) throw new Error("You attempted to use @signal(), which is not necessary nor supported. Remove the parentheses and you will be good to go!");
500
+ })(target !== void 0);
501
+ ((test) => {
502
+ if (!test) throw new Error(`You attempted to use @signal on with ${arguments.length > 1 ? "arguments" : "an argument"} ( @signal(${Array.from(arguments).map((d) => `'${d}'`).join(", ")}) ), which is not supported. Dependencies are automatically tracked, so you can just use \`@signal\``);
503
+ })(typeof target === "object" && typeof key === "string" && typeof descriptor === "object" && arguments.length === 3);
504
+ return createSignalDescriptor(key, descriptor.initializer ? makeInitializer(descriptor.initializer) : null);
505
+ }
506
+ /**
507
+ * Decorator version of creating a memoized getter
508
+ */
509
+ function memoized(target, key, descriptor) {
510
+ ((test) => {
511
+ if (!test) throw new Error("You attempted to use @memoized(), which is not necessary nor supported. Remove the parentheses and you will be good to go!");
512
+ })(target !== void 0);
513
+ ((test) => {
514
+ if (!test) throw new Error(`You attempted to use @memoized on with ${arguments.length > 1 ? "arguments" : "an argument"} ( @memoized(${Array.from(arguments).map((d) => `'${d}'`).join(", ")}), which is not supported. Dependencies are automatically tracked, so you can just use \`@memoized\``);
515
+ })(typeof target === "object" && typeof key === "string" && typeof descriptor === "object" && arguments.length === 3);
516
+ ((test) => {
517
+ if (!test) throw new Error(`The @memoized decorator must be applied to getters. '${key}' is not a getter.`);
518
+ })(typeof descriptor.get === "function");
519
+ const getter = descriptor.get;
520
+ descriptor.get = function() {
521
+ const signals = withSignalStore(this);
522
+ let memoSignal = signals.get(key);
523
+ if (!memoSignal) memoSignal = createInternalMemo(signals, this, key, getter.bind(this));
524
+ return memoSignal();
525
+ };
526
+ return descriptor;
527
+ }
528
+ /**
529
+ * Decorator version of creating a gate.
530
+ *
531
+ * @private
532
+ */
533
+ function gate(_target, key, desc) {
534
+ const getter = desc.get;
535
+ const setter = desc.set;
536
+ const isLocal = desc.isLocal;
537
+ desc.get = function() {
538
+ const signals = withSignalStore(this);
539
+ let internalSignal = peekInternalSignal(signals, key);
540
+ if (!internalSignal) internalSignal = createInternalSignal(signals, this, key, getter.call(this));
541
+ else if (internalSignal.isStale) {
542
+ internalSignal.isStale = false;
543
+ internalSignal.value = getter.call(this);
544
+ }
545
+ consumeInternalSignal(internalSignal);
546
+ return internalSignal.value;
547
+ };
548
+ if (setter) desc.set = function(v) {
549
+ const signals = withSignalStore(this);
550
+ let internalSignal = peekInternalSignal(signals, key);
551
+ if (!internalSignal) {
552
+ internalSignal = createInternalSignal(signals, this, key, void 0);
553
+ internalSignal.isStale = true;
554
+ }
555
+ setter.call(this, v);
556
+ if (isLocal) {
557
+ internalSignal.isStale = true;
558
+ notifyInternalSignal(internalSignal);
559
+ }
560
+ };
561
+ return desc;
562
+ }
563
+ /**
564
+ * Defines a reactive "gated" property on `obj` using `desc` as its
565
+ * getter/setter descriptor.
566
+ *
567
+ * Unlike a signal defined with {@link defineSignal}, a gated property's
568
+ * consumers are not notified when the property is set, since its update
569
+ * is expected to be controlled externally (for instance, by a signal it
570
+ * derives its value from) unless the descriptor opts into being locally
571
+ * managed.
572
+ *
573
+ * Akin to `Object.defineProperty`.
574
+ *
575
+ * @private
576
+ */
577
+ function defineGate(obj, key, desc) {
578
+ const options = Object.assign({
579
+ enumerable: true,
580
+ configurable: false
581
+ }, gate(obj, key, desc));
582
+ Object.defineProperty(obj, key, options);
583
+ }
584
+
585
+ //#endregion
586
+ //#region src/signals/request-state.ts
587
+ const RequestCache = /* @__PURE__ */ new WeakMap();
588
+ function isAbortError(error) {
589
+ return error instanceof DOMError && error.name === "AbortError";
590
+ }
591
+ function upgradeLoadingState(state) {
592
+ return state;
593
+ }
594
+ async function watchStream(stream, loadingState) {
595
+ const state = upgradeLoadingState(loadingState);
596
+ const reader = stream.getReader();
597
+ let bytesLoaded = 0;
598
+ let shouldForward = state._stream !== null && state._stream.readable.locked;
599
+ let isForwarding = shouldForward;
600
+ let writer = state._stream?.writable.getWriter();
601
+ const buffer = [];
602
+ state._isPending = false;
603
+ state._isStarted = true;
604
+ state._startTime = performance.now();
605
+ while (true) {
606
+ const { value, done } = await reader.read();
607
+ if (done) break;
608
+ bytesLoaded += value.byteLength;
609
+ state._bytesLoaded = bytesLoaded;
610
+ state._lastPacketTime = performance.now();
611
+ shouldForward = shouldForward || state._stream !== null && state._stream.readable.locked;
612
+ if (shouldForward) {
613
+ if (!isForwarding) {
614
+ isForwarding = true;
615
+ writer = state._stream.writable.getWriter();
616
+ for (const item of buffer) {
617
+ await writer.ready;
618
+ await writer.write(item);
619
+ }
620
+ buffer.length = 0;
621
+ }
622
+ await writer.ready;
623
+ await writer.write(value);
624
+ } else buffer.push(value);
625
+ }
626
+ if (isForwarding) {
627
+ await writer.ready;
628
+ await writer.close();
629
+ } else if (state._stream) {
630
+ await state._stream.readable.cancel("The Stream Has Already Ended");
631
+ state._stream = null;
632
+ }
633
+ state._endTime = performance.now();
634
+ state._isComplete = true;
635
+ state._isStarted = false;
636
+ }
637
+ /**
638
+ * Lazily consumes the stream of a request, providing a number of
639
+ * reactive properties that can be used to build UIs that respond
640
+ * to the progress of a request.
641
+ *
642
+ * @hideconstructor
643
+ */
644
+ var RequestLoadingState = class {
645
+ /** @internal */
646
+ /** @internal */
647
+ /** @internal */
648
+ /** @internal */
649
+ /** @internal */
650
+ /** @internal */
651
+ /** @internal */
652
+ /** @internal */
653
+ /** @internal */
654
+ /** @internal */
655
+ /** @internal */
656
+ /** @internal */
657
+ _stream = null;
658
+ /** @internal */
659
+ _future;
660
+ /** @internal */
661
+ _triggered = false;
662
+ /** @internal */
663
+ _trigger() {
664
+ if (this._triggered) return;
665
+ this._triggered = true;
666
+ const promise = this._future.getStream();
667
+ if (promise.sizeHint) this._sizeHint = promise.sizeHint;
668
+ this.promise = promise.then((stream) => {
669
+ if (!stream) {
670
+ this._isPending = false;
671
+ this._isComplete = true;
672
+ return;
673
+ }
674
+ return watchStream(stream, this);
675
+ }, (error) => {
676
+ this._isPending = false;
677
+ this._isStarted = false;
678
+ if (isAbortError(error)) {
679
+ this._isCancelled = true;
680
+ this._isComplete = true;
681
+ }
682
+ this._isErrored = true;
683
+ this._error = error;
684
+ });
685
+ }
686
+ /**
687
+ * Resolves once the stream has finished being consumed, or rejects
688
+ * if the request errors. `null` until first accessed.
689
+ */
690
+ promise = null;
691
+ /**
692
+ * Whether the stream has not yet started being consumed.
693
+ */
694
+ get isPending() {
695
+ this._trigger();
696
+ return this._isPending;
697
+ }
698
+ /**
699
+ * The total size of the response in bytes, if known ahead of time
700
+ * (via a `Content-Length` header or similar).
701
+ */
702
+ get sizeHint() {
703
+ this._trigger();
704
+ return this._sizeHint;
705
+ }
706
+ /**
707
+ * A readable stream of the response content. Accessing this property
708
+ * begins consumption of the underlying request stream.
709
+ */
710
+ get stream() {
711
+ this._trigger();
712
+ if (!this._stream) {
713
+ if (this._isComplete || this._isCancelled || this._isErrored) return null;
714
+ this._stream = new TransformStream();
715
+ }
716
+ return this._stream.readable;
717
+ }
718
+ /**
719
+ * Whether the stream has started being consumed but has not yet completed.
720
+ */
721
+ get isStarted() {
722
+ this._trigger();
723
+ return this._isStarted;
724
+ }
725
+ /**
726
+ * The number of bytes loaded so far.
727
+ */
728
+ get bytesLoaded() {
729
+ this._trigger();
730
+ return this._bytesLoaded;
731
+ }
732
+ /**
733
+ * The `performance.now()` timestamp at which the stream started being consumed.
734
+ */
735
+ get startTime() {
736
+ this._trigger();
737
+ return this._startTime;
738
+ }
739
+ /**
740
+ * The `performance.now()` timestamp at which the stream finished being consumed.
741
+ */
742
+ get endTime() {
743
+ this._trigger();
744
+ return this._endTime;
745
+ }
746
+ /**
747
+ * The `performance.now()` timestamp at which the last chunk of data was received.
748
+ */
749
+ get lastPacketTime() {
750
+ this._trigger();
751
+ return this._lastPacketTime;
752
+ }
753
+ /**
754
+ * Whether the stream has finished being consumed.
755
+ */
756
+ get isComplete() {
757
+ this._trigger();
758
+ return this._isComplete;
759
+ }
760
+ /**
761
+ * Whether the request was aborted before the stream finished being consumed.
762
+ */
763
+ get isCancelled() {
764
+ this._trigger();
765
+ return this._isCancelled;
766
+ }
767
+ /**
768
+ * Whether an error occurred while consuming the stream.
769
+ */
770
+ get isErrored() {
771
+ this._trigger();
772
+ return this._isErrored;
773
+ }
774
+ /**
775
+ * The error that occurred while consuming the stream, if any.
776
+ */
777
+ get error() {
778
+ this._trigger();
779
+ return this._error;
780
+ }
781
+ /**
782
+ * The number of milliseconds elapsed since the stream started being
783
+ * consumed, using the last packet time (or end time, once complete)
784
+ * as the endpoint.
785
+ */
786
+ get elapsedTime() {
787
+ return (this.endTime || this.lastPacketTime) - this.startTime;
788
+ }
789
+ /**
790
+ * The ratio (0 to 1) of {@link RequestLoadingState.bytesLoaded | bytesLoaded}
791
+ * to {@link RequestLoadingState.sizeHint | sizeHint}, or `0` if no size hint is available.
792
+ */
793
+ get completedRatio() {
794
+ return this.sizeHint ? this.bytesLoaded / this.sizeHint : 0;
795
+ }
796
+ /**
797
+ * The inverse of {@link RequestLoadingState.completedRatio | completedRatio}.
798
+ */
799
+ get remainingRatio() {
800
+ return 1 - this.completedRatio;
801
+ }
802
+ /**
803
+ * The total number of milliseconds elapsed between
804
+ * {@link RequestLoadingState.startTime | startTime} and {@link RequestLoadingState.endTime | endTime}.
805
+ */
806
+ get duration() {
807
+ return this.endTime - this.startTime;
808
+ }
809
+ /**
810
+ * The average download speed in bytes per second.
811
+ */
812
+ get speed() {
813
+ return this.bytesLoaded / (this.elapsedTime / 1e3);
814
+ }
815
+ constructor(future) {
816
+ this._future = future;
817
+ }
818
+ /**
819
+ * Aborts the underlying request.
820
+ */
821
+ abort = () => {
822
+ this._future.abort();
823
+ };
824
+ };
825
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_isPending", true);
826
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_isStarted", false);
827
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_isComplete", false);
828
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_isCancelled", false);
829
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_isErrored", false);
830
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_error", null);
831
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_sizeHint", 0);
832
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_bytesLoaded", 0);
833
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_startTime", 0);
834
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_endTime", 0);
835
+ defineNonEnumerableSignal(RequestLoadingState.prototype, "_lastPacketTime", 0);
836
+ /**
837
+ * The state of a request in the "pending"
838
+ * state. This is the default initial state.
839
+ *
840
+ * Extends the {@link PendingPromise} interface.
841
+ *
842
+ */
843
+ /**
844
+ * The state of a request in the "fulfilled" state.
845
+ * This is the state of a request that has resolved
846
+ * successfully.
847
+ *
848
+ * Extends the {@link ResolvedPromise} interface.
849
+ *
850
+ */
851
+ /**
852
+ * The state of a request in the "rejected" state.
853
+ * This is the state of a request that has rejected
854
+ * with an error.
855
+ *
856
+ * Extends the {@link RejectedPromise} interface.
857
+ *
858
+ */
859
+ /**
860
+ * The state of a request in the "cancelled" state.
861
+ * This is the state of a promise that has been
862
+ * cancelled.
863
+ *
864
+ */
865
+ /**
866
+ * RequestState extends the concept of {@link PromiseState} to provide a reactive
867
+ * wrapper for a request {@link Future} which allows you write declarative code
868
+ * around a Future's control flow.
869
+ *
870
+ * It is useful in both Template and JavaScript contexts, allowing you
871
+ * to quickly derive behaviors and data from pending, error and success
872
+ * states.
873
+ *
874
+ * The key difference between a {@link Promise} and a Future is that Futures provide
875
+ * access to a {@link ReadableStream | stream} of their content, the {@link RequestKey} of the request (if any)
876
+ * as well as the ability to attempt to {@link Future.abort | abort} the request.
877
+ *
878
+ * ```ts
879
+ * interface Future<T> extends Promise<T>> {
880
+ * getStream(): Promise<ReadableStream>;
881
+ * abort(): void;
882
+ * lid: RequestKey | null;
883
+ * }
884
+ * ```
885
+ *
886
+ * These additional APIs allow us to craft even richer state experiences.
887
+ *
888
+ * To get the state of a request, use {@link getRequestState}.
889
+ *
890
+ * See also:
891
+ * - {@link PendingRequest}
892
+ * - {@link ResolvedRequest}
893
+ * - {@link RejectedRequest}
894
+ * - {@link CancelledRequest}
895
+ *
896
+ */
897
+ const RequestStateProto = {};
898
+ function performRefresh(requester, request, isReload) {
899
+ const req = Object.assign({}, request);
900
+ const cacheOptions = Object.assign({}, req.cacheOptions);
901
+ if (isReload) cacheOptions.reload = true;
902
+ else if (isReload === false) {
903
+ delete cacheOptions.reload;
904
+ cacheOptions.backgroundReload = true;
905
+ } else {
906
+ delete cacheOptions.backgroundReload;
907
+ delete cacheOptions.reload;
908
+ }
909
+ req.cacheOptions = cacheOptions;
910
+ return requester.request(req);
911
+ }
912
+ defineSignal(RequestStateProto, "reason", null);
913
+ defineSignal(RequestStateProto, "value", null);
914
+ defineSignal(RequestStateProto, "result", null);
915
+ defineSignal(RequestStateProto, "error", null);
916
+ defineSignal(RequestStateProto, "status", "pending");
917
+ defineSignal(RequestStateProto, "isPending", true);
918
+ defineSignal(RequestStateProto, "isLoading", true);
919
+ defineSignal(RequestStateProto, "isSuccess", false);
920
+ defineSignal(RequestStateProto, "isError", false);
921
+ defineSignal(RequestStateProto, "request", null);
922
+ defineSignal(RequestStateProto, "response", null);
923
+ Object.defineProperty(RequestStateProto, "isCancelled", { get() {
924
+ return this.isError && isAbortError(this.reason);
925
+ } });
926
+ Object.defineProperty(RequestStateProto, "loadingState", { get() {
927
+ if (!this._loadingState) this._loadingState = new RequestLoadingState(this._request);
928
+ return this._loadingState;
929
+ } });
930
+ function createRequestState(future) {
931
+ const state = getPromiseResult(future);
932
+ const promiseState = Object.create(RequestStateProto);
933
+ promiseState._request = future;
934
+ promiseState.reload = () => {
935
+ ((test) => {
936
+ if (!test) throw new Error(`Cannot reload a request that is still pending. Await or abort the original request first.`);
937
+ })(!promiseState.isPending);
938
+ return performRefresh(future.requester, promiseState.request, true);
939
+ };
940
+ promiseState.refresh = (usePolicy = false) => {
941
+ ((test) => {
942
+ if (!test) throw new Error(`Cannot refresh a request that is still pending. Await or abort the original request first.`);
943
+ })(!promiseState.isPending);
944
+ return performRefresh(future.requester, promiseState.request, usePolicy === true ? null : false);
945
+ };
946
+ if (state) {
947
+ if (state.isError) {
948
+ promiseState.error = state.result;
949
+ promiseState.reason = state.result;
950
+ promiseState.status = "rejected";
951
+ promiseState.isError = true;
952
+ promiseState.isPending = false;
953
+ promiseState.isLoading = false;
954
+ promiseState.request = state.result.request;
955
+ promiseState.response = state.result.response;
956
+ } else {
957
+ promiseState.result = state.result.content;
958
+ promiseState.value = state.result.content;
959
+ promiseState.status = "fulfilled";
960
+ promiseState.isSuccess = true;
961
+ promiseState.isPending = false;
962
+ promiseState.isLoading = false;
963
+ promiseState.request = state.result.request;
964
+ promiseState.response = state.result.response;
965
+ }
966
+ } else future.then((result) => {
967
+ setPromiseResult(future, {
968
+ isError: false,
969
+ result
970
+ });
971
+ promiseState.result = result.content;
972
+ promiseState.value = result.content;
973
+ promiseState.status = "fulfilled";
974
+ promiseState.isSuccess = true;
975
+ promiseState.isPending = false;
976
+ promiseState.isLoading = false;
977
+ promiseState.request = result.request;
978
+ promiseState.response = result.response;
979
+ }, (error) => {
980
+ setPromiseResult(future, {
981
+ isError: true,
982
+ result: error
983
+ });
984
+ promiseState.error = error;
985
+ promiseState.reason = error;
986
+ promiseState.status = "rejected";
987
+ promiseState.isError = true;
988
+ promiseState.isPending = false;
989
+ promiseState.isLoading = false;
990
+ promiseState.request = error.request;
991
+ promiseState.response = error.response;
992
+ });
993
+ return promiseState;
994
+ }
995
+ /**
996
+ * `getRequestState` can be used in both JavaScript and Template contexts.
997
+ *
998
+ * ```ts
999
+ * import { getRequestState } from '@warp-drive-mirror/ember';
1000
+ *
1001
+ * const state = getRequestState(future);
1002
+ * ```
1003
+ *
1004
+ * For instance, we could write a getter on a component that updates whenever
1005
+ * the request state advances or the future changes, by combining the function
1006
+ * with the use of `@cached`
1007
+ *
1008
+ * ```ts
1009
+ * class Component {
1010
+ * @cached
1011
+ * get title() {
1012
+ * const state = getRequestState(this.args.request);
1013
+ * if (state.isPending) {
1014
+ * return 'loading...';
1015
+ * }
1016
+ * if (state.isError) { return null; }
1017
+ * return state.result.title;
1018
+ * }
1019
+ * }
1020
+ * ```
1021
+ *
1022
+ * Or in a template as a helper:
1023
+ *
1024
+ * ```gjs
1025
+ * import { getRequestState } from '@warp-drive-mirror/ember';
1026
+ *
1027
+ * <template>
1028
+ * {{#let (getRequestState @request) as |state|}}
1029
+ * {{#if state.isPending}}
1030
+ * <Spinner />
1031
+ * {{else if state.isError}}
1032
+ * <ErrorForm @error={{state.error}} />
1033
+ * {{else}}
1034
+ * <h1>{{state.result.title}}</h1>
1035
+ * {{/if}}
1036
+ * {{/let}}
1037
+ * </template>
1038
+ * ```
1039
+ *
1040
+ * If looking to use in a template, consider also the `<Request />` component
1041
+ * which offers a number of additional capabilities for requests *beyond* what
1042
+ * `RequestState` provides.
1043
+ *
1044
+ */
1045
+ function getRequestState(future) {
1046
+ let state = RequestCache.get(future);
1047
+ if (!state) {
1048
+ state = createRequestState(future);
1049
+ RequestCache.set(future, state);
1050
+ }
1051
+ return state;
1052
+ }
1053
+
1054
+ //#endregion
1055
+ //#region ../../node_modules/.pnpm/decorat_5005bbc272376d25df08203abab44e2f/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js
1056
+ function decorateMethodV2(prototype, prop, decorators) {
1057
+ let desc = { ...Object.getOwnPropertyDescriptor(prototype, prop) };
1058
+ for (let decorator of decorators) desc = decorator(prototype, prop, desc) || desc;
1059
+ if (desc.initializer !== void 0) {
1060
+ desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;
1061
+ desc.initializer = void 0;
1062
+ }
1063
+ Object.defineProperty(prototype, prop, desc);
1064
+ }
1065
+
1066
+ //#endregion
1067
+ //#region src/signals/request-subscription.ts
1068
+ const DEFAULT_DEADLINE = 3e4;
1069
+ /**
1070
+ * A symbol used to dispose of a {@link RequestSubscription} when the
1071
+ * component or context using it is torn down.
1072
+ */
1073
+ const DISPOSE = Symbol.dispose || Symbol.for("dispose");
1074
+ function isNeverString(val) {
1075
+ return val;
1076
+ }
1077
+ /**
1078
+ * The individual autorefresh strategies a {@link RequestSubscription}
1079
+ * may combine, see {@link AutorefreshBehaviorCombos}.
1080
+ */
1081
+ /**
1082
+ * The value accepted by {@link SubscriptionArgs.autorefresh}: either a
1083
+ * boolean, a single {@link AutorefreshBehaviorType}, or a comma-separated
1084
+ * combination of up to three of them.
1085
+ */
1086
+ /**
1087
+ * Utilities to assist in recovering from the error.
1088
+ */
1089
+ /** @deprecated use {@link RecoveryFeatures} */
1090
+ /**
1091
+ * Utilities for keeping the request fresh
1092
+ */
1093
+ /**
1094
+ * The args accepted by the `<Request />` component.
1095
+ */
1096
+ /**
1097
+ * The args accepted by a {@link RequestSubscription}.
1098
+ */
1099
+ /**
1100
+ * A reactive class
1101
+ *
1102
+ * @hideconstructor
1103
+ */
1104
+ var RequestSubscription = class {
1105
+ /**
1106
+ * Whether the browser reports that the network is online.
1107
+ */
1108
+ /**
1109
+ * Whether the browser reports that the tab is hidden.
1110
+ */
1111
+ /**
1112
+ * Whether the component is currently refreshing the request.
1113
+ */
1114
+ /**
1115
+ * The most recent blocking request that was made, typically
1116
+ * the result of a reload.
1117
+ *
1118
+ * This will never be the original request passed as an arg to
1119
+ * the component.
1120
+ *
1121
+ * @internal
1122
+ */
1123
+ /**
1124
+ * The most recent request that was made, typically due to either a
1125
+ * reload or a refresh.
1126
+ *
1127
+ * This will never be the original request passed as an arg to
1128
+ * the component.
1129
+ *
1130
+ * @internal
1131
+ */
1132
+ /**
1133
+ * The time at which the network was reported as offline.
1134
+ *
1135
+ * @internal
1136
+ */
1137
+ /** @internal */
1138
+ /** @internal */
1139
+ /** @internal */
1140
+ /** @internal */
1141
+ /** @internal */
1142
+ /**
1143
+ * The event listener for network status changes,
1144
+ * cached to use the reference for removal.
1145
+ *
1146
+ * @internal
1147
+ */
1148
+ /**
1149
+ * The event listener for visibility status changes,
1150
+ * cached to use the reference for removal.
1151
+ *
1152
+ * @internal
1153
+ */
1154
+ /**
1155
+ * The last request passed as an arg to the component,
1156
+ * cached for comparison.
1157
+ *
1158
+ * @internal
1159
+ */
1160
+ /**
1161
+ * The last query passed as an arg to the component,
1162
+ * cached for comparison.
1163
+ *
1164
+ * @internal
1165
+ */
1166
+ /** @internal */
1167
+ /** @internal */
1168
+ /** @internal */
1169
+ /**
1170
+ * The Store this subscription subscribes to or the RequestManager
1171
+ * which issues this request.
1172
+ */
1173
+ /**
1174
+ * The Store or RequestManager that the last subscription is attached to.
1175
+ *
1176
+ * This differs from 'store' because a <Request /> may be passed a
1177
+ * request originating from a different store than the <Request />
1178
+ * component would use if it were to issue the request itself.
1179
+ *
1180
+ * @internal
1181
+ */
1182
+ _requester;
1183
+ constructor(store, args) {
1184
+ this._args = args;
1185
+ this.store = store;
1186
+ this._subscribedTo = null;
1187
+ this._subscription = null;
1188
+ this._intervalStart = null;
1189
+ this._invalidated = false;
1190
+ this._nextInterval = null;
1191
+ this._requester = null;
1192
+ this.isDestroyed = false;
1193
+ this[DISPOSE] = _DISPOSE;
1194
+ this._installListeners();
1195
+ this._beginPolling();
1196
+ }
1197
+ /**
1198
+ * @internal
1199
+ */
1200
+ async _beginPolling() {
1201
+ try {
1202
+ if (!this.isIdle) await this.request;
1203
+ } catch {} finally {
1204
+ if (!this.isDestroyed) this._scheduleInterval();
1205
+ }
1206
+ }
1207
+ /**
1208
+ * Whether neither a `request` nor a `query` arg was provided, and so
1209
+ * this subscription has nothing to fetch or monitor.
1210
+ */
1211
+ get isIdle() {
1212
+ const { request, query } = this._args;
1213
+ return Boolean(!request && !query);
1214
+ }
1215
+ /**
1216
+ * The set of {@link AutorefreshBehaviorType}s this subscription is
1217
+ * configured to autorefresh for, derived from {@link SubscriptionArgs.autorefresh}.
1218
+ */
1219
+ static {
1220
+ decorateMethodV2(this.prototype, "isIdle", [memoized]);
1221
+ }
1222
+ get autorefreshTypes() {
1223
+ const { autorefresh } = this._args;
1224
+ let types;
1225
+ if (autorefresh === true) types = ["online", "invalid"];
1226
+ else if (typeof autorefresh === "string") types = autorefresh.split(",");
1227
+ else types = [];
1228
+ return new Set(types);
1229
+ }
1230
+ /** @internal */
1231
+ static {
1232
+ decorateMethodV2(this.prototype, "autorefreshTypes", [memoized]);
1233
+ }
1234
+ async _scheduleInterval() {
1235
+ const { autorefreshThreshold } = this._args;
1236
+ if (typeof window === "undefined" || !(typeof autorefreshThreshold === "number" && autorefreshThreshold > 0) || !this.autorefreshTypes.has("interval") || this._intervalStart !== null) return;
1237
+ if (this._latestRequest) {
1238
+ try {
1239
+ await this._latestRequest;
1240
+ } catch {}
1241
+ if (this.isDestroyed) return;
1242
+ }
1243
+ this._intervalStart = Date.now();
1244
+ this._nextInterval = setTimeout(() => {
1245
+ this._maybeUpdate();
1246
+ }, autorefreshThreshold);
1247
+ }
1248
+ /** @internal */
1249
+ _clearInterval() {
1250
+ if (this._nextInterval) {
1251
+ clearTimeout(this._nextInterval);
1252
+ this._intervalStart = null;
1253
+ }
1254
+ }
1255
+ /**
1256
+ * @internal
1257
+ */
1258
+ _updateSubscriptions() {
1259
+ if (this.isIdle) return;
1260
+ const requestId = this._request.lid;
1261
+ if (this._subscribedTo === requestId) return;
1262
+ this._removeSubscriptions();
1263
+ const store = this._getRequester();
1264
+ this._requester = store;
1265
+ if (requestId && isStore(store)) {
1266
+ this._subscribedTo = requestId;
1267
+ this._subscription = store.notifications.subscribe(requestId, (_id, op) => {
1268
+ if (this._isUpdating) return;
1269
+ switch (op) {
1270
+ case "invalidated":
1271
+ if (this.autorefreshTypes.has("invalid")) {
1272
+ this._invalidated = true;
1273
+ this._maybeUpdate();
1274
+ }
1275
+ break;
1276
+ case "state": {
1277
+ const priority = store.requestManager._deduped.get(requestId)?.priority;
1278
+ const state = this.reqState;
1279
+ if (!priority) this.isRefreshing = false;
1280
+ else if (priority.blocking && !state.isLoading) {
1281
+ this.isRefreshing = false;
1282
+ this._maybeUpdate("policy", true);
1283
+ } else this.isRefreshing = true;
1284
+ }
1285
+ }
1286
+ });
1287
+ }
1288
+ }
1289
+ /**
1290
+ * @internal
1291
+ */
1292
+ _removeSubscriptions() {
1293
+ const store = this._requester;
1294
+ if (this._subscription && store && isStore(store)) {
1295
+ store.notifications.unsubscribe(this._subscription);
1296
+ this._subscribedTo = null;
1297
+ this._subscription = null;
1298
+ this._requester = null;
1299
+ }
1300
+ }
1301
+ /**
1302
+ * Install the event listeners for network and visibility changes.
1303
+ *
1304
+ * This is only done in environments that provide a fully-featured global
1305
+ * `window` and/or `document`. Some non-DOM environments (e.g. React Native,
1306
+ * SSR/Node, workers) may provide a `window` global without the APIs we
1307
+ * rely on here (or no `window`/`document` at all), in which case we skip
1308
+ * attaching the corresponding listeners rather than throwing.
1309
+ *
1310
+ * @internal
1311
+ */
1312
+ _installListeners() {
1313
+ const hasWindow = typeof window !== "undefined";
1314
+ const hasDocument = typeof document !== "undefined";
1315
+ const hasWindowEvents = hasWindow && typeof window.addEventListener === "function";
1316
+ const hasDocumentEvents = hasDocument && typeof document.addEventListener === "function";
1317
+ this.isOnline = hasWindow && typeof window.navigator?.onLine === "boolean" ? window.navigator.onLine : true;
1318
+ this._unavailableStart = this.isOnline ? null : Date.now();
1319
+ this.isHidden = hasDocument && typeof document.visibilityState === "string" && document.visibilityState === "hidden";
1320
+ if (hasWindowEvents) {
1321
+ this._onlineChanged = (event) => {
1322
+ this.isOnline = event.type === "online";
1323
+ if (event.type === "offline" && this._unavailableStart === null) this._unavailableStart = Date.now();
1324
+ this._maybeUpdate();
1325
+ };
1326
+ window.addEventListener("online", this._onlineChanged, {
1327
+ passive: true,
1328
+ capture: true
1329
+ });
1330
+ window.addEventListener("offline", this._onlineChanged, {
1331
+ passive: true,
1332
+ capture: true
1333
+ });
1334
+ }
1335
+ if (hasDocumentEvents) {
1336
+ this._backgroundChanged = () => {
1337
+ const isHidden = document.visibilityState === "hidden";
1338
+ this.isHidden = isHidden;
1339
+ if (isHidden && this._unavailableStart === null) this._unavailableStart = Date.now();
1340
+ this._maybeUpdate();
1341
+ };
1342
+ document.addEventListener("visibilitychange", this._backgroundChanged, {
1343
+ passive: true,
1344
+ capture: true
1345
+ });
1346
+ }
1347
+ }
1348
+ /**
1349
+ * If the network is online and the tab is visible, either reload or refresh the request
1350
+ * based on the component's configuration and the requested update mode.
1351
+ *
1352
+ * Valid modes are:
1353
+ *
1354
+ * - `'reload'`: Force a reload of the request.
1355
+ * - `'refresh'`: Refresh the request in the background.
1356
+ * - `'policy'`: Make the request, letting the store's configured CachePolicy decide whether to reload, refresh, or do nothing.
1357
+ * - `undefined`: Make the request using the component's autorefreshBehavior setting if the autorefreshThreshold has passed.
1358
+ *
1359
+ * @internal
1360
+ */
1361
+ _maybeUpdate(mode, silent) {
1362
+ if (this.isIdle) return;
1363
+ const { reqState } = this;
1364
+ if (reqState.isPending) return;
1365
+ if (!Boolean(this.isOnline && !this.isHidden && (mode || this.autorefreshTypes.size))) {
1366
+ if (!silent && mode && mode !== "_invalidated") throw new Error(`Reload not available: the network is not online or the tab is hidden`);
1367
+ return;
1368
+ }
1369
+ const { autorefreshTypes } = this;
1370
+ let shouldAttempt = this._invalidated || Boolean(mode);
1371
+ if (!shouldAttempt && autorefreshTypes.has("online")) {
1372
+ const { _unavailableStart } = this;
1373
+ const { autorefreshThreshold } = this._args;
1374
+ const deadline = typeof autorefreshThreshold === "number" ? autorefreshThreshold : DEFAULT_DEADLINE;
1375
+ shouldAttempt = Boolean(_unavailableStart && Date.now() - _unavailableStart > deadline);
1376
+ }
1377
+ if (!shouldAttempt && autorefreshTypes.has("interval")) {
1378
+ const { _intervalStart } = this;
1379
+ const { autorefreshThreshold } = this._args;
1380
+ if (_intervalStart && typeof autorefreshThreshold === "number" && autorefreshThreshold > 0) shouldAttempt = Boolean(Date.now() - _intervalStart >= autorefreshThreshold);
1381
+ }
1382
+ this._unavailableStart = null;
1383
+ this._invalidated = false;
1384
+ if (shouldAttempt) {
1385
+ this._clearInterval();
1386
+ this._isUpdating = true;
1387
+ const val = (mode === "_invalidated" ? null : mode) ?? this._args.autorefreshBehavior ?? "policy";
1388
+ const requester = this._getRequester();
1389
+ if (!reqState._request.requester) reqState._request.requester = requester;
1390
+ switch (val) {
1391
+ case "reload":
1392
+ this._latestRequest = reqState.reload();
1393
+ break;
1394
+ case "refresh":
1395
+ this._latestRequest = reqState.refresh();
1396
+ break;
1397
+ case "policy":
1398
+ this._latestRequest = reqState.refresh(true);
1399
+ break;
1400
+ default: ((test) => {
1401
+ if (!test) throw new Error(`Invalid ${mode ? "update mode" : "@autorefreshBehavior"} for <Request />: ${isNeverString(val)}`);
1402
+ })(false);
1403
+ }
1404
+ if (val !== "refresh") this._localRequest = this._latestRequest;
1405
+ this._scheduleInterval();
1406
+ this._latestRequest.finally(() => {
1407
+ this._isUpdating = false;
1408
+ });
1409
+ }
1410
+ }
1411
+ /**
1412
+ * @internal
1413
+ */
1414
+ _getRequester() {
1415
+ if (this._args.request?.requester) return this._args.request.requester;
1416
+ return this.store;
1417
+ }
1418
+ /**
1419
+ * Retry the request, reloading it from the server.
1420
+ */
1421
+ retry = async () => {
1422
+ this._maybeUpdate("reload");
1423
+ await this._localRequest;
1424
+ };
1425
+ /**
1426
+ * Refresh the request, updating it in the background.
1427
+ */
1428
+ refresh = async () => {
1429
+ this._maybeUpdate("refresh");
1430
+ await this._latestRequest;
1431
+ };
1432
+ /**
1433
+ * features to yield to the error slot of a component
1434
+ */
1435
+ get errorFeatures() {
1436
+ return {
1437
+ isHidden: this.isHidden,
1438
+ isOnline: this.isOnline,
1439
+ retry: this.retry
1440
+ };
1441
+ }
1442
+ /**
1443
+ * features to yield to the content slot of a component
1444
+ */
1445
+ static {
1446
+ decorateMethodV2(this.prototype, "errorFeatures", [memoized]);
1447
+ }
1448
+ get contentFeatures() {
1449
+ const feat = {
1450
+ isHidden: this.isHidden,
1451
+ isOnline: this.isOnline,
1452
+ reload: this.retry,
1453
+ refresh: this.refresh,
1454
+ isRefreshing: this.isRefreshing,
1455
+ latestRequest: this._latestRequest
1456
+ };
1457
+ if (feat.isRefreshing) feat.abort = () => {
1458
+ this._latestRequest?.abort();
1459
+ };
1460
+ return feat;
1461
+ }
1462
+ /**
1463
+ * @internal
1464
+ */
1465
+ static {
1466
+ decorateMethodV2(this.prototype, "contentFeatures", [memoized]);
1467
+ }
1468
+ get _request() {
1469
+ const { request, query } = this._args;
1470
+ ((test) => {
1471
+ if (!test) throw new Error(`Cannot use both @request and @query args with the <Request> component`);
1472
+ })(!request || !query);
1473
+ const { _localRequest, _originalRequest, _originalQuery } = this;
1474
+ if (_localRequest && request === _originalRequest && query === _originalQuery) return _localRequest;
1475
+ this._originalQuery = query;
1476
+ this._originalRequest = request;
1477
+ if (request) return request;
1478
+ ((test) => {
1479
+ if (!test) throw new Error(`You must provide either @request or an @query arg with the <Request> component`);
1480
+ })(query);
1481
+ return this.store.request(query);
1482
+ }
1483
+ /**
1484
+ * The {@link Future} this subscription is currently monitoring, and
1485
+ * (re-)subscribes to notifications for as a side effect of access.
1486
+ */
1487
+ static {
1488
+ decorateMethodV2(this.prototype, "_request", [memoized]);
1489
+ }
1490
+ get request() {
1491
+ try {
1492
+ const request = this._request;
1493
+ this._updateSubscriptions();
1494
+ return request;
1495
+ } catch (e) {
1496
+ console.log(e);
1497
+ throw new Error(`Unable to initialize the request`, { cause: e });
1498
+ }
1499
+ }
1500
+ /**
1501
+ * The {@link RequestState} for {@link RequestSubscription.request | request}.
1502
+ */
1503
+ static {
1504
+ decorateMethodV2(this.prototype, "request", [memoized]);
1505
+ }
1506
+ get reqState() {
1507
+ return getRequestState(this.request);
1508
+ }
1509
+ /**
1510
+ * The resolved content of the request, once it has succeeded.
1511
+ */
1512
+ get result() {
1513
+ return this.reqState.result;
1514
+ }
1515
+ };
1516
+ defineSignal(RequestSubscription.prototype, "isOnline", true);
1517
+ defineSignal(RequestSubscription.prototype, "isHidden", false);
1518
+ defineSignal(RequestSubscription.prototype, "isRefreshing", false);
1519
+ defineSignal(RequestSubscription.prototype, "_localRequest", void 0);
1520
+ defineSignal(RequestSubscription.prototype, "_latestRequest", void 0);
1521
+ function isStore(store) {
1522
+ return "requestManager" in store;
1523
+ }
1524
+ /**
1525
+ * Creates a {@link RequestSubscription}, the reactive class powering the
1526
+ * `<Request />` component's autorefresh, retry, and refresh behaviors.
1527
+ */
1528
+ function createRequestSubscription(store, args) {
1529
+ return new RequestSubscription(store, args);
1530
+ }
1531
+ function upgradeSubscription(sub) {
1532
+ return sub;
1533
+ }
1534
+ function _DISPOSE() {
1535
+ const self = upgradeSubscription(this);
1536
+ self.isDestroyed = true;
1537
+ self._removeSubscriptions();
1538
+ self._clearInterval();
1539
+ if (self._onlineChanged && typeof window !== "undefined" && typeof window.removeEventListener === "function") {
1540
+ window.removeEventListener("online", self._onlineChanged, {
1541
+ passive: true,
1542
+ capture: true
1543
+ });
1544
+ window.removeEventListener("offline", self._onlineChanged, {
1545
+ passive: true,
1546
+ capture: true
1547
+ });
1548
+ }
1549
+ if (self._backgroundChanged && typeof document !== "undefined" && typeof document.removeEventListener === "function") document.removeEventListener("visibilitychange", self._backgroundChanged, {
1550
+ passive: true,
1551
+ capture: true
1552
+ });
1553
+ }
1554
+
1555
+ //#endregion
1556
+ //#region src/signals/promise-state.ts
1557
+ const PromiseCache = /* @__PURE__ */ new WeakMap();
1558
+ /**
1559
+ * The state of a promise in the "pending"
1560
+ * state. This is the default initial state.
1561
+ *
1562
+ */
1563
+ /**
1564
+ * The state of a promise in the "fulfilled" state.
1565
+ * This is the state of a promise that has resolved
1566
+ * successfully.
1567
+ *
1568
+ */
1569
+ /**
1570
+ * The state of a promise in the "rejected" state.
1571
+ * This is the state of a promise that has rejected
1572
+ * with an error.
1573
+ *
1574
+ */
1575
+ /**
1576
+ * The state of a promise. This is the type that is returned
1577
+ * from `getPromiseState`.
1578
+ *
1579
+ * See also:
1580
+ * - {@link PendingPromise}
1581
+ * - {@link ResolvedPromise}
1582
+ * - {@link RejectedPromise}
1583
+ *
1584
+ */
1585
+ const PromiseStateProto = {};
1586
+ defineSignal(PromiseStateProto, "reason", null);
1587
+ defineSignal(PromiseStateProto, "value", null);
1588
+ defineSignal(PromiseStateProto, "result", null);
1589
+ defineSignal(PromiseStateProto, "error", null);
1590
+ defineSignal(PromiseStateProto, "status", "pending");
1591
+ defineSignal(PromiseStateProto, "isPending", true);
1592
+ defineSignal(PromiseStateProto, "isLoading", true);
1593
+ defineSignal(PromiseStateProto, "isSuccess", false);
1594
+ defineSignal(PromiseStateProto, "isError", false);
1595
+ function createPromiseState(promise) {
1596
+ const state = getPromiseResult(promise);
1597
+ const promiseState = Object.create(PromiseStateProto);
1598
+ if (state) {
1599
+ if (state.isError) {
1600
+ promiseState.error = state.result;
1601
+ promiseState.reason = state.result;
1602
+ promiseState.status = "rejected";
1603
+ promiseState.isError = true;
1604
+ promiseState.isPending = false;
1605
+ promiseState.isLoading = false;
1606
+ } else {
1607
+ promiseState.result = state.result;
1608
+ promiseState.value = state.result;
1609
+ promiseState.status = "fulfilled";
1610
+ promiseState.isSuccess = true;
1611
+ promiseState.isPending = false;
1612
+ promiseState.isLoading = false;
1613
+ }
1614
+ } else promise.then((result) => {
1615
+ setPromiseResult(promise, {
1616
+ isError: false,
1617
+ result
1618
+ });
1619
+ promiseState.result = result;
1620
+ promiseState.value = result;
1621
+ promiseState.status = "fulfilled";
1622
+ promiseState.isSuccess = true;
1623
+ promiseState.isPending = false;
1624
+ promiseState.isLoading = false;
1625
+ }, (error) => {
1626
+ setPromiseResult(promise, {
1627
+ isError: true,
1628
+ result: error
1629
+ });
1630
+ promiseState.error = error;
1631
+ promiseState.reason = error;
1632
+ promiseState.status = "rejected";
1633
+ promiseState.isError = true;
1634
+ promiseState.isPending = false;
1635
+ promiseState.isLoading = false;
1636
+ });
1637
+ return promiseState;
1638
+ }
1639
+ const LegacyPromiseProxy = Symbol.for("LegacyPromiseProxy");
1640
+ function isLegacyAwaitable(promise) {
1641
+ return LegacyPromiseProxy in promise && "promise" in promise && promise[LegacyPromiseProxy] === true;
1642
+ }
1643
+ function getPromise(promise) {
1644
+ return isLegacyAwaitable(promise) ? promise.promise : promise;
1645
+ }
1646
+ /**
1647
+ * Returns a reactive state-machine for the provided promise or awaitable.
1648
+ *
1649
+ * Repeat calls to `getPromiseState` with the same promise will return the same state object
1650
+ * making is safe and easy to use in templates and JavaScript code to produce reactive
1651
+ * behaviors around promises.
1652
+ *
1653
+ * `getPromiseState` can be used in both JavaScript and Template contexts.
1654
+ *
1655
+ * ```ts
1656
+ * import { getPromiseState } from '@warp-drive-mirror/ember';
1657
+ *
1658
+ * const state = getPromiseState(promise);
1659
+ * ```
1660
+ *
1661
+ * For instance, we could write a getter on a component that updates whenever
1662
+ * the promise state advances or the promise changes, by combining the function
1663
+ * with the use of `@cached`
1664
+ *
1665
+ * ```ts
1666
+ * class Component {
1667
+ * @cached
1668
+ * get title() {
1669
+ * const state = getPromiseState(this.args.request);
1670
+ * if (state.isPending) {
1671
+ * return 'loading...';
1672
+ * }
1673
+ * if (state.isError) { return null; }
1674
+ * return state.result.title;
1675
+ * }
1676
+ * }
1677
+ * ```
1678
+ *
1679
+ * Or in a template as a helper:
1680
+ *
1681
+ * ```gjs
1682
+ * import { getPromiseState } from '@warp-drive-mirror/ember';
1683
+ *
1684
+ * <template>
1685
+ * {{#let (getPromiseState @request) as |state|}}
1686
+ * {{#if state.isPending}} <Spinner />
1687
+ * {{else if state.isError}} <ErrorForm @error={{state.error}} />
1688
+ * {{else}}
1689
+ * <h1>{{state.result.title}}</h1>
1690
+ * {{/if}}
1691
+ * {{/let}}
1692
+ * </template>
1693
+ * ```
1694
+ *
1695
+ * If looking to use in a template, consider also the `<Await />` component.
1696
+ *
1697
+ * See also {@link PromiseState}
1698
+ */
1699
+ function getPromiseState(promise) {
1700
+ ((test) => {
1701
+ if (!test) throw new Error(`getPromiseState expects to be called with a promise: called with ${String(promise)}`);
1702
+ })(promise);
1703
+ const _promise = getPromise(promise);
1704
+ let state = PromiseCache.get(_promise);
1705
+ if (!state) {
1706
+ state = createPromiseState(_promise);
1707
+ PromiseCache.set(_promise, state);
1708
+ }
1709
+ return state;
1710
+ }
1711
+
1712
+ //#endregion
1713
+ export { ARRAY_SIGNAL as C, willSyncFlushWatchers as D, waitFor as E, withSignalStore as S, setupSignals as T, createInternalSignal as _, createSignalDescriptor as a, notifyInternalSignal as b, defineSignal as c, gate as d, memoized as f, createInternalMemo as g, consumeInternalSignal as h, getRequestState as i, entangleInitiallyStaleSignal as l, Signals as m, DISPOSE as n, defineGate as o, signal as p, createRequestSubscription as r, defineNonEnumerableSignal as s, getPromiseState as t, entangleSignal as u, getOrCreateInternalSignal as v, OBJECT_SIGNAL as w, peekInternalSignal as x, makeInitializer as y };
1714
+ //# sourceMappingURL=-private-C1QTxlMX.js.map