@warp-drive/legacy 5.10.0-alpha.10 → 5.10.0-alpha.13

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 (349) hide show
  1. package/README.md +91 -8
  2. package/blueprints/adapter/files/__root__/__path__/__name__.js +1 -1
  3. package/blueprints/adapter/index.js +8 -4
  4. package/blueprints/adapter-test/index.js +0 -2
  5. package/blueprints/adapter-test/qunit-files/__root__/__path__/__test__.js +1 -1
  6. package/blueprints/model/files/__root__/__path__/__name__.js +1 -1
  7. package/blueprints/model/index.js +9 -3
  8. package/blueprints/model-test/index.js +0 -2
  9. package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +1 -1
  10. package/blueprints/serializer/files/__root__/__path__/__name__.js +1 -1
  11. package/blueprints/serializer/index.js +8 -4
  12. package/blueprints/serializer-test/index.js +0 -2
  13. package/blueprints/serializer-test/qunit-files/__root__/__path__/__test__.js +1 -1
  14. package/blueprints/transform/files/__root__/__path__/__name__.js +1 -1
  15. package/blueprints/transform/index.js +6 -1
  16. package/blueprints/transform-test/index.js +0 -2
  17. package/blueprints/transform-test/qunit-files/__root__/__path__/__test__.js +1 -1
  18. package/dist/-private-BE7RaJCw.js.map +1 -1
  19. package/dist/adapter/-private.d.ts +2 -2
  20. package/dist/adapter/error.d.ts +1 -1
  21. package/dist/adapter/error.js +53 -0
  22. package/dist/adapter/error.js.map +1 -1
  23. package/dist/adapter/json-api.d.ts +5 -3
  24. package/dist/adapter/json-api.d.ts.map +1 -1
  25. package/dist/adapter/json-api.js +8 -1
  26. package/dist/adapter/json-api.js.map +1 -1
  27. package/dist/adapter/rest.d.ts +1 -1
  28. package/dist/adapter/rest.js +20 -1
  29. package/dist/adapter/rest.js.map +1 -1
  30. package/dist/{adapter-eYo2pIuM.js → adapter-BNC6wlWu.js} +42 -1
  31. package/dist/adapter-BNC6wlWu.js.map +1 -0
  32. package/dist/{adapter-CARrK3-8.d.ts → adapter-D3A8ixjz.d.ts} +9 -2
  33. package/dist/adapter-D3A8ixjz.d.ts.map +1 -0
  34. package/dist/adapter.d.ts +1 -1
  35. package/dist/adapter.js +1 -1
  36. package/dist/compat/-private.d.ts +1 -1
  37. package/dist/compat/builders.d.ts +10 -0
  38. package/dist/compat/builders.d.ts.map +1 -1
  39. package/dist/compat/builders.js +10 -0
  40. package/dist/compat/builders.js.map +1 -1
  41. package/dist/compat/extensions.d.ts +1 -1
  42. package/dist/compat/extensions.js +22 -0
  43. package/dist/compat/extensions.js.map +1 -1
  44. package/dist/compat/utils.d.ts +16 -0
  45. package/dist/compat/utils.d.ts.map +1 -1
  46. package/dist/compat/utils.js +18 -0
  47. package/dist/compat/utils.js.map +1 -1
  48. package/dist/{compat-BbNNmTM-.d.ts → compat-BZlQ-5eI.d.ts} +30 -1
  49. package/dist/compat-BZlQ-5eI.d.ts.map +1 -0
  50. package/dist/{compat-DWgmYX8T.js → compat-Da5y9AsM.js} +57 -1
  51. package/dist/compat-Da5y9AsM.js.map +1 -0
  52. package/dist/compat.d.ts +1 -1
  53. package/dist/compat.js +1 -1
  54. package/dist/{error-CzkyXr1Q.d.ts → error-Ba1cMaWG.d.ts} +49 -1
  55. package/dist/error-Ba1cMaWG.d.ts.map +1 -0
  56. package/dist/{errors-BlrR6--x.js → errors-BI0Xugyo.js} +3 -1
  57. package/dist/errors-BI0Xugyo.js.map +1 -0
  58. package/dist/{extensions-DumNm4dA.d.ts → extensions-fwdnX9n4.d.ts} +18 -1
  59. package/dist/extensions-fwdnX9n4.d.ts.map +1 -0
  60. package/dist/index.d.ts +16 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +24 -5
  63. package/dist/index.js.map +1 -1
  64. package/dist/{json-BXNPTlcH.js → json-n2XHdV_P.js} +8 -1
  65. package/dist/json-n2XHdV_P.js.map +1 -0
  66. package/dist/model/-private.d.ts +1 -1
  67. package/dist/model/-private.js +1 -1
  68. package/dist/model/migration-support.d.ts +18 -2
  69. package/dist/model/migration-support.d.ts.map +1 -1
  70. package/dist/model/migration-support.js +21 -3
  71. package/dist/model/migration-support.js.map +1 -1
  72. package/dist/{model-62hn5_PD.d.ts → model-BPVLf-rp.d.ts} +11 -2
  73. package/dist/model-BPVLf-rp.d.ts.map +1 -0
  74. package/dist/{model-C9l1mRs6.js → model-DdlhdL9V.js} +14 -3
  75. package/dist/model-DdlhdL9V.js.map +1 -0
  76. package/dist/{unpkg/dev-deprecated/model-fragments-DSqu0ptR.js → model-fragments-ZM4k_mT3.js} +23 -1
  77. package/dist/model-fragments-ZM4k_mT3.js.map +1 -0
  78. package/dist/model-fragments.d.ts +31 -1
  79. package/dist/model-fragments.d.ts.map +1 -1
  80. package/dist/model-fragments.js +1 -1
  81. package/dist/model.d.ts +12 -1
  82. package/dist/model.d.ts.map +1 -1
  83. package/dist/model.js +2 -2
  84. package/dist/{rest-0NhtexIq.d.ts → rest-ddU-K5eS.d.ts} +18 -4
  85. package/dist/rest-ddU-K5eS.d.ts.map +1 -0
  86. package/dist/{schema-provider-waPfuoKq.js → schema-provider-Dyjpau2P.js} +13 -6
  87. package/dist/schema-provider-Dyjpau2P.js.map +1 -0
  88. package/dist/serializer/json-api.d.ts +1 -0
  89. package/dist/serializer/json-api.d.ts.map +1 -1
  90. package/dist/serializer/json-api.js +6 -1
  91. package/dist/serializer/json-api.js.map +1 -1
  92. package/dist/serializer/json.d.ts +2 -0
  93. package/dist/serializer/json.d.ts.map +1 -1
  94. package/dist/serializer/json.js +1 -1
  95. package/dist/serializer/rest.d.ts +4 -0
  96. package/dist/serializer/rest.d.ts.map +1 -1
  97. package/dist/serializer/rest.js +10 -1
  98. package/dist/serializer/rest.js.map +1 -1
  99. package/dist/serializer/transform.d.ts +9 -0
  100. package/dist/serializer/transform.d.ts.map +1 -1
  101. package/dist/serializer/transform.js +9 -0
  102. package/dist/serializer/transform.js.map +1 -1
  103. package/dist/serializer.d.ts +2 -0
  104. package/dist/serializer.d.ts.map +1 -1
  105. package/dist/serializer.js +40 -0
  106. package/dist/serializer.js.map +1 -1
  107. package/dist/{store-C4qYzXei.js → store-CMUcaXRp.js} +9 -1
  108. package/dist/store-CMUcaXRp.js.map +1 -0
  109. package/dist/store.d.ts +3 -0
  110. package/dist/store.d.ts.map +1 -1
  111. package/dist/store.js +1 -1
  112. package/dist/unpkg/dev/-private-BWBRzgZO.js.map +1 -1
  113. package/dist/unpkg/dev/adapter/error.js +53 -0
  114. package/dist/unpkg/dev/adapter/error.js.map +1 -1
  115. package/dist/unpkg/dev/adapter/json-api.js +8 -1
  116. package/dist/unpkg/dev/adapter/json-api.js.map +1 -1
  117. package/dist/unpkg/dev/adapter/rest.js +20 -1
  118. package/dist/unpkg/dev/adapter/rest.js.map +1 -1
  119. package/dist/unpkg/{dev-deprecated/adapter-oLwyr47q.js → dev/adapter-CLkSBRpr.js} +42 -1
  120. package/dist/unpkg/dev/adapter-CLkSBRpr.js.map +1 -0
  121. package/dist/unpkg/dev/adapter.js +1 -1
  122. package/dist/unpkg/dev/compat/builders.js +10 -0
  123. package/dist/unpkg/dev/compat/builders.js.map +1 -1
  124. package/dist/unpkg/dev/compat/extensions.js +22 -0
  125. package/dist/unpkg/dev/compat/extensions.js.map +1 -1
  126. package/dist/unpkg/dev/compat/utils.js +18 -0
  127. package/dist/unpkg/dev/compat/utils.js.map +1 -1
  128. package/dist/unpkg/dev/{compat-BIv7BiG_.js → compat-BEO8cSlC.js} +57 -1
  129. package/dist/unpkg/dev/compat-BEO8cSlC.js.map +1 -0
  130. package/dist/unpkg/dev/compat.js +1 -1
  131. package/dist/unpkg/dev/{errors-Dv8RCLdU.js → errors-TUXPdiG8.js} +3 -1
  132. package/dist/unpkg/dev/errors-TUXPdiG8.js.map +1 -0
  133. package/dist/unpkg/dev/index.js +24 -5
  134. package/dist/unpkg/dev/index.js.map +1 -1
  135. package/dist/unpkg/dev/{json-DDJji3V3.js → json-CN-WCWwk.js} +8 -1
  136. package/dist/unpkg/dev/json-CN-WCWwk.js.map +1 -0
  137. package/dist/unpkg/dev/model/-private.js +1 -1
  138. package/dist/unpkg/dev/model/migration-support.js +20 -2
  139. package/dist/unpkg/dev/model/migration-support.js.map +1 -1
  140. package/dist/unpkg/dev/{model-CRYi4C3z.js → model-OQxvzZu6.js} +14 -3
  141. package/dist/unpkg/dev/model-OQxvzZu6.js.map +1 -0
  142. package/dist/unpkg/dev/{model-fragments-DSqu0ptR.js → model-fragments-ZM4k_mT3.js} +23 -1
  143. package/dist/unpkg/dev/model-fragments-ZM4k_mT3.js.map +1 -0
  144. package/dist/unpkg/dev/model-fragments.js +1 -1
  145. package/dist/unpkg/dev/model.js +2 -2
  146. package/dist/unpkg/dev/{schema-provider-BYjTpV6C.js → schema-provider-Qxo5AVFM.js} +9 -2
  147. package/dist/unpkg/dev/schema-provider-Qxo5AVFM.js.map +1 -0
  148. package/dist/unpkg/dev/serializer/json-api.js +6 -1
  149. package/dist/unpkg/dev/serializer/json-api.js.map +1 -1
  150. package/dist/unpkg/dev/serializer/json.js +1 -1
  151. package/dist/unpkg/dev/serializer/rest.js +10 -1
  152. package/dist/unpkg/dev/serializer/rest.js.map +1 -1
  153. package/dist/unpkg/dev/serializer/transform.js +9 -0
  154. package/dist/unpkg/dev/serializer/transform.js.map +1 -1
  155. package/dist/unpkg/dev/serializer.js +40 -0
  156. package/dist/unpkg/dev/serializer.js.map +1 -1
  157. package/dist/unpkg/dev/{store-D_V8-HQl.js → store-DPzaVp5e.js} +9 -1
  158. package/dist/unpkg/dev/store-DPzaVp5e.js.map +1 -0
  159. package/dist/unpkg/dev/store.js +1 -1
  160. package/dist/unpkg/dev-deprecated/-private-BWBRzgZO.js.map +1 -1
  161. package/dist/unpkg/dev-deprecated/adapter/error.js +53 -0
  162. package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -1
  163. package/dist/unpkg/dev-deprecated/adapter/json-api.js +8 -1
  164. package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -1
  165. package/dist/unpkg/dev-deprecated/adapter/rest.js +20 -1
  166. package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -1
  167. package/dist/unpkg/{dev/adapter-oLwyr47q.js → dev-deprecated/adapter-CLkSBRpr.js} +42 -1
  168. package/dist/unpkg/dev-deprecated/adapter-CLkSBRpr.js.map +1 -0
  169. package/dist/unpkg/dev-deprecated/adapter.js +1 -1
  170. package/dist/unpkg/dev-deprecated/compat/builders.js +10 -0
  171. package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -1
  172. package/dist/unpkg/dev-deprecated/compat/extensions.js +22 -0
  173. package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -1
  174. package/dist/unpkg/dev-deprecated/compat/utils.js +18 -0
  175. package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -1
  176. package/dist/unpkg/dev-deprecated/{compat-BpJgmr75.js → compat-diBpt972.js} +57 -1
  177. package/dist/unpkg/dev-deprecated/compat-diBpt972.js.map +1 -0
  178. package/dist/unpkg/dev-deprecated/compat.js +1 -1
  179. package/dist/unpkg/dev-deprecated/{errors-__7EyX3m.js → errors-CLRhQKym.js} +3 -1
  180. package/dist/unpkg/dev-deprecated/errors-CLRhQKym.js.map +1 -0
  181. package/dist/unpkg/dev-deprecated/index.js +24 -5
  182. package/dist/unpkg/dev-deprecated/index.js.map +1 -1
  183. package/dist/unpkg/dev-deprecated/{json-DDJji3V3.js → json-CN-WCWwk.js} +8 -1
  184. package/dist/unpkg/dev-deprecated/json-CN-WCWwk.js.map +1 -0
  185. package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
  186. package/dist/unpkg/dev-deprecated/model/migration-support.js +20 -2
  187. package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -1
  188. package/dist/unpkg/dev-deprecated/{model-BYzXxf9f.js → model-DIvuaUiJ.js} +14 -3
  189. package/dist/unpkg/dev-deprecated/model-DIvuaUiJ.js.map +1 -0
  190. package/dist/{model-fragments-DSqu0ptR.js → unpkg/dev-deprecated/model-fragments-ZM4k_mT3.js} +23 -1
  191. package/dist/unpkg/dev-deprecated/model-fragments-ZM4k_mT3.js.map +1 -0
  192. package/dist/unpkg/dev-deprecated/model-fragments.js +1 -1
  193. package/dist/unpkg/dev-deprecated/model.js +2 -2
  194. package/dist/unpkg/dev-deprecated/{schema-provider-BM9FSxvx.js → schema-provider-DHS8XOdK.js} +9 -2
  195. package/dist/unpkg/dev-deprecated/schema-provider-DHS8XOdK.js.map +1 -0
  196. package/dist/unpkg/dev-deprecated/serializer/json-api.js +6 -1
  197. package/dist/unpkg/dev-deprecated/serializer/json-api.js.map +1 -1
  198. package/dist/unpkg/dev-deprecated/serializer/json.js +1 -1
  199. package/dist/unpkg/dev-deprecated/serializer/rest.js +10 -1
  200. package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -1
  201. package/dist/unpkg/dev-deprecated/serializer/transform.js +9 -0
  202. package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -1
  203. package/dist/unpkg/dev-deprecated/serializer.js +40 -0
  204. package/dist/unpkg/dev-deprecated/serializer.js.map +1 -1
  205. package/dist/unpkg/dev-deprecated/{store-BCOLSC6z.js → store-D4taw4YF.js} +9 -1
  206. package/dist/unpkg/dev-deprecated/store-D4taw4YF.js.map +1 -0
  207. package/dist/unpkg/dev-deprecated/store.js +1 -1
  208. package/dist/unpkg/prod/-private-DG7eJX0Y.js.map +1 -1
  209. package/dist/unpkg/prod/adapter/error.js +53 -0
  210. package/dist/unpkg/prod/adapter/error.js.map +1 -1
  211. package/dist/unpkg/prod/adapter/json-api.js +8 -1
  212. package/dist/unpkg/prod/adapter/json-api.js.map +1 -1
  213. package/dist/unpkg/prod/adapter/rest.js +20 -1
  214. package/dist/unpkg/prod/adapter/rest.js.map +1 -1
  215. package/dist/unpkg/prod/{adapter-DQ9UA7FC.js → adapter-BCGjVOaE.js} +42 -1
  216. package/dist/unpkg/prod/adapter-BCGjVOaE.js.map +1 -0
  217. package/dist/unpkg/prod/adapter.js +1 -1
  218. package/dist/unpkg/prod/compat/builders.js +10 -0
  219. package/dist/unpkg/prod/compat/builders.js.map +1 -1
  220. package/dist/unpkg/prod/compat/extensions.js +22 -0
  221. package/dist/unpkg/prod/compat/extensions.js.map +1 -1
  222. package/dist/unpkg/prod/compat/utils.js +18 -0
  223. package/dist/unpkg/prod/compat/utils.js.map +1 -1
  224. package/dist/unpkg/prod/{compat-BM3u_d5-.js → compat-DFMtpQGs.js} +57 -1
  225. package/dist/unpkg/prod/compat-DFMtpQGs.js.map +1 -0
  226. package/dist/unpkg/prod/compat.js +1 -1
  227. package/dist/unpkg/prod/{errors-BhnSZApj.js → errors-CImmK4OM.js} +3 -1
  228. package/dist/unpkg/prod/errors-CImmK4OM.js.map +1 -0
  229. package/dist/unpkg/prod/index.js +24 -5
  230. package/dist/unpkg/prod/index.js.map +1 -1
  231. package/dist/unpkg/{prod-deprecated/json-BD1kRTfB.js → prod/json-CNq5Z0Xq.js} +8 -1
  232. package/dist/unpkg/prod/json-CNq5Z0Xq.js.map +1 -0
  233. package/dist/unpkg/prod/model/-private.js +1 -1
  234. package/dist/unpkg/prod/model/migration-support.js +20 -2
  235. package/dist/unpkg/prod/model/migration-support.js.map +1 -1
  236. package/dist/unpkg/prod/{model-CDyejvo3.js → model-_HpfLmtZ.js} +14 -3
  237. package/dist/unpkg/prod/model-_HpfLmtZ.js.map +1 -0
  238. package/dist/unpkg/prod/model-fragments-ZM4k_mT3.js +356 -0
  239. package/dist/unpkg/prod/model-fragments-ZM4k_mT3.js.map +1 -0
  240. package/dist/unpkg/prod/model-fragments.js +1 -1
  241. package/dist/unpkg/prod/model.js +2 -2
  242. package/dist/unpkg/prod/{schema-provider-Co3gCBMj.js → schema-provider-DEe5vZ8b.js} +9 -2
  243. package/dist/unpkg/prod/schema-provider-DEe5vZ8b.js.map +1 -0
  244. package/dist/unpkg/prod/serializer/json-api.js +6 -1
  245. package/dist/unpkg/prod/serializer/json-api.js.map +1 -1
  246. package/dist/unpkg/prod/serializer/json.js +1 -1
  247. package/dist/unpkg/prod/serializer/rest.js +10 -1
  248. package/dist/unpkg/prod/serializer/rest.js.map +1 -1
  249. package/dist/unpkg/prod/serializer/transform.js +9 -0
  250. package/dist/unpkg/prod/serializer/transform.js.map +1 -1
  251. package/dist/unpkg/prod/serializer.js +40 -0
  252. package/dist/unpkg/prod/serializer.js.map +1 -1
  253. package/dist/unpkg/prod/{store-RGGc1ilN.js → store-ILh6zPA0.js} +9 -1
  254. package/dist/unpkg/prod/{store-RGGc1ilN.js.map → store-ILh6zPA0.js.map} +1 -1
  255. package/dist/unpkg/prod/store.js +1 -1
  256. package/dist/unpkg/prod-deprecated/-private-DG7eJX0Y.js.map +1 -1
  257. package/dist/unpkg/prod-deprecated/adapter/error.js +53 -0
  258. package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -1
  259. package/dist/unpkg/prod-deprecated/adapter/json-api.js +8 -1
  260. package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -1
  261. package/dist/unpkg/prod-deprecated/adapter/rest.js +20 -1
  262. package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -1
  263. package/dist/unpkg/prod-deprecated/{adapter-DQ9UA7FC.js → adapter-BCGjVOaE.js} +42 -1
  264. package/dist/unpkg/prod-deprecated/adapter-BCGjVOaE.js.map +1 -0
  265. package/dist/unpkg/prod-deprecated/adapter.js +1 -1
  266. package/dist/unpkg/prod-deprecated/compat/builders.js +10 -0
  267. package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -1
  268. package/dist/unpkg/prod-deprecated/compat/extensions.js +22 -0
  269. package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -1
  270. package/dist/unpkg/prod-deprecated/compat/utils.js +18 -0
  271. package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -1
  272. package/dist/unpkg/prod-deprecated/{compat-BM3u_d5-.js → compat-DFMtpQGs.js} +57 -1
  273. package/dist/unpkg/prod-deprecated/compat-DFMtpQGs.js.map +1 -0
  274. package/dist/unpkg/prod-deprecated/compat.js +1 -1
  275. package/dist/unpkg/prod-deprecated/{errors-BX8zhQS4.js → errors-DIOUcGAT.js} +3 -1
  276. package/dist/unpkg/prod-deprecated/errors-DIOUcGAT.js.map +1 -0
  277. package/dist/unpkg/prod-deprecated/index.js +24 -5
  278. package/dist/unpkg/prod-deprecated/index.js.map +1 -1
  279. package/dist/unpkg/{prod/json-BD1kRTfB.js → prod-deprecated/json-CNq5Z0Xq.js} +8 -1
  280. package/dist/unpkg/prod-deprecated/json-CNq5Z0Xq.js.map +1 -0
  281. package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
  282. package/dist/unpkg/prod-deprecated/model/migration-support.js +20 -2
  283. package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -1
  284. package/dist/unpkg/prod-deprecated/{model-fragments-DSqu0ptR.js → model-fragments-ZM4k_mT3.js} +23 -1
  285. package/dist/unpkg/prod-deprecated/model-fragments-ZM4k_mT3.js.map +1 -0
  286. package/dist/unpkg/prod-deprecated/model-fragments.js +1 -1
  287. package/dist/unpkg/prod-deprecated/{model-qeqVBN2l.js → model-wzHTp8Up.js} +14 -3
  288. package/dist/unpkg/prod-deprecated/model-wzHTp8Up.js.map +1 -0
  289. package/dist/unpkg/prod-deprecated/model.js +2 -2
  290. package/dist/unpkg/prod-deprecated/{schema-provider-CTLbab33.js → schema-provider-NWVqBEkW.js} +9 -2
  291. package/dist/unpkg/prod-deprecated/schema-provider-NWVqBEkW.js.map +1 -0
  292. package/dist/unpkg/prod-deprecated/serializer/json-api.js +6 -1
  293. package/dist/unpkg/prod-deprecated/serializer/json-api.js.map +1 -1
  294. package/dist/unpkg/prod-deprecated/serializer/json.js +1 -1
  295. package/dist/unpkg/prod-deprecated/serializer/rest.js +10 -1
  296. package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -1
  297. package/dist/unpkg/prod-deprecated/serializer/transform.js +9 -0
  298. package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -1
  299. package/dist/unpkg/prod-deprecated/serializer.js +40 -0
  300. package/dist/unpkg/prod-deprecated/serializer.js.map +1 -1
  301. package/dist/unpkg/prod-deprecated/{store-0L2CkYzh.js → store-CB_rVlXv.js} +9 -1
  302. package/dist/unpkg/prod-deprecated/{store-0L2CkYzh.js.map → store-CB_rVlXv.js.map} +1 -1
  303. package/dist/unpkg/prod-deprecated/store.js +1 -1
  304. package/package.json +12 -9
  305. package/dist/adapter-CARrK3-8.d.ts.map +0 -1
  306. package/dist/adapter-eYo2pIuM.js.map +0 -1
  307. package/dist/compat-BbNNmTM-.d.ts.map +0 -1
  308. package/dist/compat-DWgmYX8T.js.map +0 -1
  309. package/dist/error-CzkyXr1Q.d.ts.map +0 -1
  310. package/dist/errors-BlrR6--x.js.map +0 -1
  311. package/dist/extensions-DumNm4dA.d.ts.map +0 -1
  312. package/dist/json-BXNPTlcH.js.map +0 -1
  313. package/dist/model-62hn5_PD.d.ts.map +0 -1
  314. package/dist/model-C9l1mRs6.js.map +0 -1
  315. package/dist/model-fragments-DSqu0ptR.js.map +0 -1
  316. package/dist/rest-0NhtexIq.d.ts.map +0 -1
  317. package/dist/schema-provider-waPfuoKq.js.map +0 -1
  318. package/dist/store-C4qYzXei.js.map +0 -1
  319. package/dist/unpkg/dev/adapter-oLwyr47q.js.map +0 -1
  320. package/dist/unpkg/dev/compat-BIv7BiG_.js.map +0 -1
  321. package/dist/unpkg/dev/errors-Dv8RCLdU.js.map +0 -1
  322. package/dist/unpkg/dev/json-DDJji3V3.js.map +0 -1
  323. package/dist/unpkg/dev/model-CRYi4C3z.js.map +0 -1
  324. package/dist/unpkg/dev/model-fragments-DSqu0ptR.js.map +0 -1
  325. package/dist/unpkg/dev/schema-provider-BYjTpV6C.js.map +0 -1
  326. package/dist/unpkg/dev/store-D_V8-HQl.js.map +0 -1
  327. package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js.map +0 -1
  328. package/dist/unpkg/dev-deprecated/compat-BpJgmr75.js.map +0 -1
  329. package/dist/unpkg/dev-deprecated/errors-__7EyX3m.js.map +0 -1
  330. package/dist/unpkg/dev-deprecated/json-DDJji3V3.js.map +0 -1
  331. package/dist/unpkg/dev-deprecated/model-BYzXxf9f.js.map +0 -1
  332. package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
  333. package/dist/unpkg/dev-deprecated/schema-provider-BM9FSxvx.js.map +0 -1
  334. package/dist/unpkg/dev-deprecated/store-BCOLSC6z.js.map +0 -1
  335. package/dist/unpkg/prod/adapter-DQ9UA7FC.js.map +0 -1
  336. package/dist/unpkg/prod/compat-BM3u_d5-.js.map +0 -1
  337. package/dist/unpkg/prod/errors-BhnSZApj.js.map +0 -1
  338. package/dist/unpkg/prod/json-BD1kRTfB.js.map +0 -1
  339. package/dist/unpkg/prod/model-CDyejvo3.js.map +0 -1
  340. package/dist/unpkg/prod/model-fragments-DSqu0ptR.js +0 -334
  341. package/dist/unpkg/prod/model-fragments-DSqu0ptR.js.map +0 -1
  342. package/dist/unpkg/prod/schema-provider-Co3gCBMj.js.map +0 -1
  343. package/dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js.map +0 -1
  344. package/dist/unpkg/prod-deprecated/compat-BM3u_d5-.js.map +0 -1
  345. package/dist/unpkg/prod-deprecated/errors-BX8zhQS4.js.map +0 -1
  346. package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js.map +0 -1
  347. package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
  348. package/dist/unpkg/prod-deprecated/model-qeqVBN2l.js.map +0 -1
  349. package/dist/unpkg/prod-deprecated/schema-provider-CTLbab33.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-provider-Co3gCBMj.js","names":["recordIdentifierFor","assertPrivateStore","RecordStore","FetchManager","upgradeStore","lookupLegacySupport","rollbackAttributes","currentState","isNew","store","_join","cache","rollbackAttrs","errors","clear","cleanErrorRequests","unloadRecord","isDestroyed","isDestroying","belongsTo","prop","referenceFor","hasMany","reload","options","message","Promise","reject","Error","_reload","isReloading","identifier","promise","request","op","data","record","cacheOptions","Symbol","for","then","finally","changedAttributes","changedAttrs","serialize","serializeRecord","deleteRecord","save","_save","isDeleted","resolve","saveRecord","destroyRecord","_destroyRecord","_","createSnapshot","_fetchManager","cacheFor","Context","notifyInternalSignal","peekInternalSignal","withSignalStore","LEGACY_SUPPORT","notifyChanges","identifier","value","key","record","store","notifyAttribute","eachAttribute","name","meta","constructor","relationshipsByName","get","notifyRelationship","eachRelationship","kind","notifyPropertyChange","support","manyArray","_manyArrayCache","hasPromise","_relationshipPromisesCache","signal","options","async","currentValue","cache","getAttr","storeFor","defineSignal","gate","memoized","notifyInternalSignal","peekInternalSignal","withSignalStore","recordIdentifierFor","n","SOURCE_POINTER_REGEXP","SOURCE_POINTER_PRIMARY_REGEXP","PRIMARY_ATTRIBUTE_KEY","isInvalidError","error","Error","isAdapterError","code","RecordState","constructor","record","store","identity","identifier","cache","pendingCount","fulfilledCount","rejectedCount","_errorRequests","_lastError","requests","getRequestStateService","notifications","handleRequest","req","type","state","isSaving","response","data","push","notifyErrorsStateChanged","notify","subscribeForRecord","lastRequest","getLastRequestForRecord","handler","subscribe","key","updateInvalidErrors","errors","destroy","unsubscribe","signals","signal","jsonApiErrors","getErrors","clear","i","length","source","pointer","keyMatch","match","search","errMsg","detail","title","add","cleanErrorRequests","isLoading","isLoaded","prototype","isNew","isEmpty","isSaved","rd","isDeleted","isDeletionCommitted","isValid","isDirty","hasChangedAttrs","isError","errorReq","adapterError","request","isPreloaded","stateName","dirtyType","EmberObject","recordIdentifierFor","storeFor","defineGate","entangleSignal","gate","memoized","withSignalStore","assertPrivateStore","coerceId","RecordStore","Errors","releaseLegacySupport","_destroyRecord","_reload","_save","belongsTo","changedAttributes","createSnapshot","deleteRecord","destroyRecord","hasMany","reload","rollbackAttributes","save","serialize","unloadRecord","notifyChanges","RecordState","n","computeOnce","target","propertyName","desc","cache","WeakMap","getter","get","meta","hasComputed","value","undefined","set","call","Model","init","options","createProps","_createProps","_secretInit","store","identity","identifier","cb","___recordState","setProperties","notifications","___private_notifications","subscribe","type","field","destroy","unsubscribe","isEmpty","currentState","prototype","isLoading","isLoaded","hasDirtyAttributes","isDirty","isSaving","isDeleted","isNew","isValid","dirtyType","isError","v","id","normalizedId","didChange","_instanceCache","setRecordId","notify","toString","constructor","modelName","_v","Error","errors","create","__record","updateInvalidErrors","adapterError","notifyPropertyChange","prop","signals","attr","eachRelationship","callback","binding","relationshipFor","name","relationshipsByName","inverseFor","eachAttribute","isModel","typeForRelationship","relationship","modelFor","inverseMap","Object","inverse","_findInverseFor","schemaExists","schema","hasResource","inverseField","fields","relationships","map","Map","forEach","has","push","relationshipNames","names","eachComputedProperty","isRelationshipSchema","kind","relatedTypes","types","rels","relationshipsObject","keys","i","length","includes","key","isAttributeSchema","eachRelatedType","relationshipTypes","determineRelationshipType","knownSide","knownKey","knownKind","otherKind","attributes","transformedAttributes","eachTransformedAttribute","_createSnapshot","console","warn","_isReloading","configurable","isLocal","restoreDeprecatedModelRequestBehaviors","ModelKlass","hasKind","getOwner","Model","modelForMixin","store","normalizedModelName","owner","MaybeMixin","factoryFor","mixin","class","ModelForMixin","extend","__isMixin","__mixin","register","getOwner","_modelForMixin","normalizeModelName","ModelSchemaProvider","constructor","store","_schemas","Map","_typeMisses","Set","resourceTypes","Array","from","keys","hasTrait","type","resourceHasTrait","resource","trait","transformation","field","derivation","hashFn","has","_loadModelSchema","get","schema","registerResources","schemas","registerResource","registerTransformation","transform","registerDerivation","registerHashFn","factory","getModelFactory","Error","modelClass","class","attributeMap","attributes","Object","create","forEach","meta","name","relationships","relationshipsObject","fields","attr","values","set","rel","legacy","identity","kind","cacheFields","cacheKey","sourceKey","internalSchema","hasResource","exists","add","buildSchema","_modelFactoryCache","cache","owner","factoryFor","klass","isModel","hasOwnModelNameSet","modelName","prototype","hasOwnProperty","call","defineProperty","value"],"sources":["../../../src/model/-private/model-methods.ts","../../../src/model/-private/notify-changes.ts","../../../src/model/-private/record-state.ts","../../../src/model/-private/model.ts","../../../src/model/-private/model-for-mixin.ts","../../../src/model/-private/schema-provider.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { recordIdentifierFor } from '@warp-drive/core';\nimport { ENABLE_LEGACY_REQUEST_METHODS } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport { RecordStore } from '@warp-drive/core/types/symbols';\n\nimport type { Snapshot } from '../../compat/-private.ts';\nimport { FetchManager, upgradeStore } from '../../compat/-private.ts';\nimport type { Errors } from './errors.ts';\nimport { lookupLegacySupport } from './legacy-relationships-support.ts';\nimport type RecordState from './record-state.ts';\nimport type BelongsToReference from './references/belongs-to.ts';\nimport type HasManyReference from './references/has-many.ts';\nimport type { MaybeBelongsToFields, MaybeHasManyFields } from './type-utils.ts';\n\nexport interface MinimalLegacyRecord {\n errors: Errors;\n /** @internal */\n ___recordState: RecordState;\n currentState: RecordState;\n isDestroyed: boolean;\n isDestroying: boolean;\n isReloading: boolean;\n isValid: boolean;\n /** @internal */\n [RecordStore]: Store;\n\n deleteRecord(): void;\n unloadRecord(): void;\n save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n}\n\nexport function rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void {\n const { currentState } = this;\n const { isNew } = currentState;\n const store = this[RecordStore];\n assertPrivateStore(store);\n\n store._join(() => {\n store.cache.rollbackAttrs(recordIdentifierFor(this));\n this.errors.clear();\n currentState.cleanErrorRequests();\n if (isNew) {\n this.unloadRecord();\n }\n });\n}\n\nexport function unloadRecord<T extends MinimalLegacyRecord>(this: T): void {\n if (this.currentState.isNew && (this.isDestroyed || this.isDestroying)) {\n return;\n }\n this[RecordStore].unloadRecord(this);\n}\n\nexport function belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(\n this: T,\n prop: K\n): BelongsToReference<T, K> {\n return lookupLegacySupport(this).referenceFor('belongsTo', prop) as BelongsToReference<T, K>;\n}\n\nexport function hasMany<T extends MinimalLegacyRecord, K extends MaybeHasManyFields<T>>(\n this: T,\n prop: K\n): HasManyReference<T, K> {\n return lookupLegacySupport(this).referenceFor('hasMany', prop) as HasManyReference<T, K>;\n}\n\nexport function reload<T extends MinimalLegacyRecord>(this: T, options: Record<string, unknown> = {}): Promise<T> {\n if (!ENABLE_LEGACY_REQUEST_METHODS) {\n const message = `You cannot use reload() on a record when ENABLE_LEGACY_REQUEST_METHODS is false.`;\n assert(message, false);\n return Promise.reject(new Error(message));\n } else {\n deprecate(`record.reload is deprecated, please use store.request to initiate a request instead.`, false, {\n id: 'warp-drive:deprecate-legacy-request-methods',\n until: '6.0',\n for: '@warp-drive/core',\n url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',\n since: {\n enabled: '5.7',\n available: '5.7',\n },\n });\n\n return _reload.call(this, options) as Promise<T>;\n }\n}\n\nexport function _reload<T extends MinimalLegacyRecord>(this: T, options: Record<string, unknown> = {}): Promise<T> {\n options.isReloading = true;\n options.reload = true;\n\n const identifier = recordIdentifierFor(this);\n assert(`You cannot reload a record without an ID`, identifier.id);\n\n this.isReloading = true;\n const promise = this[RecordStore]\n .request({\n op: 'findRecord',\n data: {\n options,\n record: identifier,\n },\n cacheOptions: { [Symbol.for('wd:skip-cache')]: true },\n })\n .then(() => this)\n .finally(() => {\n this.isReloading = false;\n });\n\n return promise;\n}\n\nexport function changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash {\n return this[RecordStore].cache.changedAttrs(recordIdentifierFor(this));\n}\n\nexport function serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown {\n upgradeStore(this[RecordStore]);\n return this[RecordStore].serializeRecord(this, options);\n}\n\nexport function deleteRecord<T extends MinimalLegacyRecord>(this: T): void {\n // ensure we've populated currentState prior to deleting a new record\n if (this.currentState) {\n this[RecordStore].deleteRecord(this);\n }\n}\n\nexport function save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n if (!ENABLE_LEGACY_REQUEST_METHODS) {\n const message = `You cannot use save() on a record when ENABLE_LEGACY_REQUEST_METHODS is false.`;\n assert(message, false);\n return Promise.reject(new Error(message));\n } else {\n deprecate(`record.save is deprecated, please use store.request to initiate a request instead.`, false, {\n id: 'warp-drive:deprecate-legacy-request-methods',\n until: '6.0',\n for: '@warp-drive/core',\n url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',\n since: {\n enabled: '5.7',\n available: '5.7',\n },\n });\n\n return _save.call(this, options) as Promise<T>;\n }\n}\n\nexport function _save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n let promise: Promise<T>;\n\n if (this.currentState.isNew && this.currentState.isDeleted) {\n promise = Promise.resolve(this);\n } else {\n this.errors.clear();\n promise = this[RecordStore].saveRecord(this, options);\n }\n\n return promise;\n}\n\nexport function destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n if (!ENABLE_LEGACY_REQUEST_METHODS) {\n const message = `You cannot use destroyRecord() on a record when ENABLE_LEGACY_REQUEST_METHODS is false.`;\n assert(message, false);\n return Promise.reject(new Error(message));\n } else {\n deprecate(`record.destroyRecord is deprecated, please use store.request to initiate a request instead.`, false, {\n id: 'warp-drive:deprecate-legacy-request-methods',\n until: '6.0',\n for: '@warp-drive/core',\n url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',\n since: {\n enabled: '5.7',\n available: '5.7',\n },\n });\n\n return _destroyRecord.call(this, options) as Promise<T>;\n }\n}\n\nexport function _destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n const { isNew } = this.currentState;\n this.deleteRecord();\n if (isNew) {\n return Promise.resolve(this);\n }\n return this.save(options).then((_) => {\n this.unloadRecord();\n return this;\n });\n}\n\nexport function createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T> {\n const store = this[RecordStore];\n\n upgradeStore(store);\n if (!store._fetchManager) {\n store._fetchManager = new FetchManager(store);\n }\n\n // @ts-expect-error Typescript isn't able to curry narrowed args that are divorced from each other.\n return store._fetchManager.createSnapshot<T>(recordIdentifierFor(this));\n}\n","import { cacheFor } from '@ember/object/internals';\n\nimport type { NotificationType, Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { Context } from '@warp-drive/core/reactive/-private';\nimport { notifyInternalSignal, peekInternalSignal, withSignalStore } from '@warp-drive/core/signals/-leaked';\nimport type { PrivateReactiveResourceArray } from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { LegacyRelationshipField as RelationshipSchema } from '@warp-drive/core/types/schema/fields';\n\nimport { LEGACY_SUPPORT } from './legacy-relationships-support.ts';\nimport type { Model } from './model.ts';\n\nexport default function notifyChanges(\n identifier: ResourceKey,\n value: NotificationType,\n key: string | undefined,\n record: Model,\n store: Store\n): void {\n switch (value) {\n case 'added':\n case 'attributes':\n if (key) {\n notifyAttribute(store, identifier, key, record);\n } else {\n record.eachAttribute((name) => {\n notifyAttribute(store, identifier, name, record);\n });\n }\n break;\n\n case 'relationships':\n if (key) {\n const meta = (record.constructor as typeof Model).relationshipsByName.get(key);\n assert(`Expected to find a relationship for ${key} on ${identifier.type}`, meta);\n notifyRelationship(identifier, key, record, meta);\n } else {\n record.eachRelationship((name, meta) => {\n notifyRelationship(identifier, name, record, meta);\n });\n }\n break;\n\n case 'identity':\n notifyInternalSignal(peekInternalSignal(withSignalStore(record), 'id'));\n break;\n }\n}\n\nfunction notifyRelationship(identifier: ResourceKey, key: string, record: Model, meta: RelationshipSchema) {\n if (meta.kind === 'belongsTo') {\n record.notifyPropertyChange(key);\n } else if (meta.kind === 'hasMany') {\n const support = LEGACY_SUPPORT.get(identifier);\n const manyArray = support && support._manyArrayCache[key];\n const hasPromise = support && support._relationshipPromisesCache[key];\n\n if (manyArray && hasPromise) {\n // do nothing, we will notify the ManyArray directly\n // once the fetch has completed.\n return;\n }\n\n if (manyArray) {\n notifyInternalSignal((manyArray as unknown as PrivateReactiveResourceArray)[Context].signal);\n\n //We need to notifyPropertyChange in the adding case because we need to make sure\n //we fetch the newly added record in case it is unloaded\n //TODO(Igor): Consider whether we could do this only if the record state is unloaded\n assert(`Expected options to exist on relationship meta`, meta.options);\n assert(`Expected async to exist on relationship meta options`, 'async' in meta.options);\n if (meta.options.async) {\n record.notifyPropertyChange(key);\n }\n }\n }\n}\n\nfunction notifyAttribute(store: Store, identifier: ResourceKey, key: string, record: Model) {\n const currentValue = cacheFor(record, key);\n const cache = store.cache;\n if (currentValue !== cache.getAttr(identifier, key)) {\n record.notifyPropertyChange(key);\n }\n}\n","import type { NotificationType, Store } from '@warp-drive/core';\nimport { storeFor } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport {\n defineSignal,\n gate,\n memoized,\n notifyInternalSignal,\n peekInternalSignal,\n withSignalStore,\n} from '@warp-drive/core/signals/-leaked';\nimport type { RequestCacheRequestState, RequestStateService } from '@warp-drive/core/store/-private';\nimport { recordIdentifierFor } from '@warp-drive/core/store/-private';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\n\nimport type { Errors } from './errors';\nimport type { MinimalLegacyRecord } from './model-methods';\n\nconst SOURCE_POINTER_REGEXP = /^\\/?data\\/(attributes|relationships)\\/(.*)/;\nconst SOURCE_POINTER_PRIMARY_REGEXP = /^\\/?data/;\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\nfunction isInvalidError(error: unknown): error is Error & { isAdapterError: true; code: 'InvalidError' } {\n return (\n !!error &&\n error instanceof Error &&\n 'isAdapterError' in error &&\n error.isAdapterError === true &&\n 'code' in error &&\n error.code === 'InvalidError'\n );\n}\n\n/**\nHistorically WarpDrive managed a state machine\nfor each record, the localState for which\nwas reflected onto Model.\n\nThis implements the flags and stateName for backwards compat\nwith the state tree that used to be possible (listed below).\n\nstateName and dirtyType are candidates for deprecation.\n\nroot\n empty\n deleted // hidden from stateName\n preloaded // hidden from stateName\n\n loading\n empty // hidden from stateName\n preloaded // hidden from stateName\n\n loaded\n saved\n updated\n uncommitted\n invalid\n inFlight\n created\n uncommitted\n invalid\n inFlight\n\n deleted\n saved\n new // hidden from stateName\n uncommitted\n invalid\n inFlight\n\n @hideconstructor\n @private\n*/\nexport default class RecordState {\n /** @internal */\n declare private store: Store;\n /** @internal */\n declare private identifier: ResourceKey;\n /** @internal */\n declare private record: MinimalLegacyRecord;\n /** @internal */\n declare private rs: RequestStateService;\n\n /** @internal */\n declare private pendingCount: number;\n /** @internal */\n declare private fulfilledCount: number;\n /** @internal */\n declare private rejectedCount: number;\n /** @internal */\n declare private cache: Cache;\n /** @internal */\n declare private _errorRequests: RequestCacheRequestState[];\n /** @internal */\n declare private _lastError: RequestCacheRequestState | null;\n /** @internal */\n declare private handler: object;\n\n constructor(record: MinimalLegacyRecord) {\n const store = storeFor(record, false)!;\n const identity = recordIdentifierFor(record);\n\n this.identifier = identity;\n this.record = record;\n this.cache = store.cache;\n\n this.pendingCount = 0;\n this.fulfilledCount = 0;\n this.rejectedCount = 0;\n this._errorRequests = [];\n this._lastError = null;\n\n const requests = store.getRequestStateService();\n const notifications = store.notifications;\n\n const handleRequest = (req: RequestCacheRequestState) => {\n if (req.type === 'mutation') {\n switch (req.state) {\n case 'pending':\n this.isSaving = true;\n break;\n case 'rejected':\n this.isSaving = false;\n this._lastError = req;\n if (!(req.response && isInvalidError(req.response.data))) {\n this._errorRequests.push(req);\n }\n\n notifyErrorsStateChanged(this);\n break;\n case 'fulfilled':\n this._errorRequests = [];\n this._lastError = null;\n this.isSaving = false;\n this.notify('isDirty');\n notifyErrorsStateChanged(this);\n break;\n }\n } else {\n switch (req.state) {\n case 'pending':\n this.pendingCount++;\n this.notify('isLoading');\n break;\n case 'rejected':\n this.pendingCount--;\n this._lastError = req;\n if (!(req.response && isInvalidError(req.response.data))) {\n this._errorRequests.push(req);\n }\n this.notify('isLoading');\n notifyErrorsStateChanged(this);\n break;\n case 'fulfilled':\n this.pendingCount--;\n this.fulfilledCount++;\n this.notify('isLoading');\n this.notify('isDirty');\n notifyErrorsStateChanged(this);\n this._errorRequests = [];\n this._lastError = null;\n break;\n }\n }\n };\n\n requests.subscribeForRecord(identity, handleRequest);\n\n // we instantiate lazily\n // so we grab anything we don't have yet\n const lastRequest = requests.getLastRequestForRecord(identity);\n if (lastRequest) {\n handleRequest(lastRequest);\n }\n\n this.handler = notifications.subscribe(\n identity,\n (identifier: ResourceKey, type: NotificationType, key?: string) => {\n switch (type) {\n case 'state':\n this.notify('isSaved');\n this.notify('isNew');\n this.notify('isDeleted');\n this.notify('isDirty');\n break;\n case 'attributes':\n this.notify('isEmpty');\n this.notify('isDirty');\n break;\n case 'errors':\n this.updateInvalidErrors(this.record.errors);\n this.notify('isValid');\n break;\n }\n }\n );\n }\n\n /** @internal */\n destroy(): void {\n storeFor(this.record, false)!.notifications.unsubscribe(this.handler);\n }\n\n /** @internal */\n notify(key: keyof this & string): void {\n const signals = withSignalStore(this);\n const signal = peekInternalSignal(signals, key);\n if (signal) {\n notifyInternalSignal(signal);\n }\n }\n\n /** @internal */\n updateInvalidErrors(errors: Errors): void {\n assert(\n `Expected the Cache instance for ${this.identifier.lid} to implement getErrors(identifier)`,\n typeof this.cache.getErrors === 'function'\n );\n const jsonApiErrors = this.cache.getErrors(this.identifier);\n\n errors.clear();\n\n for (let i = 0; i < jsonApiErrors.length; i++) {\n const error = jsonApiErrors[i];\n\n if (error.source && error.source.pointer) {\n const keyMatch = error.source.pointer.match(SOURCE_POINTER_REGEXP);\n let key: string | undefined;\n\n if (keyMatch) {\n key = keyMatch[2];\n } else if (error.source.pointer.search(SOURCE_POINTER_PRIMARY_REGEXP) !== -1) {\n key = PRIMARY_ATTRIBUTE_KEY;\n }\n\n if (key) {\n const errMsg = error.detail || error.title;\n assert(`Expected field error to have a detail or title to use as the message`, errMsg);\n errors.add(key, errMsg);\n }\n }\n }\n }\n\n /** @internal */\n cleanErrorRequests(): void {\n this.notify('isValid');\n this.notify('isError');\n this.notify('adapterError');\n this._errorRequests = [];\n this._lastError = null;\n }\n\n declare isSaving: boolean;\n\n @gate\n get isLoading(): boolean {\n return !this.isLoaded && this.pendingCount > 0 && this.fulfilledCount === 0;\n }\n\n @gate\n get isLoaded(): boolean {\n if (this.isNew) {\n return true;\n }\n return this.fulfilledCount > 0 || !this.isEmpty;\n }\n\n @gate\n get isSaved(): boolean {\n const rd = this.cache;\n if (this.isDeleted) {\n assert(`Expected Cache to implement isDeletionCommitted()`, typeof rd.isDeletionCommitted === 'function');\n return rd.isDeletionCommitted(this.identifier);\n }\n if (this.isNew || this.isEmpty || !this.isValid || this.isDirty || this.isLoading) {\n return false;\n }\n return true;\n }\n\n @gate\n get isEmpty(): boolean {\n const rd = this.cache;\n // TODO this is not actually an RFC'd concept. Determine the\n // correct heuristic to replace this with.\n assert(`Expected Cache to implement isEmpty()`, typeof rd.isEmpty === 'function');\n return !this.isNew && rd.isEmpty(this.identifier);\n }\n\n @gate\n get isNew(): boolean {\n const rd = this.cache;\n assert(`Expected Cache to implement isNew()`, typeof rd.isNew === 'function');\n return rd.isNew(this.identifier);\n }\n\n @gate\n get isDeleted(): boolean {\n const rd = this.cache;\n assert(`Expected Cache to implement isDeleted()`, typeof rd.isDeleted === 'function');\n return rd.isDeleted(this.identifier);\n }\n\n @gate\n get isValid(): boolean {\n return this.record.errors.length === 0;\n }\n\n @gate\n get isDirty(): boolean {\n const rd = this.cache;\n if (this.isEmpty || rd.isDeletionCommitted(this.identifier) || (this.isDeleted && this.isNew)) {\n return false;\n }\n return this.isDeleted || this.isNew || rd.hasChangedAttrs(this.identifier);\n }\n\n @gate\n get isError(): boolean {\n const errorReq = this._errorRequests[this._errorRequests.length - 1];\n if (!errorReq) {\n return false;\n } else {\n return true;\n }\n }\n\n @gate\n get adapterError(): unknown {\n const request = this._lastError;\n if (!request) {\n return null;\n }\n return request.state === 'rejected' && request.response!.data;\n }\n\n @memoized\n get isPreloaded(): boolean {\n return !this.isEmpty && this.isLoading;\n }\n\n @memoized\n get stateName():\n | 'root.loading'\n | 'root.empty'\n | 'root.deleted.inFlight'\n | 'root.deleted.saved'\n | 'root.deleted.invalid'\n | 'root.deleted.uncommitted'\n | 'root.loaded.created.inFlight'\n | 'root.loaded.created.invalid'\n | 'root.loaded.created.uncommitted'\n | 'root.loaded.updated.inFlight'\n | 'root.loaded.updated.invalid'\n | 'root.loaded.updated.uncommitted'\n | 'root.loaded.saved' {\n // we might be empty while loading so check this first\n if (this.isLoading) {\n return 'root.loading';\n\n // got nothing yet or were unloaded\n } else if (this.isEmpty) {\n return 'root.empty';\n\n // deleted substates\n } else if (this.isDeleted) {\n if (this.isSaving) {\n return 'root.deleted.inFlight';\n } else if (this.isSaved) {\n // TODO ensure isSaved isn't true from previous requests\n return 'root.deleted.saved';\n } else if (!this.isValid) {\n return 'root.deleted.invalid';\n } else {\n return 'root.deleted.uncommitted';\n }\n\n // loaded.created substates\n } else if (this.isNew) {\n if (this.isSaving) {\n return 'root.loaded.created.inFlight';\n } else if (!this.isValid) {\n return 'root.loaded.created.invalid';\n }\n return 'root.loaded.created.uncommitted';\n\n // loaded.updated substates\n } else if (this.isSaving) {\n return 'root.loaded.updated.inFlight';\n } else if (!this.isValid) {\n return 'root.loaded.updated.invalid';\n } else if (this.isDirty) {\n return 'root.loaded.updated.uncommitted';\n\n // if nothing remains, we are loaded saved!\n } else {\n return 'root.loaded.saved';\n }\n }\n\n @memoized\n get dirtyType(): '' | 'deleted' | 'created' | 'updated' {\n // we might be empty while loading so check this first\n if (this.isLoading || this.isEmpty) {\n return '';\n\n // deleted substates\n } else if (this.isDirty && this.isDeleted) {\n return 'deleted';\n\n // loaded.created substates\n } else if (this.isNew) {\n return 'created';\n\n // loaded.updated substates\n } else if (this.isSaving || !this.isValid || this.isDirty) {\n return 'updated';\n\n // if nothing remains, we are loaded saved!\n } else {\n return '';\n }\n }\n}\ndefineSignal(RecordState.prototype, 'isSaving', false);\n\nfunction notifyErrorsStateChanged(state: RecordState) {\n state.notify('isValid');\n state.notify('isError');\n state.notify('adapterError');\n}\n","import { deprecate } from '@ember/debug';\nimport EmberObject from '@ember/object';\n\nimport type { NotificationType, Store } from '@warp-drive/core';\nimport { recordIdentifierFor, storeFor } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { defineGate, entangleSignal, gate, memoized, withSignalStore } from '@warp-drive/core/signals/-leaked';\nimport { assertPrivateStore, coerceId } from '@warp-drive/core/store/-private';\nimport type { ModelSchema, ResourceKey } from '@warp-drive/core/types';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core/types/schema/fields';\nimport { RecordStore } from '@warp-drive/core/types/symbols';\n\nimport type { Snapshot } from '../../compat/-private.ts';\nimport { Errors } from './errors.ts';\nimport { releaseLegacySupport } from './legacy-relationships-support.ts';\nimport type { MinimalLegacyRecord } from './model-methods.ts';\nimport {\n _destroyRecord,\n _reload,\n _save,\n belongsTo,\n changedAttributes,\n createSnapshot,\n deleteRecord,\n destroyRecord,\n hasMany,\n reload,\n rollbackAttributes,\n save,\n serialize,\n unloadRecord,\n} from './model-methods.ts';\nimport notifyChanges from './notify-changes.ts';\nimport RecordState from './record-state.ts';\nimport type BelongsToReference from './references/belongs-to.ts';\nimport type HasManyReference from './references/has-many.ts';\nimport type {\n _MaybeBelongsToFields,\n isSubClass,\n MaybeAttrFields,\n MaybeHasManyFields,\n MaybeRelationshipFields,\n} from './type-utils.ts';\n\nexport type ModelCreateArgs = {\n _createProps: Record<string, unknown>;\n // TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for\n _secretInit: {\n identifier: ResourceKey;\n store: Store;\n cb: (record: Model, identifier: ResourceKey, store: Store) => void;\n };\n};\n\nexport type StaticModel = typeof Model & { create(options: ModelCreateArgs): Model };\nexport type ModelFactory = { class: StaticModel };\nexport type FactoryCache = Record<string, ModelFactory>;\n// we put this on the store for interop because it's used by modelFor and\n// instantiateRecord as well.\nexport type ModelStore = Store & { _modelFactoryCache: FactoryCache };\n\n/*\n * This decorator allows us to lazily compute\n * an expensive getter on first-access and thereafter\n * never recompute it.\n */\nfunction computeOnce(target: object, propertyName: string, desc: PropertyDescriptor) {\n const cache = new WeakMap<object, { hasComputed: boolean; value: unknown }>();\n // oxlint-disable-next-line typescript/unbound-method\n const getter = desc.get;\n desc.get = function () {\n let meta = cache.get(this);\n\n if (!meta) {\n meta = { hasComputed: false, value: undefined };\n cache.set(this, meta);\n }\n\n if (!meta.hasComputed) {\n meta.value = (getter as () => unknown).call(this);\n meta.hasComputed = true;\n }\n\n return meta.value;\n };\n return desc;\n}\n\ninterface Model {\n // set during create by the store\n /**\n * The store service instance which created this record instance\n */\n store: Store;\n /** @internal */\n ___recordState: RecordState;\n /** @internal */\n ___private_notifications: object;\n /** @internal */\n _isReloading: boolean;\n /** @internal */\n [RecordStore]: Store;\n\n /**\n Create a JSON representation of the record, using the serialization\n strategy of the store's adapter.\n\n `serialize` takes an optional hash as a parameter, currently\n supported options are:\n\n - `includeId`: `true` if the record's ID should be included in the\n JSON representation.\n\n @public\n @param {Object} options\n @return {Object} an object whose values are primitive JSON values only\n */\n serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown;\n\n /**\n Same as `deleteRecord`, but saves the record immediately.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n delete = () => {\n this.args.model.destroyRecord().then(function() {\n this.transitionToRoute('model.index');\n });\n }\n }\n ```\n\n If you pass an object on the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot\n\n ```js\n record.destroyRecord({ adapterOptions: { subscribe: false } });\n ```\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n deleteRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @public\n @param options\n @return a promise that will be resolved when the adapter returns\n successfully or rejected if the adapter returns with an error.\n */\n destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n\n /**\n Unloads the record from the store. This will not send a delete request\n to your server, it just unloads the record from memory.\n\n @public\n */\n unloadRecord<T extends MinimalLegacyRecord>(this: T): void;\n\n /**\n Returns an object, whose keys are changed properties, and value is\n an [oldProp, newProp] array.\n\n The array represents the diff of the canonical state with the local state\n of the model. Note: if the model is created locally, the canonical state is\n empty since the adapter hasn't acknowledged the attributes yet:\n\n Example\n\n ```js [app/models/mascot.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class MascotModel extends Model {\n @attr('string') name;\n @attr('boolean', {\n defaultValue: false\n })\n isAdmin;\n }\n ```\n\n ```javascript\n let mascot = store.createRecord('mascot');\n\n mascot.changedAttributes(); // {}\n\n mascot.set('name', 'Tomster');\n mascot.changedAttributes(); // { name: [undefined, 'Tomster'] }\n\n mascot.set('isAdmin', true);\n mascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }\n\n mascot.save().then(function() {\n mascot.changedAttributes(); // {}\n\n mascot.set('isAdmin', false);\n mascot.changedAttributes(); // { isAdmin: [true, false] }\n });\n ```\n\n @public\n @return {Object} an object, whose keys are changed properties,\n and value is an [oldProp, newProp] array.\n */\n changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash;\n\n /**\n If the model `hasDirtyAttributes` this function will discard any unsaved\n changes. If the model `isNew` it will be removed from the store.\n\n Example\n\n ```javascript\n record.name; // 'Untitled Document'\n record.set('name', 'Doc 1');\n record.name; // 'Doc 1'\n record.rollbackAttributes();\n record.name; // 'Untitled Document'\n ```\n\n @since 1.13.0\n @public\n */\n rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void;\n\n // TODO @deprecate in favor of a public API or examples of how to test successfully\n /**\n @private\n */\n _createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T>;\n\n /**\n Save the record and persist any changes to the record to an\n external source via the adapter.\n\n Example\n\n ```javascript\n record.set('name', 'Tomster');\n record.save().then(function() {\n // Success callback\n }, function() {\n // Error callback\n });\n ```\n\n If you pass an object using the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot.\n\n ```js\n record.save({ adapterOptions: { subscribe: false } });\n ```\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n updateRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @deprecated use {@link Store.request} instead\n @public\n @return a promise that will be resolved when the adapter returns\n successfully or rejected if the adapter returns with an error.\n */\n save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n\n /**\n Reload the record from the adapter.\n\n This will only work if the record has already finished loading.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n async reload = () => {\n await this.args.model.reload();\n // do something with the reloaded model\n }\n }\n ```\n\n @public\n @param {Object} options optional, may include `adapterOptions` hash which will be passed to adapter request\n\n @return {Promise} a promise that will be resolved with the record when the\n adapter returns successfully or rejected if the adapter returns\n with an error.\n */\n\n reload<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;\n\n // belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(\n // this: T,\n // prop: K\n // ): BelongsToReference<T, K>;\n\n /**\n Get the reference for the specified belongsTo relationship.\n\n For instance, given the following model\n\n ```js [app/models/blog-post.js]\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class BlogPost extends Model {\n @belongsTo('user', { async: true, inverse: null }) author;\n }\n ```\n\n Then the reference for the author relationship would be\n retrieved from a record instance like so:\n\n ```js\n blogPost.belongsTo('author');\n ```\n\n A `BelongsToReference` is a low-level API that allows access\n and manipulation of a belongsTo relationship.\n\n It is especially useful when you're dealing with `async` relationships\n as it allows synchronous access to the relationship data if loaded, as\n well as APIs for loading, reloading the data or accessing available\n information without triggering a load.\n\n It may also be useful when using `sync` relationships that need to be\n loaded/reloaded with more precise timing than marking the\n relationship as `async` and relying on autofetch would have allowed.\n\n However,keep in mind that marking a relationship as `async: false` will introduce\n bugs into your application if the data is not always guaranteed to be available\n by the time the relationship is accessed. Ergo, it is recommended when using this\n approach to utilize `links` for unloaded relationship state instead of identifiers.\n\n Reference APIs are entangled with the relationship's underlying state,\n thus any getters or cached properties that utilize these will properly\n invalidate if the relationship state changes.\n\n References are \"stable\", meaning that multiple calls to retrieve the reference\n for a given relationship will always return the same HasManyReference.\n\n @public\n @param prop - the name of the relationship\n @since 2.5.0\n @return reference for this relationship\n */\n belongsTo<T extends Model, K extends keyof T & string>(\n this: T,\n prop: K & (K extends _MaybeBelongsToFields<T> ? K : never)\n ): BelongsToReference<T, K>;\n\n /**\n Get the reference for the specified hasMany relationship.\n\n For instance, given the following model\n\n ```js [app/models/blog-post.js]\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogPost extends Model {\n @hasMany('comment', { async: true, inverse: null }) comments;\n }\n ```\n\n Then the reference for the comments relationship would be\n retrieved from a record instance like so:\n\n ```js\n blogPost.hasMany('comments');\n ```\n\n A `HasManyReference` is a low-level API that allows access\n and manipulation of a hasMany relationship.\n\n It is especially useful when you are dealing with `async` relationships\n as it allows synchronous access to the relationship data if loaded, as\n well as APIs for loading, reloading the data or accessing available\n information without triggering a load.\n\n It may also be useful when using `sync` relationships with `@ember-data/model`\n that need to be loaded/reloaded with more precise timing than marking the\n relationship as `async` and relying on autofetch would have allowed.\n\n However,keep in mind that marking a relationship as `async: false` will introduce\n bugs into your application if the data is not always guaranteed to be available\n by the time the relationship is accessed. Ergo, it is recommended when using this\n approach to utilize `links` for unloaded relationship state instead of identifiers.\n\n Reference APIs are entangled with the relationship's underlying state,\n thus any getters or cached properties that utilize these will properly\n invalidate if the relationship state changes.\n\n References are \"stable\", meaning that multiple calls to retrieve the reference\n for a given relationship will always return the same HasManyReference.\n\n @public\n @param prop - the name of the relationship\n @since 2.5.0\n @return reference for this relationship\n */\n hasMany<T extends MinimalLegacyRecord, K extends MaybeHasManyFields<T>>(this: T, prop: K): HasManyReference<T, K>;\n\n /**\n Marks the record as deleted but does not save it. You must call\n `save` afterwards if you want to persist it. You might use this\n method if you want to allow the user to still `rollbackAttributes()`\n after a delete was made.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n softDelete = () => {\n this.args.model.deleteRecord();\n }\n\n confirm = () => {\n this.args.model.save();\n }\n\n undo = () => {\n this.args.model.rollbackAttributes();\n }\n }\n ```\n\n @public\n */\n deleteRecord<T extends MinimalLegacyRecord>(this: T): void;\n}\n\n/**\n * Base class from which Models can be defined.\n *\n * ::: code-group\n *\n * ```js [app/models/user.js]\n * import { Model, attr, belongsTo, hasMany } from '@warp-drive/legacy/model';\n *\n * export default class User extends Model {\n * @attr name;\n * @attr('number') age;\n * @hasMany('post', { async: true, inverse: null }) posts;\n * @belongsTo('group', { async: false, inverse: 'users' }) group;\n * }\n * ```\n *\n * ```ts [app/models/user.ts]\n * import { Model, attr, belongsTo, hasMany, type AsyncHasMany } from '@warp-drive/legacy/model';\n * import type { NumberTransform } from '@ember-data/serializer/transform';\n * import type Group from './group';\n * import type Post from './post';\n *\n * export default class User extends Model {\n * @attr declare name: string;\n *\n * @attr<NumberTransform>('number')\n * declare age: number;\n *\n * @hasMany('post', { async: true, inverse: null })\n * declare posts: AsyncHasMany<Post>;\n *\n * @belongsTo('group', { async: false, inverse: 'users' })\n * declare group: Group | null;\n * }\n * ```\n *\n * :::\n *\n * Models both define the schema for a resource type and provide\n * the class to use as the reactive object for data of resource\n * of that type.\n *\n * @public\n * @noInheritDoc\n * @hideconstructor\n * @legacy\n */\nclass Model extends EmberObject implements MinimalLegacyRecord {\n /** @internal */\n init(options: ModelCreateArgs): void {\n if (DEBUG) {\n if (!options?._secretInit && !options?._createProps) {\n throw new Error(\n 'You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'\n );\n }\n }\n const createProps = options._createProps;\n const _secretInit = options._secretInit;\n (options as Record<string, unknown>)._createProps = null;\n (options as Record<string, unknown>)._secretInit = null;\n\n const store = (this.store = _secretInit.store);\n super.init(options);\n\n this[RecordStore] = store;\n\n const identity = _secretInit.identifier;\n _secretInit.cb(this, identity, _secretInit.store);\n\n this.___recordState = DEBUG ? new RecordState(this) : (null as unknown as RecordState);\n\n this.setProperties(createProps);\n\n const notifications = store.notifications;\n this.___private_notifications = notifications.subscribe(\n identity,\n (identifier: ResourceKey, type: NotificationType, field?: string): void => {\n notifyChanges(identifier, type, field, this, store);\n }\n );\n }\n\n /** @private */\n // @ts-expect-error destroy should not return a value, but ember's types force it to\n destroy(): this {\n const identifier = recordIdentifierFor(this);\n this.___recordState?.destroy();\n const store = storeFor(this, false)!;\n store.notifications.unsubscribe(this.___private_notifications);\n\n releaseLegacySupport(identifier);\n\n super.destroy();\n }\n\n /**\n If this property is `true` the record is in the `empty`\n state. Empty is the first state all records enter after they have\n been created. Most records created by the store will quickly\n transition to the `loading` state if data needs to be fetched from\n the server or the `created` state if the record is created on the\n client. A record can also enter the empty state if the adapter is\n unable to locate the record.\n\n @public\n */\n @memoized\n get isEmpty(): boolean {\n return this.currentState.isEmpty;\n }\n\n /**\n If this property is `true` the record is in the `loading` state. A\n record enters this state when the store asks the adapter for its\n data. It remains in this state until the adapter provides the\n requested data.\n\n @public\n */\n @memoized\n get isLoading(): boolean {\n return this.currentState.isLoading;\n }\n\n /**\n If this property is `true` the record is in the `loaded` state. A\n record enters this state when its data is populated. Most of a\n record's lifecycle is spent inside substates of the `loaded`\n state.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isLoaded; // true\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n model.isLoaded;\n ```\n\n @public\n */\n @memoized\n get isLoaded(): boolean {\n return this.currentState.isLoaded;\n }\n\n /**\n If this property is `true` the record is in the `dirty` state. The\n record has local changes that have not yet been saved by the\n adapter. This includes records that have been created (but not yet\n saved) or deleted.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.hasDirtyAttributes; // true\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n\n model.hasDirtyAttributes; // false\n model.foo = 'some value';\n model.hasDirtyAttributes; // true\n ```\n\n @since 1.13.0\n @public\n */\n @memoized\n get hasDirtyAttributes(): boolean {\n return this.currentState.isDirty;\n }\n\n /**\n If this property is `true` the record is in the `saving` state. A\n record enters the saving state when `save` is called, but the\n adapter has not yet acknowledged that the changes have been\n persisted to the backend.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isSaving; // false\n let promise = record.save();\n record.isSaving; // true\n promise.then(function() {\n record.isSaving; // false\n });\n ```\n\n @public\n */\n @memoized\n get isSaving(): boolean {\n return this.currentState.isSaving;\n }\n\n /**\n If this property is `true` the record is in the `deleted` state\n and has been marked for deletion. When `isDeleted` is true and\n `hasDirtyAttributes` is true, the record is deleted locally but the deletion\n was not yet persisted. When `isSaving` is true, the change is\n in-flight. When both `hasDirtyAttributes` and `isSaving` are false, the\n change has persisted.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isDeleted; // false\n record.deleteRecord();\n\n // Locally deleted\n record.isDeleted; // true\n record.hasDirtyAttributes; // true\n record.isSaving; // false\n\n // Persisting the deletion\n let promise = record.save();\n record.isDeleted; // true\n record.isSaving; // true\n\n // Deletion Persisted\n promise.then(function() {\n record.isDeleted; // true\n record.isSaving; // false\n record.hasDirtyAttributes; // false\n });\n ```\n\n @public\n */\n @memoized\n get isDeleted(): boolean {\n return this.currentState.isDeleted;\n }\n\n /**\n If this property is `true` the record is in the `new` state. A\n record will be in the `new` state when it has been created on the\n client and the adapter has not yet report that it was successfully\n saved.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isNew; // true\n\n record.save().then(function(model) {\n model.isNew; // false\n });\n ```\n\n @public\n */\n @memoized\n get isNew(): boolean {\n return this.currentState.isNew;\n }\n\n /**\n If this property is `true` the record is in the `valid` state.\n\n A record will be in the `valid` state when the adapter did not report any\n server-side validation failures.\n\n @public\n */\n @memoized\n get isValid(): boolean {\n return this.currentState.isValid;\n }\n\n /**\n If the record is in the dirty state this property will report what\n kind of change has caused it to move into the dirty\n state. Possible values are:\n\n - `created` The record has been created by the client and not yet saved to the adapter.\n - `updated` The record has been updated by the client and not yet saved to the adapter.\n - `deleted` The record has been deleted by the client and not yet saved to the adapter.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.dirtyType; // 'created'\n ```\n\n @public\n */\n @memoized\n get dirtyType(): 'created' | 'updated' | 'deleted' | '' {\n return this.currentState.dirtyType;\n }\n\n /**\n If `true` the adapter reported that it was unable to save local\n changes to the backend for any reason other than a server-side\n validation error.\n\n Example\n\n ```javascript\n record.isError; // false\n record.set('foo', 'valid value');\n record.save().then(null, function() {\n record.isError; // true\n });\n ```\n\n @public\n */\n @memoized\n get isError(): boolean {\n return this.currentState.isError;\n }\n /**\n * `isError` is read-only and cannot be set directly.\n */\n set isError(v) {\n if (DEBUG) {\n throw new Error(`isError is not directly settable`);\n }\n }\n\n /**\n If `true` the store is attempting to reload the record from the adapter.\n\n Example\n\n ```javascript\n record.isReloading; // false\n record.reload();\n record.isReloading; // true\n ```\n\n @public\n */\n declare isReloading: boolean;\n\n /**\n All ember models have an id property. This is an identifier\n managed by an external source. These are always coerced to be\n strings before being used internally. Note when declaring the\n attributes for a model it is an error to declare an id\n attribute.\n\n ```javascript\n let record = store.createRecord('model');\n record.id; // null\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n model.id; // '1'\n ```\n\n @public\n */\n @gate\n get id(): string | null {\n // this guard exists, because some dev-only deprecation code\n // (addListener via validatePropertyInjections) invokes toString before the\n // object is real.\n if (DEBUG) {\n try {\n return recordIdentifierFor(this).id;\n } catch {\n return null;\n }\n }\n return recordIdentifierFor(this).id;\n }\n /**\n * Assigns the resource's primary key. Typically only used internally\n * when a client-created record is assigned an id upon being saved.\n */\n set id(id) {\n const normalizedId = coerceId(id);\n const identifier = recordIdentifierFor(this);\n const didChange = normalizedId !== identifier.id;\n assertPrivateStore(this.store);\n assert(\n `Cannot set ${identifier.type} record's id to ${id}, because id is already ${identifier.id}`,\n !didChange || identifier.id === null\n );\n\n if (normalizedId !== null && didChange) {\n this.store._instanceCache.setRecordId(identifier, normalizedId);\n this.store.notifications.notify(identifier, 'identity', null);\n }\n }\n\n toString() {\n return `<model::${(this.constructor as unknown as { modelName: string }).modelName}:${this.id}>`;\n }\n\n /**\n @private\n */\n // TODO we can probably make this a computeOnce\n // we likely do not need to notify the currentState root anymore\n @gate\n get currentState(): RecordState {\n // descriptors are called with the wrong `this` context during mergeMixins\n // when using legacy/classic ember classes. Basically: lazy in prod and eager in dev.\n // so we do this to try to steer folks to the nicer \"dont user currentState\"\n // error.\n if (!DEBUG) {\n if (!this.___recordState) {\n this.___recordState = new RecordState(this);\n }\n }\n return this.___recordState;\n }\n /**\n * `currentState` is read-only and cannot be set directly.\n */\n set currentState(_v) {\n throw new Error('cannot set currentState');\n }\n\n /**\n The store service instance which created this record instance\n\n @public\n */\n declare store: Store;\n\n /**\n When the record is in the `invalid` state this object will contain\n any errors returned by the adapter. When present the errors hash\n contains keys corresponding to the invalid property names\n and values which are arrays of Javascript objects with two keys:\n\n - `message` A string containing the error message from the backend\n - `attribute` The name of the property associated with this error message\n\n ```javascript\n record.errors.length; // 0\n record.set('foo', 'invalid value');\n record.save().catch(function() {\n record.errors.foo;\n // [{message: 'foo should be a number.', attribute: 'foo'}]\n });\n ```\n\n The `errors` property is useful for displaying error messages to\n the user.\n\n ```handlebars\n <label>Username: <Input @value={{@model.username}} /> </label>\n {{#each @model.errors.username as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n <label>Email: <Input @value={{@model.email}} /> </label>\n {{#each @model.errors.email as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n ```\n\n\n You can also access the special `messages` property on the error\n object to get an array of all the error strings.\n\n ```handlebars\n {{#each @model.errors.messages as |message|}}\n <div class=\"error\">\n {{message}}\n </div>\n {{/each}}\n ```\n\n @public\n */\n @computeOnce\n get errors(): Errors {\n const errors = (Errors as unknown as { create(obj: object): Errors }).create({ __record: this });\n this.currentState.updateInvalidErrors(errors);\n return errors;\n }\n\n /**\n This property holds the `AdapterError` object with which\n last adapter operation was rejected.\n\n @public\n */\n @memoized\n get adapterError(): unknown {\n return this.currentState.adapterError;\n }\n /**\n * `adapterError` is read-only and cannot be set directly.\n */\n set adapterError(v) {\n throw new Error(`adapterError is not directly settable`);\n }\n\n /*\n We hook the default implementation to ensure\n our tagged properties are properly notified\n as well. We still super for everything because\n sync observers require a direct call occuring\n to trigger their flush. We wouldn't need to\n super in 4.0+ where sync observers are removed.\n */\n // @ts-expect-error no return is necessary, but Ember's types are forcing it\n notifyPropertyChange(prop: string): this {\n const signals = withSignalStore(this);\n entangleSignal(signals, this, prop, undefined);\n super.notifyPropertyChange(prop);\n }\n\n /** @internal */\n attr(): void {\n assert(\n 'The `attr` method is not available on Model, a Snapshot was probably expected. Are you passing a Model instead of a Snapshot to your serializer?',\n false\n );\n }\n\n /**\n Given a callback, iterates over each of the relationships in the model,\n invoking the callback with the name of each relationship and its relationship\n descriptor.\n\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, descriptor);\n ```\n\n - `name` the name of the current property in the iteration\n - `descriptor` the meta object that describes this relationship\n\n The relationship descriptor argument is an object with the following properties.\n\n - **name** <span class=\"type\">String</span> the name of this relationship on the Model\n - **kind** <span class=\"type\">String</span> \"hasMany\" or \"belongsTo\"\n - **options** <span class=\"type\">Object</span> the original options hash passed when the relationship was declared\n - **parentType** <span class=\"type\">Model</span> the type of the Model that owns this relationship\n - **type** <span class=\"type\">String</span> the type name of the related Model\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```js [app/serializers/application.js]\n import JSONSerializer from '@ember-data/serializer/json';\n\n export default class ApplicationSerializer extends JSONSerializer {\n serialize(record, options) {\n let json = {};\n\n record.eachRelationship(function(name, descriptor) {\n if (descriptor.kind === 'hasMany') {\n let serializedHasManyName = name.toUpperCase() + '_IDS';\n json[serializedHasManyName] = record.get(name).map(r => r.id);\n }\n });\n\n return json;\n }\n }\n ```\n\n @public\n @param callback the callback to invoke\n @param binding the value to which the callback's `this` should be bound\n */\n eachRelationship<T>(\n callback: (this: NoInfer<T> | undefined, key: MaybeRelationshipFields<this>, meta: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n (this.constructor as typeof Model).eachRelationship<T, this>(callback, binding);\n }\n\n /**\n * Returns the relationship schema for the given relationship name, if any.\n */\n relationshipFor(name: string): LegacyRelationshipField | undefined {\n return (this.constructor as typeof Model).relationshipsByName.get(name);\n }\n\n /**\n * Returns the inverse relationship schema for the given relationship\n * name, if one exists. See {@link Model.inverseFor | the static inverseFor}.\n */\n inverseFor(name: string): LegacyRelationshipField | null {\n return (this.constructor as typeof Model).inverseFor(name, storeFor(this, false)!);\n }\n\n /**\n * Iterates over the attributes defined on this record's class, calling\n * `callback` for each one. See {@link Model.eachAttribute | the static eachAttribute}.\n *\n * @param callback the callback to invoke\n * @param binding the value to which the callback's `this` should be bound\n */\n eachAttribute<T>(\n callback: (\n this: NoInfer<T> | undefined,\n key: isSubClass<this> extends true ? MaybeAttrFields<this> : string,\n meta: LegacyAttributeField\n ) => void,\n binding?: T\n ): void {\n (this.constructor as typeof Model).eachAttribute<T, this>(callback, binding);\n }\n\n /**\n * @internal\n */\n static isModel = true;\n\n /**\n Represents the model's class name as a string. This can be used to look up the model's class name through\n `Store`'s modelFor method.\n\n `modelName` is generated for you by WarpDrive. It will be a lowercased, dasherized string.\n For example:\n\n ```javascript\n store.modelFor('post').modelName; // 'post'\n store.modelFor('blog-post').modelName; // 'blog-post'\n ```\n\n The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload\n keys to underscore (instead of dasherized), you might use the following code:\n\n ```javascript\n import RESTSerializer from '@ember-data/serializer/rest';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default const PostSerializer = RESTSerializer.extend({\n payloadKeyFromModelName(modelName) {\n return underscore(modelName);\n }\n });\n ```\n\n @public\n */\n static modelName: string = null as unknown as string;\n\n /*\n These class methods below provide relationship\n introspection abilities about relationships.\n\n A note about the computed properties contained here:\n\n **These properties are effectively sealed once called for the first time.**\n To avoid repeatedly doing expensive iteration over a model's fields, these\n values are computed once and then cached for the remainder of the runtime of\n your application.\n\n If your application needs to modify a class after its initial definition\n (for example, using `reopen()` to add additional attributes), make sure you\n do it before using your model with the store, which uses these properties\n extensively.\n */\n\n /**\n For a given relationship name, returns the model type of the relationship.\n\n For example, if you define a model like this:\n\n ```js [app/models/post.js]\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @hasMany('comment') comments;\n }\n ```\n\n Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.\n\n @public\n @param name the name of the relationship\n @param store an instance of Store\n @return the type of the relationship, or undefined\n */\n static typeForRelationship(name: string, store: Store): ModelSchema | undefined {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationship = this.relationshipsByName.get(name);\n return relationship && store.modelFor(relationship.type);\n }\n\n /**\n * A cache of resolved inverse relationships by name, populated lazily by\n * {@link Model.inverseFor | inverseFor}.\n */\n @computeOnce\n static get inverseMap(): Record<string, LegacyRelationshipField | null> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n return Object.create(null) as Record<string, LegacyRelationshipField | null>;\n }\n\n /**\n Find the relationship which is the inverse of the one asked for.\n\n For example, if you define models like this:\n\n ```js [app/models/post.js]\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @hasMany('message') comments;\n }\n ```\n\n ```js [app/models/message.js]\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class MessageModel extends Model {\n @belongsTo('post') owner;\n }\n ```\n\n ``` js\n store.modelFor('post').inverseFor('comments', store) // { type: 'message', name: 'owner', kind: 'belongsTo' }\n store.modelFor('message').inverseFor('owner', store) // { type: 'post', name: 'comments', kind: 'hasMany' }\n ```\n\n @public\n @param name the name of the relationship\n @param store\n @return the inverse relationship, or null\n */\n static inverseFor(name: string, store: Store): LegacyRelationshipField | null {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const inverseMap = this.inverseMap;\n if (inverseMap[name]) {\n return inverseMap[name];\n } else {\n const inverse = this._findInverseFor(name, store);\n inverseMap[name] = inverse;\n return inverse;\n }\n }\n\n /**\n * @private\n */\n //Calculate the inverse, ignoring the cache\n static _findInverseFor(name: string, store: Store): LegacyRelationshipField | null {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationship = this.relationshipsByName.get(name)!;\n assert(`No relationship named '${name}' on '${this.modelName}' exists.`, relationship);\n\n if (!relationship) {\n return null;\n }\n\n const { options } = relationship;\n assert(\n `Expected the relationship ${name} on ${this.modelName} to define an inverse.`,\n options.inverse === null || (typeof options.inverse === 'string' && options.inverse.length > 0)\n );\n\n if (options.inverse === null) {\n return null;\n }\n\n const schemaExists = store.schema.hasResource(relationship);\n\n assert(\n `No associated schema found for '${relationship.type}' while calculating the inverse of ${name} on ${this.modelName}`,\n schemaExists\n );\n\n if (!schemaExists) {\n return null;\n }\n\n const inverseField = store.schema.fields(relationship).get(options.inverse);\n assert(\n `No inverse relationship found for '${name}' on '${this.modelName}'`,\n inverseField && (inverseField.kind === 'belongsTo' || inverseField.kind === 'hasMany')\n );\n\n return inverseField || null;\n }\n\n /**\n The model's relationships as a map, keyed on the type of the\n relationship. The value of each entry is an array containing a descriptor\n for each relationship with that type, describing the name of the relationship\n as well as the type.\n\n For example, given the following model definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n @hasMany('post') posts;\n }\n ```\n\n This computed property would return a map describing these\n relationships, like this:\n\n ```javascript\n import Blog from 'app/models/blog';\n import User from 'app/models/user';\n import Post from 'app/models/post';\n\n let relationships = Blog.relationships;\n relationships.user;\n //=> [ { name: 'users', kind: 'hasMany' },\n // { name: 'owner', kind: 'belongsTo' } ]\n relationships.post;\n //=> [ { name: 'posts', kind: 'hasMany' } ]\n ```\n\n @public\n */\n @computeOnce\n static get relationships(): Map<string, LegacyRelationshipField[]> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, LegacyRelationshipField[]>();\n const relationshipsByName = this.relationshipsByName;\n\n // Loop through each computed property on the class\n relationshipsByName.forEach((desc) => {\n const { type } = desc;\n\n if (!map.has(type)) {\n map.set(type, []);\n }\n\n map.get(type)!.push(desc);\n });\n\n return map;\n }\n\n /**\n A hash containing lists of the model's relationships, grouped\n by the relationship kind. For example, given a model with this\n definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relationshipNames = Blog.relationshipNames;\n relationshipNames.hasMany;\n //=> ['users', 'posts']\n relationshipNames.belongsTo;\n //=> ['owner']\n ```\n\n @public\n */\n @computeOnce\n static get relationshipNames(): {\n /**\n * the names of the model's `hasMany` relationships\n */\n hasMany: string[];\n /**\n * the names of the model's `belongsTo` relationships\n */\n belongsTo: string[];\n } {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const names: { hasMany: string[]; belongsTo: string[] } = {\n hasMany: [],\n belongsTo: [],\n };\n\n this.eachComputedProperty((name, meta) => {\n if (isRelationshipSchema(meta)) {\n names[meta.kind].push(name);\n }\n });\n\n return names;\n }\n\n /**\n An array of types directly related to a model. Each type will be\n included once, regardless of the number of relationships it has with\n the model.\n\n For example, given a model with this definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relatedTypes = Blog.relatedTypes');\n //=> ['user', 'post']\n ```\n\n @public\n */\n @computeOnce\n static get relatedTypes(): string[] {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const types: string[] = [];\n\n const rels = this.relationshipsObject;\n const relationships = Object.keys(rels);\n\n // create an array of the unique types involved\n // in relationships\n for (let i = 0; i < relationships.length; i++) {\n const name = relationships[i];\n const meta = rels[name];\n const modelName = meta.type;\n\n if (!types.includes(modelName)) {\n types.push(modelName);\n }\n }\n\n return types;\n }\n\n /**\n A map whose keys are the relationships of a model and whose values are\n relationship descriptors.\n\n For example, given a model with this\n definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relationshipsByName = Blog.relationshipsByName;\n relationshipsByName.users;\n //=> { name: 'users', kind: 'hasMany', type: 'user', options: Object }\n relationshipsByName.owner;\n //=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }\n ```\n\n @public\n */\n @computeOnce\n static get relationshipsByName(): Map<string, LegacyRelationshipField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const map = new Map();\n const rels = this.relationshipsObject;\n const relationships = Object.keys(rels);\n\n for (let i = 0; i < relationships.length; i++) {\n const name = relationships[i];\n const value = rels[name];\n\n map.set(value.name, value);\n }\n\n return map;\n }\n\n /**\n * A hash of the model's relationship schemas keyed by relationship name.\n * See also {@link Model.relationshipsByName | relationshipsByName}, which\n * provides the same information as a `Map`.\n */\n @computeOnce\n static get relationshipsObject(): Record<string, LegacyRelationshipField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationships = Object.create(null) as Record<string, LegacyRelationshipField>;\n const modelName = this.modelName;\n this.eachComputedProperty((name: string, meta: unknown) => {\n if (!isRelationshipSchema(meta)) {\n return;\n }\n // TODO deprecate key being here\n (meta as unknown as { key: string }).key = name;\n meta.name = name;\n relationships[name] = meta;\n\n assert(`Expected options in meta`, meta.options && typeof meta.options === 'object');\n assert(\n `You should not specify both options.as and options.inverse as null on ${modelName}.${meta.name}, as if there is no inverse field there is no abstract type to conform to. You may have intended for this relationship to be polymorphic, or you may have mistakenly set inverse to null.`,\n !(meta.options.inverse === null && meta.options.as?.length)\n );\n });\n return relationships;\n }\n\n /**\n A map whose keys are the fields of the model and whose values are strings\n describing the kind of the field. A model's fields are the union of all of its\n attributes and relationships.\n\n For example:\n\n ```js [app/models/blog.js]\n import { Model, attr, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n\n @attr('string') title;\n }\n ```\n\n ```js\n import Blog from 'app/models/blog'\n\n let fields = Blog.fields;\n fields.forEach(function(kind, field) {\n // do thing\n });\n\n // prints:\n // users, hasMany\n // owner, belongsTo\n // posts, hasMany\n // title, attribute\n ```\n\n @public\n */\n @computeOnce\n static get fields(): Map<string, 'attribute' | 'belongsTo' | 'hasMany'> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const map = new Map();\n\n this.eachComputedProperty((name, meta) => {\n if (isRelationshipSchema(meta)) {\n map.set(name, meta.kind);\n } else if (isAttributeSchema(meta)) {\n map.set(name, 'attribute');\n }\n });\n\n return map;\n }\n\n /**\n Given a callback, iterates over each of the relationships in the model,\n invoking the callback with the name of each relationship and its relationship\n descriptor.\n\n @public\n @param callback the callback to invoke\n @param binding the value to which the callback's `this` should be bound\n */\n static eachRelationship<T, Schema extends Model>(\n callback: (\n this: T | undefined,\n key: MaybeRelationshipFields<Schema>,\n relationship: LegacyRelationshipField\n ) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.relationshipsByName.forEach((relationship, name) => {\n callback.call(binding, name as MaybeRelationshipFields<Schema>, relationship);\n });\n }\n\n /**\n Given a callback, iterates over each of the types related to a model,\n invoking the callback with the related type's class. Each type will be\n returned just once, regardless of how many different relationships it has\n with a model.\n\n @public\n @param callback the callback to invoke\n @param binding the value to which the callback's `this` should be bound\n */\n static eachRelatedType<T>(callback: (this: T | undefined, type: string) => void, binding?: T): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationshipTypes = this.relatedTypes;\n\n for (let i = 0; i < relationshipTypes.length; i++) {\n const type = relationshipTypes[i];\n callback.call(binding, type);\n }\n }\n\n /**\n *\n * @private\n * @deprecated\n */\n static determineRelationshipType(\n knownSide: LegacyRelationshipField,\n store: Store\n ): 'oneToOne' | 'oneToMany' | 'manyToOne' | 'manyToMany' | 'oneToNone' | 'manyToNone' {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const knownKey = knownSide.name;\n const knownKind = knownSide.kind;\n const inverse = this.inverseFor(knownKey, store);\n // let key;\n\n if (!inverse) {\n return knownKind === 'belongsTo' ? 'oneToNone' : 'manyToNone';\n }\n\n // key = inverse.name;\n const otherKind = inverse.kind;\n\n if (otherKind === 'belongsTo') {\n return knownKind === 'belongsTo' ? 'oneToOne' : 'manyToOne';\n } else {\n return knownKind === 'belongsTo' ? 'oneToMany' : 'manyToMany';\n }\n }\n\n /**\n A map whose keys are the attributes of the model (properties\n described by attr) and whose values are the meta object for the\n property.\n\n Example\n\n ```js [app/models/person.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PersonModel extends Model {\n @attr('string') firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n ```\n\n ```javascript\n import Person from 'app/models/person'\n\n let attributes = Person.attributes\n\n attributes.forEach(function(meta, name) {\n // do thing\n });\n\n // prints:\n // firstName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"firstName\"}\n // lastName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"lastName\"}\n // birthday {type: \"date\", kind: 'attribute', options: Object, parentType: function, name: \"birthday\"}\n ```\n\n @public\n */\n @computeOnce\n static get attributes(): Map<string, LegacyAttributeField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, LegacyAttributeField>();\n\n this.eachComputedProperty((name, meta) => {\n if (isAttributeSchema(meta)) {\n assert(\n \"You may not set 'id' as an attribute on your model. Please remove any lines that look like: `id: attr('<type>')` from \" +\n this.toString(),\n name !== 'id'\n );\n\n // TODO deprecate key being here\n (meta as unknown as { key: string }).key = name;\n meta.name = name;\n map.set(name, meta);\n }\n });\n\n return map;\n }\n\n /**\n A map whose keys are the attributes of the model (properties\n described by attr) and whose values are type of transformation\n applied to each attribute. This map does not include any\n attributes that do not have an transformation type.\n\n Example\n\n ```js [app/models/person.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PersonModel extends Model {\n @attr firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n ```\n\n ```javascript\n import Person from 'app/models/person';\n\n let transformedAttributes = Person.transformedAttributes\n\n transformedAttributes.forEach(function(field, type) {\n // do thing\n });\n\n // prints:\n // lastName string\n // birthday date\n ```\n\n @public\n */\n @computeOnce\n static get transformedAttributes(): Map<string, string> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, string>();\n\n this.eachAttribute((name: string, meta: LegacyAttributeField) => {\n if (meta.type) {\n map.set(name, meta.type);\n }\n });\n\n return map;\n }\n\n /**\n Iterates through the attributes of the model, calling the passed function on each\n attribute.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, meta);\n ```\n\n - `name` the name of the current property in the iteration\n - `meta` the meta object for the attribute property in the iteration\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```javascript\n import { Model, attr } from '@warp-drive/legacy/model';\n\n class PersonModel extends Model {\n @attr('string') firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n\n PersonModel.eachAttribute(function(name, meta) {\n // do thing\n });\n\n // prints:\n // firstName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"firstName\"}\n // lastName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"lastName\"}\n // birthday {type: \"date\", kind: 'attribute', options: Object, parentType: function, name: \"birthday\"}\n ```\n\n @public\n @param callback The callback to execute\n @param binding [optional] the value to which the callback's `this` should be bound\n */\n static eachAttribute<T, Schema extends Model>(\n callback: (this: T | undefined, key: MaybeAttrFields<Schema>, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.attributes.forEach((meta, name) => {\n callback.call(binding, name as MaybeAttrFields<Schema>, meta);\n });\n }\n\n /**\n Iterates through the transformedAttributes of the model, calling\n the passed function on each attribute. Note the callback will not be\n called for any attributes that do not have an transformation type.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, type);\n ```\n\n - `name` the name of the current property in the iteration\n - `type` a string containing the name of the type of transformed\n applied to the attribute\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```javascript\n import { Model, attr } from '@warp-drive/legacy/model';\n\n let Person = Model.extend({\n firstName: attr(),\n lastName: attr('string'),\n birthday: attr('date')\n });\n\n Person.eachTransformedAttribute(function(name, type) {\n // do thing\n });\n\n // prints:\n // lastName string\n // birthday date\n ```\n\n @public\n @param callback The callback to execute\n @param binding [optional] the value to which the callback's `this` should be bound\n */\n static eachTransformedAttribute<T, Schema extends Model>(\n callback: (this: T | undefined, key: Exclude<keyof Schema & string, keyof Model & string>, type: string) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.transformedAttributes.forEach((type: string, name) => {\n callback.call(binding, name as Exclude<keyof Schema & string, keyof Model & string>, type);\n });\n }\n\n /**\n Returns the name of the model class.\n\n @public\n */\n static toString() {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n return `model:${this.modelName}`;\n }\n}\n\n// @ts-expect-error TS doesn't know how to do `this` function overloads\nModel.prototype.save = save;\n// @ts-expect-error TS doesn't know how to do `this` function overloads\nModel.prototype.destroyRecord = destroyRecord;\nModel.prototype.unloadRecord = unloadRecord;\nModel.prototype.hasMany = hasMany;\nModel.prototype.belongsTo = belongsTo;\nModel.prototype.serialize = serialize;\nModel.prototype._createSnapshot = createSnapshot;\nModel.prototype.deleteRecord = deleteRecord;\nModel.prototype.changedAttributes = changedAttributes;\nModel.prototype.rollbackAttributes = rollbackAttributes;\nModel.prototype.reload = reload;\n\ndefineGate(Model.prototype, 'isReloading', {\n get(this: Model): boolean {\n deprecate(\n `record.isReloading is deprecated, please use store.request and either <Request> or getRequuestState to keep track of the request state instead.`,\n false,\n {\n id: 'warp-drive:deprecate-legacy-request-methods',\n until: '6.0',\n for: '@warp-drive/core',\n url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',\n since: {\n enabled: '5.7',\n available: '5.7',\n },\n }\n );\n return this._isReloading ?? false;\n },\n set(this: Model, v: boolean) {\n this._isReloading = v;\n },\n configurable: true,\n // @ts-expect-error specially handled prop\n isLocal: true,\n});\n\n/**\n * Restores the pre-`RequestManager` implementations of `save`,\n * `destroyRecord`, and `reload` onto the given `Model` subclass, for\n * apps that have not yet migrated off of the deprecated\n * `ENABLE_LEGACY_REQUEST_METHODS` behaviors.\n */\nexport function restoreDeprecatedModelRequestBehaviors(ModelKlass: typeof Model): void {\n // @ts-expect-error TS doesn't know how to do `this` function overloads\n ModelKlass.prototype.save = _save;\n // @ts-expect-error TS doesn't know how to do `this` function overloads\n ModelKlass.prototype.destroyRecord = _destroyRecord;\n ModelKlass.prototype.reload = _reload;\n\n defineGate(Model.prototype, 'isReloading', {\n get(this: Model): boolean {\n return this._isReloading ?? false;\n },\n set(this: Model, v: boolean) {\n this._isReloading = v;\n },\n // @ts-expect-error specially handled prop\n isLocal: true,\n });\n}\n\n// this is required to prevent `init` from passing\n// the values initialized during create to `setUnknownProperty`\n(Model.prototype as unknown as { _createProps: null })._createProps = null;\n(Model.prototype as unknown as { _secretInit: null })._secretInit = null;\n\nif (DEBUG) {\n const lookupDescriptor = function lookupDescriptor(obj: object, keyName: string) {\n let current: object = obj;\n do {\n const descriptor = Object.getOwnPropertyDescriptor(current, keyName);\n if (descriptor !== undefined) {\n return descriptor;\n }\n current = Object.getPrototypeOf(current) as object;\n } while (current !== null);\n return null;\n };\n\n // oxlint-disable-next-line typescript/unbound-method\n const init = Model.prototype.init;\n Model.prototype.init = function (createArgs: ModelCreateArgs) {\n init.call(this, createArgs);\n\n const ourDescriptor = lookupDescriptor(Model.prototype, 'currentState');\n const theirDescriptor = lookupDescriptor(this, 'currentState');\n\n if (!ourDescriptor || !theirDescriptor) {\n throw new Error(\n `Unable to determine if 'currentState' is a reserved property name on instances of classes extending Model. Please ensure that 'currentState' is not defined as a property on ${this.constructor.toString()}`\n );\n }\n\n const realState = this.___recordState;\n if (ourDescriptor.get !== theirDescriptor.get || realState !== this.currentState) {\n throw new Error(\n `'currentState' is a reserved property name on instances of classes extending Model. Please choose a different property name for ${this.constructor.toString()}`\n );\n }\n\n const ID_DESCRIPTOR = lookupDescriptor(Model.prototype, 'id');\n const idDesc = lookupDescriptor(this, 'id');\n\n if (!ID_DESCRIPTOR || !idDesc) {\n throw new Error(\n `Unable to determine if 'id' is a reserved property name on instances of classes extending Model. Please ensure that 'id' is not defined as a property on ${this.constructor.toString()}`\n );\n }\n\n if (idDesc.get !== ID_DESCRIPTOR.get) {\n throw new Error(\n `You may not set 'id' as an attribute on your model. Please remove any lines that look like: \\`id: attr('<type>')\\` from ${this.constructor.toString()}`\n );\n }\n };\n\n delete (Model as unknown as { reopen: unknown }).reopen;\n delete (Model as unknown as { reopenClass: unknown }).reopenClass;\n}\n\nexport { Model };\n\nfunction isRelationshipSchema(meta: unknown): meta is LegacyRelationshipField {\n const hasKind = typeof meta === 'object' && meta !== null && 'kind' in meta && 'options' in meta;\n return hasKind && (meta.kind === 'hasMany' || meta.kind === 'belongsTo');\n}\n\nfunction isAttributeSchema(meta: unknown): meta is LegacyAttributeField {\n return typeof meta === 'object' && meta !== null && 'kind' in meta && meta.kind === 'attribute';\n}\n","import { getOwner } from '@ember/application';\n\nimport type { Store } from '@warp-drive/core';\n\nimport { Model, type ModelFactory } from './model';\n\n/*\n In case someone defined a relationship to a mixin, for example:\n ```ts\n class CommentModel extends Model {\n @belongsTo('commentable', { polymorphic: true }) owner;\n }\n\n let Commentable = Mixin.create({\n @hasMany('comment') comments;\n });\n ```\n we want to look up a Commentable class which has all the necessary\n relationship meta data. Thus, we look up the mixin and create a mock\n Model, so we can access the relationship CPs of the mixin (`comments`)\n in this case\n */\nexport default function modelForMixin(store: Store, normalizedModelName: string): ModelFactory | undefined {\n const owner = getOwner(store)!;\n const MaybeMixin = owner.factoryFor(`mixin:${normalizedModelName}`);\n const mixin = MaybeMixin && MaybeMixin.class;\n if (mixin) {\n const ModelForMixin = Model.extend(mixin) as unknown as { __isMixin: boolean; __mixin: typeof mixin };\n ModelForMixin.__isMixin = true;\n ModelForMixin.__mixin = mixin;\n //Cache the class as a model\n owner.register(`model:${normalizedModelName}`, ModelForMixin);\n }\n return owner.factoryFor(`model:${normalizedModelName}`) as ModelFactory | undefined;\n}\n","import { getOwner } from '@ember/application';\nimport { deprecate } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { SchemaService } from '@warp-drive/core/types';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { ObjectValue } from '@warp-drive/core/types/json/raw';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core/types/schema/concepts';\nimport type {\n ArrayField,\n CacheableFieldSchema,\n DerivedField,\n GenericField,\n HashField,\n IdentityField,\n LegacyAttributeField,\n LegacyField,\n LegacyRelationshipField,\n ObjectField,\n ObjectSchema,\n ResourceSchema,\n} from '@warp-drive/core/types/schema/fields';\n\nimport _modelForMixin from './model-for-mixin.ts';\nimport type { FactoryCache, ModelFactory, ModelStore } from './model.ts';\nimport { normalizeModelName } from './util.ts';\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\ntype InternalSchema = {\n schema: ResourceSchema;\n fields: Map<string, LegacyAttributeField | LegacyRelationshipField>;\n cacheFields: Map<string, Exclude<CacheableFieldSchema, IdentityField>>;\n attributes: Record<string, LegacyAttributeField>;\n relationships: Record<string, LegacyRelationshipField>;\n};\n\nexport interface ModelSchemaProvider {\n attributesDefinitionFor(resource: ResourceKey | { type: string }): AttributesSchema;\n\n relationshipsDefinitionFor(resource: ResourceKey | { type: string }): RelationshipsSchema;\n\n doesTypeExist(type: string): boolean;\n}\nexport class ModelSchemaProvider implements SchemaService {\n /** @internal */\n declare private store: ModelStore;\n /** @internal */\n declare private _schemas: Map<string, InternalSchema>;\n /** @internal */\n declare private _typeMisses: Set<string>;\n\n constructor(store: ModelStore) {\n this.store = store;\n this._schemas = new Map();\n this._typeMisses = new Set();\n }\n\n resourceTypes(): Readonly<string[]> {\n return Array.from(this._schemas.keys());\n }\n\n hasTrait(type: string): boolean {\n assert(`hasTrait is not available with @warp-drive/legacy/model's SchemaService`);\n return false;\n }\n resourceHasTrait(resource: ResourceKey | { type: string }, trait: string): boolean {\n assert(`resourceHasTrait is not available with @warp-drive/legacy/model's SchemaService`);\n return false;\n }\n transformation(field: GenericField | ObjectField | ArrayField | { type: string }): Transformation {\n assert(`transformation is not available with @warp-drive/legacy/model's SchemaService`);\n }\n derivation(field: DerivedField | { type: string }): Derivation {\n assert(`derivation is not available with @warp-drive/legacy/model's SchemaService`);\n }\n hashFn(field: HashField | { type: string }): HashFn {\n assert(`hashFn is not available with @warp-drive/legacy/model's SchemaService`);\n }\n resource(resource: ResourceKey | { type: string }): ResourceSchema | ObjectSchema {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.schema;\n }\n registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void {\n assert(`registerResources is not available with @warp-drive/legacy/model's SchemaService`);\n }\n registerResource(schema: ResourceSchema | ObjectSchema): void {\n assert(`registerResource is not available with @warp-drive/legacy/model's SchemaService`);\n }\n registerTransformation(transform: Transformation): void {\n assert(`registerTransformation is not available with @warp-drive/legacy/model's SchemaService`);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n assert(`registerDerivation is not available with @warp-drive/legacy/model's SchemaService`);\n }\n registerHashFn(hashFn: HashFn): void {\n assert(`registerHashFn is not available with @warp-drive/legacy/model's SchemaService`);\n }\n /** @internal */\n private _loadModelSchema(type: string): InternalSchema {\n const factory = getModelFactory(this.store, type);\n\n if (!factory) {\n throw new Error(`No model was found for '${type}'`);\n }\n\n const modelClass = factory.class;\n const attributeMap = modelClass.attributes;\n\n const attributes = Object.create(null) as AttributesSchema;\n attributeMap.forEach((meta, name) => (attributes[name] = meta));\n const relationships = modelClass.relationshipsObject || null;\n const fields = new Map<string, LegacyAttributeField | LegacyRelationshipField>();\n\n for (const attr of Object.values(attributes)) {\n fields.set(attr.name, attr);\n }\n\n for (const rel of Object.values(relationships)) {\n fields.set(rel.name, rel);\n }\n\n const schema: ResourceSchema = {\n legacy: true,\n identity: { name: 'id', kind: '@id' },\n type,\n fields: Array.from(fields.values()),\n };\n\n const cacheFields = new Map<string, Exclude<CacheableFieldSchema, IdentityField>>();\n for (const field of fields.values()) {\n const cacheKey = field.sourceKey ?? field.name;\n assert(\n `The sourceKey '${field.sourceKey}' for the field '${field.name}' on '${type}' is invalid because it matches the name of an existing field`,\n !field.sourceKey || field.sourceKey === field.name || !fields.has(field.sourceKey)\n );\n cacheFields.set(cacheKey, field);\n }\n\n const internalSchema: InternalSchema = {\n schema,\n attributes,\n relationships,\n fields,\n cacheFields,\n };\n\n this._schemas.set(type, internalSchema);\n\n return internalSchema;\n }\n\n fields(resource: ResourceKey | { type: string }): Map<string, LegacyField> {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.fields;\n }\n\n cacheFields(resource: ResourceKey | { type: string }): Map<string, Exclude<CacheableFieldSchema, IdentityField>> {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.cacheFields;\n }\n\n hasResource(resource: { type: string }): boolean {\n const type = normalizeModelName(resource.type);\n\n if (this._schemas.has(type)) {\n return true;\n }\n\n if (this._typeMisses.has(type)) {\n return false;\n }\n\n const factory = getModelFactory(this.store, type);\n const exists = factory !== null;\n\n if (!exists) {\n this._typeMisses.add(type);\n return false;\n }\n\n return true;\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n ModelSchemaProvider.prototype.doesTypeExist = function (type: string): boolean {\n deprecate(`Use \\`schema.hasResource({ type })\\` instead of \\`schema.doesTypeExist(type)\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n return this.hasResource({ type });\n };\n\n ModelSchemaProvider.prototype.attributesDefinitionFor = function (\n resource: ResourceKey | { type: string }\n ): AttributesSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.attributesDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n // @ts-expect-error intentional use of internal API\n if (!this._schemas.has(type)) {\n // @ts-expect-error intentional use of internal API\n this._loadModelSchema(type);\n }\n\n // @ts-expect-error intentional use of internal API\n return this._schemas.get(type)!.attributes;\n };\n\n ModelSchemaProvider.prototype.relationshipsDefinitionFor = function (\n resource: ResourceKey | { type: string }\n ): RelationshipsSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.relationshipsDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n // @ts-expect-error intentional use of internal API\n if (!this._schemas.has(type)) {\n // @ts-expect-error intentional use of internal API\n this._loadModelSchema(type);\n }\n\n // @ts-expect-error intentional use of internal API\n return this._schemas.get(type)!.relationships;\n };\n}\n\n/**\n * The `createSchemaService` implementation for use with `Model`. Pass\n * the result of this to your store's `createSchemaService` method when\n * configuring the store to use `Model` for schema information.\n *\n * @public\n */\nexport function buildSchema(store: Store): SchemaService {\n return new ModelSchemaProvider(store as ModelStore);\n}\n\nexport function getModelFactory(store: ModelStore, type: string): ModelFactory | null {\n if (!store._modelFactoryCache) {\n store._modelFactoryCache = Object.create(null) as FactoryCache;\n }\n const cache = store._modelFactoryCache;\n let factory: ModelFactory | undefined = cache[type];\n\n if (!factory) {\n const owner = getOwner(store)!;\n factory = owner.factoryFor(`model:${type}`) as ModelFactory | undefined;\n\n if (!factory) {\n //Support looking up mixins as base types for polymorphic relationships\n factory = _modelForMixin(store, type);\n }\n\n if (!factory) {\n // we don't cache misses in case someone wants to register a missing model\n return null;\n }\n\n const klass = factory.class;\n\n if (klass.isModel) {\n const hasOwnModelNameSet = klass.modelName && Object.prototype.hasOwnProperty.call(klass, 'modelName');\n if (!hasOwnModelNameSet) {\n Object.defineProperty(klass, 'modelName', { value: type });\n }\n }\n\n cache[type] = factory;\n }\n\n return factory;\n}\n"],"mappings":";;;;;;;;;;;;;;AAqCA,SAAgBM,qBAAiE;CAC/E,MAAM,EAAEC,iBAAiB;CACzB,MAAM,EAAEC,UAAUD;CAClB,MAAME,QAAQ,KAAKP;CACnBD,mBAAmBQ,KAAK;CAExBA,MAAMC,YAAY;EAChBD,MAAME,MAAMC,cAAcZ,oBAAoB,IAAI,CAAC;EACnD,KAAKa,OAAOC,MAAM;EAClBP,aAAaQ,mBAAmB;EAChC,IAAIP,OACF,KAAKQ,aAAa;CAEtB,CAAC;AACH;AAEA,SAAgBA,eAA2D;CACzE,IAAI,KAAKT,aAAaC,UAAU,KAAKS,eAAe,KAAKC,eACvD;CAEF,KAAKhB,YAAY,CAACc,aAAa,IAAI;AACrC;AAEA,SAAgBG,UAEdC,MAC0B;CAC1B,OAAOf,oBAAoB,IAAI,CAAC,CAAC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5B,OAAO,KAAKT,SAASmB,IAAIV,IAAI,CAAC,CAAEyC;CAClC;CAEAI,YAAY3C,UAAqC;EAC/C,MAAMF,OAAOb,mBAAmBe,SAASF,IAAI;EAE7C,IAAI,KAAKT,SAASiB,IAAIR,IAAI,GACxB,OAAO;EAGT,IAAI,KAAKP,YAAYe,IAAIR,IAAI,GAC3B,OAAO;EAMT,IAAI,EAHYoB,gBAAgB,KAAK9B,OAAOU,IAC7BmB,MAAY,OAEd;GACX,KAAK1B,YAAYsD,IAAI/C,IAAI;GACzB,OAAO;EACT;EAEA,OAAO;CACT;AACF;;;;;;;;AAwEA,SAAgBgD,YAAY1D,OAA6B;CACvD,OAAO,IAAIF,oBAAoBE,KAAmB;AACpD;AAEA,SAAgB8B,gBAAgB9B,OAAmBU,MAAmC;CACpF,IAAI,CAACV,MAAM2D,oBACT3D,MAAM2D,qBAAqBvB,OAAOC,OAAO,IAAI;CAE/C,MAAMuB,QAAQ5D,MAAM2D;CACpB,IAAI9B,UAAoC+B,MAAMlD;CAE9C,IAAI,CAACmB,SAAS;EAEZA,UADclC,SAASK,KACb6D,CAAK,CAACC,WAAW,SAASpD,MAAM;EAE1C,IAAI,CAACmB,SAEHA,UAAUjC,cAAeI,OAAOU,IAAI;EAGtC,IAAI,CAACmB,SAEH,OAAO;EAGT,MAAMkC,QAAQlC,QAAQI;EAEtB,IAAI8B,MAAMC,SAER;OAAI,EADuBD,MAAMG,aAAa9B,OAAO+B,UAAUC,eAAeC,KAAKN,OAAO,WAAW,IAEnG3B,OAAOkC,eAAeP,OAAO,aAAa,EAAEQ,OAAO7D,KAAK,CAAC;EAC3D;EAGFkD,MAAMlD,QAAQmB;CAChB;CAEA,OAAOA;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter-DQ9UA7FC.js","names":["Mixin","camelize","pluralize","buildURL","modelName","id","snapshot","requestType","query","urlForFindRecord","urlForFindAll","urlForQuery","urlForQueryRecord","urlForFindMany","urlForFindHasMany","urlForFindBelongsTo","urlForCreateRecord","urlForUpdateRecord","urlForDeleteRecord","_buildURL","path","url","host","prefix","urlPrefix","pathForType","push","encodeURIComponent","unshift","urlString","join","charAt","snapshots","ids","parentURL","namespace","test","camelized","mixinProps","BuildURLMixin","create","EmberObject","s","g","i","service","inject","Adapter","prototype","store","findRecord","type","id","snapshot","findAll","neverSet","snapshotRecordArray","query","queryRecord","adapterOptions","serialize","options","serialized","createRecord","updateRecord","deleteRecord","coalesceFindRequests","_coalesceFindRequests","value","groupRecordsForFindMany","snapshots","shouldReloadRecord","shouldReloadAll","length","shouldBackgroundReloadRecord","shouldBackgroundReloadAll","BuildURLMixin"],"sources":["../../../src/adapter/-private/build-url-mixin.ts","../../../src/adapter.ts"],"sourcesContent":["import Mixin from '@ember/object/mixin';\n\nimport { camelize, pluralize } from '@warp-drive/utilities/string';\n\nimport type { Snapshot, SnapshotRecordArray } from '../../compat/-private.ts';\n// oxlint-disable-next-line no-unused-vars\nimport type { RESTAdapter } from '../rest.ts';\n\n/*\n The structure of this file is such because typing Mixins is hard. Here we've structured it in\n such a way as to maximize the type information that a consumer can utilize. There are simpler\n ways to type a mixin but we would not be able to provide the nice overload signature for buildURL\n*/\n// the interface must fully declare the function signatures that the individual functions\n// will also declare. If instead we try to keep them in sync by doing something like\n// `interface BuildURLMixin { buildURL: typeof buildURL }`\n// then an extending class overwriting one of the methods will break because typescript\n// thinks it is a switch from an instance prop (that is a method) to an instance method.\n/**\n * The methods provided by the `BuildURLMixin` mixin (see the exported\n * `BuildURLMixin` {@link Mixin} below).\n *\n * See also {@link MixtBuildURLMixin}, the interface used to type `this`\n * within these methods.\n */\nexport interface BuildURLMixin {\n /**\n * Builds a URL for a given type and optional ID.\n *\n * By default, it pluralizes the type's name (for example, 'post'\n * becomes 'posts' and 'person' becomes 'people'). To override the\n * pluralization see {@link BuildURLMixin.pathForType | pathForType}.\n *\n * If an ID is specified, it adds the ID to the path generated\n * for the type, separated by a `/`.\n *\n * This overload builds the URL for a `store.findRecord(type, id)` call.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'findRecord'\n ): string;\n /**\n * Builds the URL for a `store.findAll(type)` call.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: null,\n snapshot: SnapshotRecordArray,\n requestType: 'findAll'\n ): string;\n /**\n * Builds the URL for a `store.query(type, query)` call.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: null,\n snapshot: null,\n requestType: 'query',\n query: Record<string, unknown>\n ): string;\n /**\n * Builds the URL for a `store.queryRecord(type, query)` call.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: null,\n snapshot: null,\n requestType: 'queryRecord',\n query: Record<string, unknown>\n ): string;\n /**\n * Builds the URL for coalescing multiple `store.findRecord(type, id)`\n * records into 1 request when the adapter's `coalesceFindRequests`\n * property is `true`. The `id` and `snapshot` parameters will be\n * arrays of ids and snapshots.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string[],\n snapshot: Snapshot[],\n requestType: 'findMany'\n ): string;\n /**\n * Builds the URL for fetching an async `hasMany` relationship when a\n * URL is not provided by the server.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'findHasMany'\n ): string;\n /**\n * Builds the URL for fetching an async `belongsTo` relationship when a\n * URL is not provided by the server.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'findBelongsTo'\n ): string;\n /**\n * Builds the URL for a `record.save()` call when the record was\n * created locally using `store.createRecord()`.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string | null,\n snapshot: Snapshot,\n requestType: 'createRecord'\n ): string;\n /**\n * Builds the URL for a `record.save()` call when the record has been\n * updated locally.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'updateRecord'\n ): string;\n /**\n * Builds the URL for a `record.save()` call when the record has been\n * deleted locally.\n *\n * @public\n */\n buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'deleteRecord'\n ): string;\n /**\n * Builds a URL for a given type and ID without a specific request type.\n *\n * @public\n */\n buildURL(this: MixtBuildURLMixin, modelName: string, id: string, snapshot: Snapshot): string;\n /**\n * @private\n */\n _buildURL(this: MixtBuildURLMixin, modelName: string | null | undefined, id?: string | null): string;\n /**\n * Builds a URL for a `store.findRecord(type, id)` call.\n *\n * @public\n */\n urlForFindRecord(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string;\n /**\n * Builds a URL for a `store.findAll(type)` call.\n *\n * @public\n */\n urlForFindAll(this: MixtBuildURLMixin, modelName: string, snapshots: SnapshotRecordArray): string;\n /**\n * Builds a URL for a `store.queryRecord(type, query)` call.\n *\n * @public\n */\n urlForQueryRecord(this: MixtBuildURLMixin, query: Record<string, unknown>, modelName: string): string;\n /**\n * Builds a URL for a `store.query(type, query)` call.\n *\n * @public\n */\n urlForQuery(this: MixtBuildURLMixin, query: Record<string, unknown>, modelName: string): string;\n /**\n * Builds a URL for coalescing multiple `store.findRecord(type, id)`\n * records into 1 request when the adapter's `coalesceFindRequests`\n * property is `true`.\n *\n * @public\n */\n urlForFindMany(this: MixtBuildURLMixin, ids: string[], modelName: string, snapshots: Snapshot[]): string;\n /**\n * Builds a URL for fetching an async `hasMany` relationship when a\n * URL is not provided by the server.\n *\n * @public\n */\n urlForFindHasMany(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string;\n /**\n * Builds a URL for fetching an async `belongsTo` relationship when a\n * URL is not provided by the server.\n *\n * @public\n */\n urlForFindBelongsTo(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string;\n /**\n * Builds a URL for a `record.save()` call when the record was created\n * locally using `store.createRecord()`.\n *\n * @public\n */\n urlForCreateRecord(this: MixtBuildURLMixin, modelName: string, snapshot: Snapshot): string;\n /**\n * Builds a URL for a `record.save()` call when the record has been\n * updated locally.\n *\n * @public\n */\n urlForUpdateRecord(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string;\n /**\n * Builds a URL for a `record.save()` call when the record has been\n * deleted locally.\n *\n * @public\n */\n urlForDeleteRecord(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string;\n /**\n * @private\n */\n urlPrefix(this: MixtBuildURLMixin, path?: string | null, parentURL?: string): string;\n /**\n * Determines the pathname for a given type.\n *\n * By default, it pluralizes the type's name (for example, 'post'\n * becomes 'posts' and 'person' becomes 'people').\n *\n * @public\n */\n pathForType(this: MixtBuildURLMixin, modelName: string): string;\n}\n\n// prevents the final constructed object from needing to add\n// host and namespace which are provided by the final consuming\n// class to the prototype which can result in overwrite errors\nexport interface MixtBuildURLMixin extends BuildURLMixin {\n host: string | null;\n namespace: string | null;\n}\n\n/**\n Builds a URL for a given type and optional ID.\n\n By default, it pluralizes the type's name (for example, 'post'\n becomes 'posts' and 'person' becomes 'people'). To override the\n pluralization see [pathForType](./pathForType?anchor=pathForType).\n\n If an ID is specified, it adds the ID to the path generated\n for the type, separated by a `/`.\n\n When called by `RESTAdapter.findMany()` the `id` and `snapshot` parameters\n will be arrays of ids and snapshots.\n\n @public\n @param {String} modelName\n @param {(String|Array|Object)} id single id or array of ids or query\n @param {(Snapshot|SnapshotRecordArray)} snapshot single snapshot or array of snapshots\n @param {String} requestType\n @param {Object} query object of query parameters to send for query requests.\n @return {String} url\n */\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'findRecord'\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: null,\n snapshot: SnapshotRecordArray,\n requestType: 'findAll'\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: null,\n snapshot: null,\n requestType: 'query',\n query: Record<string, unknown>\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: null,\n snapshot: null,\n requestType: 'queryRecord',\n query: Record<string, unknown>\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string[],\n snapshot: Snapshot[],\n requestType: 'findMany'\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'findHasMany'\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'findBelongsTo'\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string | null,\n snapshot: Snapshot,\n requestType: 'createRecord'\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'updateRecord'\n): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string,\n snapshot: Snapshot,\n requestType: 'deleteRecord'\n): string;\nfunction buildURL(this: MixtBuildURLMixin, modelName: string, id: string, snapshot: Snapshot): string;\nfunction buildURL(\n this: MixtBuildURLMixin,\n modelName: string,\n id: string | string[] | Record<string, unknown> | null,\n snapshot: Snapshot | Snapshot[] | SnapshotRecordArray | null,\n requestType?:\n | 'findRecord'\n | 'findAll'\n | 'query'\n | 'queryRecord'\n | 'findMany'\n | 'findHasMany'\n | 'findBelongsTo'\n | 'createRecord'\n | 'updateRecord'\n | 'deleteRecord',\n query?: Record<string, unknown>\n): string {\n /*\n Switch statements in typescript don't currently narrow even when the function is implemented\n with overloads.\n\n We still extract this to stand alone so that we can provide nice overloads for calling signatures,\n but we will still require all of this casting (or a ridiculous number of assertsthat narrow it down\n for us).\n */\n switch (requestType) {\n case 'findRecord':\n return this.urlForFindRecord(id as string, modelName, snapshot as Snapshot);\n case 'findAll':\n return this.urlForFindAll(modelName, snapshot as SnapshotRecordArray);\n case 'query':\n return this.urlForQuery(query || {}, modelName);\n case 'queryRecord':\n return this.urlForQueryRecord(query || {}, modelName);\n case 'findMany':\n return this.urlForFindMany(id as string[], modelName, snapshot as Snapshot[]);\n case 'findHasMany':\n return this.urlForFindHasMany(id as string, modelName, snapshot as Snapshot);\n case 'findBelongsTo':\n return this.urlForFindBelongsTo(id as string, modelName, snapshot as Snapshot);\n case 'createRecord':\n return this.urlForCreateRecord(modelName, snapshot as Snapshot);\n case 'updateRecord':\n return this.urlForUpdateRecord(id as string, modelName, snapshot as Snapshot);\n case 'deleteRecord':\n return this.urlForDeleteRecord(id as string, modelName, snapshot as Snapshot);\n default:\n // this is the 'never' case but someone may call `buildURL` manually so\n // we try to do something for them.\n return this._buildURL(modelName, id as string | null);\n }\n}\n\n/**\n @private\n @param {String} modelName\n @param {String} id\n @return {String} url\n */\nfunction _buildURL(this: MixtBuildURLMixin, modelName: string | null | undefined, id?: string | null): string {\n let path: string;\n const url: string[] = [];\n const { host } = this;\n const prefix = this.urlPrefix();\n\n if (modelName) {\n path = this.pathForType(modelName);\n if (path) {\n url.push(path);\n }\n }\n\n if (id) {\n url.push(encodeURIComponent(id));\n }\n if (prefix) {\n url.unshift(prefix);\n }\n\n let urlString = url.join('/');\n if (!host && urlString && urlString.charAt(0) !== '/') {\n urlString = '/' + urlString;\n }\n\n return urlString;\n}\n\n/**\n Builds a URL for a `store.findRecord(type, id)` call.\n\n Example:\n\n ```js [app/adapters/user.js]\n import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';\n\n export default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindRecord(id, modelName, snapshot) {\n let baseUrl = this.buildURL(modelName, id, snapshot);\n return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n }\n }\n ```\n\n @public\n @param {String} id\n @param {String} modelName\n @param {Snapshot} snapshot\n @return {String} url\n\n */\nfunction urlForFindRecord(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string {\n return this._buildURL(modelName, id);\n}\n\n/**\n Builds a URL for a `store.findAll(type)` call.\n\n Example:\n\n ```js [app/adapters/comment.js]\n import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';\n\n export default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindAll(modelName, snapshot) {\n let baseUrl = this.buildURL(modelName);\n return `${baseUrl}/data/comments.json`;\n }\n }\n ```\n\n @public\n @param {String} modelName\n @param {SnapshotRecordArray} snapshot\n @return {String} url\n */\nfunction urlForFindAll(this: MixtBuildURLMixin, modelName: string, snapshots: SnapshotRecordArray): string {\n return this._buildURL(modelName);\n}\n\n/**\n Builds a URL for a `store.query(type, query)` call.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n host = 'https://api.github.com';\n urlForQuery (query, modelName) {\n switch(modelName) {\n case 'repo':\n return `https://api.github.com/orgs/${query.orgId}/repos`;\n default:\n return super.urlForQuery(...arguments);\n }\n }\n }\n ```\n\n @public\n @param {Object} query\n @param {String} modelName\n @return {String} url\n */\nfunction urlForQuery(this: MixtBuildURLMixin, query: Record<string, unknown>, modelName: string): string {\n return this._buildURL(modelName);\n}\n\n/**\n Builds a URL for a `store.queryRecord(type, query)` call.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n urlForQueryRecord({ slug }, modelName) {\n let baseUrl = this.buildURL();\n return `${baseUrl}/${encodeURIComponent(slug)}`;\n }\n }\n ```\n\n @public\n @param {Object} query\n @param {String} modelName\n @return {String} url\n */\nfunction urlForQueryRecord(this: MixtBuildURLMixin, query: Record<string, unknown>, modelName: string): string {\n return this._buildURL(modelName);\n}\n\n/**\n Builds a URL for coalescing multiple `store.findRecord(type, id)`\n records into 1 request when the adapter's `coalesceFindRequests`\n property is `true`.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n urlForFindMany(ids, modelName) {\n let baseUrl = this.buildURL();\n return `${baseUrl}/coalesce`;\n }\n }\n ```\n\n @public\n @param {Array} ids\n @param {String} modelName\n @param {Array} snapshots\n @return {String} url\n */\nfunction urlForFindMany(this: MixtBuildURLMixin, ids: string[], modelName: string, snapshots: Snapshot[]): string {\n return this._buildURL(modelName);\n}\n\n/**\n Builds a URL for fetching an async `hasMany` relationship when a URL\n is not provided by the server.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';\n\n export default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindHasMany(id, modelName, snapshot) {\n let baseUrl = this.buildURL(modelName, id);\n return `${baseUrl}/relationships`;\n }\n }\n ```\n\n @public\n @param {String} id\n @param {String} modelName\n @param {Snapshot} snapshot\n @return {String} url\n */\nfunction urlForFindHasMany(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string {\n return this._buildURL(modelName, id);\n}\n\n/**\n Builds a URL for fetching an async `belongsTo` relationship when a url\n is not provided by the server.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';\n\n export default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindBelongsTo(id, modelName, snapshot) {\n let baseUrl = this.buildURL(modelName, id);\n return `${baseUrl}/relationships`;\n }\n }\n ```\n\n @public\n @param {String} id\n @param {String} modelName\n @param {Snapshot} snapshot\n @return {String} url\n */\nfunction urlForFindBelongsTo(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string {\n return this._buildURL(modelName, id);\n}\n\n/**\n Builds a URL for a `record.save()` call when the record was created\n locally using `store.createRecord()`.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n urlForCreateRecord(modelName, snapshot) {\n return super.urlForCreateRecord(...arguments) + '/new';\n }\n }\n ```\n\n @public\n @param {String} modelName\n @param {Snapshot} snapshot\n @return {String} url\n */\nfunction urlForCreateRecord(this: MixtBuildURLMixin, modelName: string, snapshot: Snapshot): string {\n return this._buildURL(modelName);\n}\n\n/**\n Builds a URL for a `record.save()` call when the record has been updated locally.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n urlForUpdateRecord(id, modelName, snapshot) {\n return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n }\n }\n ```\n\n @public\n @param {String} id\n @param {String} modelName\n @param {Snapshot} snapshot\n @return {String} url\n */\nfunction urlForUpdateRecord(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string {\n return this._buildURL(modelName, id);\n}\n\n/**\n Builds a URL for a `record.save()` call when the record has been deleted locally.\n\n Example:\n\n ```js [app/adapters/application.js]\n import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n urlForDeleteRecord(id, modelName, snapshot) {\n return super.urlForDeleteRecord(...arguments) + '/destroy';\n }\n }\n ```\n\n @public\n @param {String} id\n @param {String} modelName\n @param {Snapshot} snapshot\n @return {String} url\n */\nfunction urlForDeleteRecord(this: MixtBuildURLMixin, id: string, modelName: string, snapshot: Snapshot): string {\n return this._buildURL(modelName, id);\n}\n\n/**\n @private\n @param {String} path\n @param {String} parentURL\n @return {String} urlPrefix\n */\nfunction urlPrefix(this: MixtBuildURLMixin, path?: string | null, parentURL?: string): string {\n const { namespace } = this;\n let { host } = this;\n\n if (!host || host === '/') {\n host = '';\n }\n\n if (path) {\n // Protocol relative url\n if (/^\\/\\//.test(path) || /http(s)?:\\/\\//.test(path)) {\n // Do nothing, the full host is already included.\n return path;\n\n // Absolute path\n } else if (path.charAt(0) === '/') {\n return `${host}${path}`;\n // Relative path\n } else {\n return `${parentURL}/${path}`;\n }\n }\n\n // No path provided\n const url: string[] = [];\n if (host) {\n url.push(host);\n }\n if (namespace) {\n url.push(namespace);\n }\n return url.join('/');\n}\n\n/**\n Determines the pathname for a given type.\n\n By default, it pluralizes the type's name (for example,\n 'post' becomes 'posts' and 'person' becomes 'people').\n\n ### Pathname customization\n\n For example, if you have an object `LineItem` with an\n endpoint of `/line_items/`.\n\n ```js [app/adapters/application.js]\n import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';\n import { undesrcore, pluralize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationAdapter extends RESTAdapter {\n pathForType(modelName) {\n return pluralize(underscore(modelName));\n }\n }\n ```\n\n @public\n @param {String} modelName\n @return {String} path\n **/\nfunction pathForType(this: MixtBuildURLMixin, modelName: string): string {\n const camelized = camelize(modelName);\n return pluralize(camelized);\n}\n\n// we build it this way vs casting to BuildURLMixin so that any\n// changes to the interface surface as errors here.\nconst mixinProps: BuildURLMixin = {\n buildURL,\n _buildURL,\n urlForFindRecord,\n urlForFindAll,\n urlForQueryRecord,\n urlForQuery,\n urlForFindMany,\n urlForFindHasMany,\n urlForFindBelongsTo,\n urlForCreateRecord,\n urlForDeleteRecord,\n urlForUpdateRecord,\n urlPrefix,\n pathForType,\n};\n\n/**\n * The `Mixin` implementation of {@link BuildURLMixin}, ready to be applied\n * to an `EmberObject` subclass such as an `Adapter`.\n *\n * @public\n */\nexport const BuildURLMixin: Mixin = Mixin.create(mixinProps);\n","/**\n * ## Overview\n *\n * :::danger\n * ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.\n * If starting a new app or thinking of implementing a new adapter, consider writing a\n * {@link Handler} instead to be used with the {@link RequestManager}\n * ::::\n *\n * In order to properly fetch and update data, @warp-drive/legacy\n * needs to understand how to connect to your API.\n *\n * `Adapters` accept various kinds of requests from the store\n * and manage fulfillment of the request from your API.\n *\n * ### Request Flow\n *\n * When the store decides it needs to issue a request it uses the following flow to manage the request and process the data.\n *\n * - find the appropriate adapter\n * - issue the request to the adapter\n * - await the adapter's response\n * - if an error occurs reject with the error\n * - if no error\n * - if there is response data\n * - pass the response data to the appropriate serializer\n * - update the cache using the JSON:API formatted data from the serializer's response\n * - return the primary record(s) associated with the request\n *\n * ### Request Errors\n *\n * When a request errors and your adapter does not have the ability to recover from the error,\n * you may either reject the promise returned by your adapter method with the error or simply\n * throw the error.\n *\n * If the request was for a `createRecord` `updateRecord` or `deleteRecord` special rules\n * apply to how this error will affect the state of the store and additional properties on\n * the `Error` class may be used. See the documentation for these methods in\n * {@link MinimumAdapterInterface} for more information.\n *\n * ### Implementing an Adapter\n *\n * There are seven required adapter methods, one for each of\n * the primary request types that @warp-drive/legacy issues.\n *\n * They are:\n *\n * - findRecord\n * - findAll\n * - queryRecord\n * - query\n * - createRecord\n * - updateRecord\n * - deleteRecord\n *\n * Each of these request types has a matching store method that triggers it\n * and matching `requestType` that is passed to the serializer's\n * `normalizeResponse` method.\n *\n * If your app only reads data but never writes data, it is not necessary\n * to implement the methods for create, update, and delete. This extends to\n * all of the store's find methods with the exception of `findRecord` (`findAll`,\n * `query`, `queryRecord`): if you do not use the store method in your app then\n * your Adapter does not need the method.\n *\n * ```ts\n * async function fetchData(url, options = {}) {\n * let response = await fetch(url, options);\n * return response.toJSON();\n * }\n *\n * export default class ApplicationAdapter {\n * findRecord(_, { modelName }, id) {\n * return fetchData(`./${modelName}s/${id}`);\n * }\n *\n * static create() {\n * return new this();\n * }\n * }\n * ```\n *\n * ### Adapter Resolution\n *\n * `store.adapterFor(name)` will lookup adapters defined in `app/adapters/` and\n * return an instance.\n *\n * `adapterFor` first attempts to find an adapter with an exact match on `name`,\n then falls back to checking for the presence of an adapter named `application`.\n\n If no adapter is found, an error will be thrown.\n\n ```ts\n store.adapterFor('author');\n\n // lookup paths (in order) =>\n // app/adapters/author.js\n // app/adapters/application.js\n ```\n\n Most requests in @warp-drive/legacy are made with respect to a particular `type` (or `modelName`)\n (e.g., \"get me the full collection of **books**\" or \"get me the **employee** whose id is 37\"). We\n refer to this as the **primary** resource `type`.\n\n `adapterFor` is used by the store to find an adapter with a name matching that of the primary\n resource `type` for the request, which then falls back to the `application` adapter.\n\n It is recommended that applications define only a single `application` adapter and serializer\n where possible, only implementing an adapter specific to the `type` when absolutely necessary.\n\n If you need to support multiple API versions for the same type, the per-type strategy for\n defining adapters might not be adequate.\n\n If you have multiple APIs or multiple API versions and the single application adapter and per-type\n strategy does not suite your needs, one strategy is to write an `application` adapter and serializer\n that make use of `options` to specify the desired format when making a request, then forwards to the\n request to the desired adapter or serializer as needed.\n\n ```js [app/adapters/application.js]\n export default class Adapter extends EmberObject {\n findRecord(store, schema, id, snapshot) {\n let { apiVersion } = snapshot.adapterOptions;\n return this.adapterFor(`-api-${apiVersion}`).findRecord(store, schema, id, snapshot);\n }\n }\n ```\n\n ### Overriding `Store.adapterFor`\n\n ```js\n import Store from '@ember-data/store';\n import Adapter from '@ember-data/adapter/json-api';\n\n class extends Store {\n #adapter = new Adapter();\n\n adapterFor() {\n return this.#adapter;\n }\n }\n ```\n\n\nNote: If you are using Ember and would like to make use of `service` injections in your adapter, you will want to additionally `setOwner` for the Adapter.\n\n ```js\n import Store from '@ember-data/store';\n import Adapter from '@ember-data/adapter/json-api';\n import { getOwner, setOwner } from '@ember/owner';\n\n class extends Store {\n #adapter = null;\n\n adapterFor() {\n let adapter = this.#adapter;\n if (!adapter) {\n const owner = getOwner(this);\n adapter = new Adapter();\n setOwner(adapter, owner);\n this.#adapter = adapter;\n }\n\n return adapter;\n }\n }\n ```\n\nBy default when using with Ember you only need to implement this hook if you want your adapter usage to be statically analyzeable. *Ember***Data** will attempt to resolve adapters using Ember's resolver. To provide a single Adapter for your application like the above you would provide it as the default export of the file `app/adapters/application.{js/ts}`\n\n ### Using an Adapter\n\n Any adapter in `app/adapters/` can be looked up by `name` using `store.adapterFor(name)`.\n\n ### Default Adapters\n\n Applications whose API's structure endpoint URLs *very close to* or *exactly* the **REST**\n or **JSON:API** convention, the `@ember-data/adapter` package contains implementations\n these applications can extend.\n\n Many applications will find writing their own adapter to be allow greater flexibility,\n customization, and maintenance than attempting to override methods in these adapters.\n\n @module\n*/\n\nimport EmberObject from '@ember/object';\nimport * as s from '@ember/service';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { RequestManager, Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n// oxlint-disable-next-line no-unused-vars\nimport type { Handler } from '@warp-drive/core/request';\nimport type { ModelSchema } from '@warp-drive/core/types';\n\nimport type { AdapterPayload, MinimumAdapterInterface, SerializerOptions } from './compat.ts';\nimport type { Snapshot, SnapshotRecordArray } from './compat/-private.ts';\n\nconst service = s.service ?? s.inject;\n/**\n An adapter is an object that receives requests from a store and\n translates them into the appropriate action to take against your\n persistence layer. The persistence layer is usually an HTTP API but\n may be anything, such as the browser's local storage. Typically the\n adapter is not invoked directly instead its functionality is accessed\n through the `store`.\n\n > ⚠️ CAUTION you likely want the docs for {@link MinimumAdapterInterface}\n > as extending this abstract class is unnecessary.\n\n ### Creating an Adapter\n\n Create a new subclass of `Adapter` in the `app/adapters` folder:\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n\n export default class extends Adapter {\n // ...your code here\n }\n ```\n\n Model-specific adapters can be created by putting your adapter\n class in an `app/adapters/` + `model-name` + `.js` file of the application.\n\n ```js [app/adapters/post.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n\n export default class extends Adapter {\n // ...Post-specific adapter code goes here\n }\n ```\n\n `Adapter` is an abstract base class that you should override in your\n application to customize it for your backend. The minimum set of methods\n that you should implement is:\n\n * `findRecord()`\n * `createRecord()`\n * `updateRecord()`\n * `deleteRecord()`\n * `findAll()`\n * `query()`\n\n To improve the network performance of your application, you can optimize\n your adapter by overriding these lower-level methods:\n\n * `findMany()`\n\n\n For an example of the implementation, see `RESTAdapter`, the\n included REST adapter.\n\n @public\n*/\nexport class Adapter extends EmberObject implements MinimumAdapterInterface {\n /**\n * The Store service instance that owns this Adapter.\n */\n @service declare store: Store;\n\n /**\n * @private\n */\n declare _coalesceFindRequests: boolean;\n\n /**\n The `findRecord()` method is invoked when the store is asked for a record that\n has not previously been loaded. In response to `findRecord()` being called, you\n should query your persistence layer for a record with the given ID. The `findRecord`\n method should return a promise that will resolve to a JavaScript object that will be\n normalized by the serializer.\n\n Here is an example of the `findRecord` implementation:\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n import RSVP from 'RSVP';\n import $ from 'jquery';\n\n export default class ApplicationAdapter extends Adapter {\n findRecord(store, type, id, snapshot) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n }\n ```\n\n @public\n */\n // @ts-expect-error\n findRecord(store: Store, type: ModelSchema, id: string, snapshot: Snapshot): Promise<AdapterPayload> {\n if (DEBUG) {\n throw new Error('You subclassed the Adapter class but missing a findRecord override');\n }\n }\n\n /**\n The `findAll()` method is used to retrieve all records for a given type.\n\n Example\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n import RSVP from 'RSVP';\n import $ from 'jquery';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n }\n ```\n\n @param neverSet a value is never provided to this argument\n @public\n */\n findAll(\n store: Store,\n type: ModelSchema,\n neverSet: null,\n snapshotRecordArray: SnapshotRecordArray\n // @ts-expect-error\n ): Promise<AdapterPayload> {\n if (DEBUG) {\n throw new Error('You subclassed the Adapter class but missing a findAll override');\n }\n }\n\n /**\n This method is called when you call `query` on the store.\n\n Example\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n import RSVP from 'RSVP';\n import $ from 'jquery';\n\n export default class ApplicationAdapter extends Adapter {\n query(store, type, query) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`, query).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n }\n ```\n\n @public\n */\n // @ts-expect-error\n query(store: Store, type: ModelSchema, query: Record<string, unknown>): Promise<AdapterPayload> {\n if (DEBUG) {\n throw new Error('You subclassed the Adapter class but missing a query override');\n }\n }\n\n /**\n The `queryRecord()` method is invoked when the store is asked for a single\n record through a query object.\n\n In response to `queryRecord()` being called, you should always fetch fresh\n data. Once found, you can asynchronously call the store's `push()` method\n to push the record into the store.\n\n Here is an example `queryRecord` implementation:\n\n Example\n\n ```js [app/adapters/application.js]\n import { Adapter, BuildURLMixin } from '@warp-drive/legacy/adapter';\n\n export default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {\n queryRecord(store, type, query) {\n return fetch(`/${type.modelName}`, { body: JSON.stringify(query) })\n .then((response) => response.json());\n }\n }\n ```\n\n @public\n */\n queryRecord(\n store: Store,\n type: ModelSchema,\n query: Record<string, unknown>,\n adapterOptions: object\n // @ts-expect-error\n ): Promise<AdapterPayload> {\n if (DEBUG) {\n throw new Error('You subclassed the Adapter class but missing a queryRecord override');\n }\n }\n\n /**\n If the globally unique IDs for your records should be generated on the client,\n implement the `generateIdForRecord()` method. This method will be invoked\n each time you create a new record, and the value returned from it will be\n assigned to the record's `primaryKey`.\n\n Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\n of the record will be set by the server, and your adapter will update the store\n with the new ID when it calls `didCreateRecord()`. Only implement this method if\n you intend to generate record IDs on the client-side.\n\n The `generateIdForRecord()` method will be invoked with the requesting store as\n the first parameter and the newly created record as the second parameter:\n\n ```javascript\n import { Adapter } from '@warp-drive/legacy/adapter';\n import { v4 } from 'uuid';\n\n export default class ApplicationAdapter extends Adapter {\n generateIdForRecord(store, type, inputProperties) {\n return v4();\n }\n }\n ```\n\n @param {Store} store\n @param {Model} type the Model class of the record\n @param {Object} inputProperties a hash of properties to set on the\n newly created record.\n @return {(String|Number)} id\n @public\n */\n\n /**\n Proxies to the serializer's `serialize` method.\n\n Example\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n createRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let url = `/${type.modelName}`;\n\n // ...\n }\n }\n ```\n\n @public\n */\n serialize(snapshot: Snapshot, options: SerializerOptions): Record<string, unknown> {\n const serialized = snapshot.serialize(options);\n assert(\n `Your adapter's serialize method must return an object, but it returned ${typeof serialized}`,\n serialized && typeof serialized === 'object'\n );\n return serialized as Record<string, unknown>;\n }\n\n /**\n Implement this method in a subclass to handle the creation of\n new records.\n\n Serializes the record and sends it to the server.\n\n Example\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n import RSVP from 'RSVP';\n import $ from 'jquery';\n\n export default class ApplicationAdapter extends Adapter {\n createRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n\n return new RSVP.Promise(function (resolve, reject) {\n $.ajax({\n type: 'POST',\n url: `/${type.modelName}`,\n dataType: 'json',\n data: data\n }).then(function (data) {\n resolve(data);\n }, function (jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n }\n ```\n\n @public\n */\n // @ts-expect-error\n createRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload> {\n if (DEBUG) {\n throw new Error('You subclassed the Adapter class but missing a createRecord override');\n }\n }\n\n /**\n Implement this method in a subclass to handle the updating of\n a record.\n\n Serializes the record update and sends it to the server.\n\n The updateRecord method is expected to return a promise that will\n resolve with the serialized record. This allows the backend to\n inform the WarpDrive store the current state of this record after\n the update. If it is not possible to return a serialized record\n the updateRecord promise can also resolve with `undefined` and the\n WarpDrive store will assume all of the updates were successfully\n applied on the backend.\n\n Example\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n import RSVP from 'RSVP';\n import $ from 'jquery';\n\n export default class ApplicationAdapter extends Adapter {\n updateRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let id = snapshot.id;\n\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'PUT',\n url: `/${type.modelName}/${id}`,\n dataType: 'json',\n data: data\n }).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n }\n ```\n\n @param {Store} store\n @param {Model} type the Model class of the record\n @param {Snapshot} snapshot\n @return {Promise} promise\n @public\n */\n // @ts-expect-error\n updateRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload> {\n if (DEBUG) {\n throw new Error('You subclassed the Adapter class but missing a updateRecord override');\n }\n }\n\n /**\n Implement this method in a subclass to handle the deletion of\n a record.\n\n Sends a delete request for the record to the server.\n\n Example\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n import RSVP from 'RSVP';\n import $ from 'jquery';\n\n export default class ApplicationAdapter extends Adapter {\n deleteRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let id = snapshot.id;\n\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'DELETE',\n url: `/${type.modelName}/${id}`,\n dataType: 'json',\n data: data\n }).then(function(data) {\n resolve(data)\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n }\n ```\n\n @param {Store} store\n @param {Model} type the Model class of the record\n @param {Snapshot} snapshot\n @return {Promise} promise\n @public\n */\n // @ts-expect-error\n deleteRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload> {\n if (DEBUG) {\n throw new Error('You subclassed the Adapter class but missing a deleteRecord override');\n }\n }\n\n /**\n By default the store will try to coalesce all `findRecord` calls within the same runloop\n into as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\n You can opt out of this behaviour by either not implementing the findMany hook or by setting\n coalesceFindRequests to false.\n\n @property coalesceFindRequests\n @public\n @type {Boolean}\n */\n get coalesceFindRequests() {\n const coalesceFindRequests = this._coalesceFindRequests;\n if (typeof coalesceFindRequests === 'boolean') {\n return coalesceFindRequests;\n }\n return (this._coalesceFindRequests = true);\n }\n\n set coalesceFindRequests(value: boolean) {\n this._coalesceFindRequests = value;\n }\n\n /**\n The store will call `findMany` instead of multiple `findRecord`\n requests to find multiple records at once if coalesceFindRequests\n is true.\n\n ```js [app/adapters/application.js]\n import { Adapter } from '@warp-drive/legacy/adapter';\n import RSVP from 'RSVP';\n import $ from 'jquery';\n\n export default class ApplicationAdapter extends Adapter {\n findMany(store, type, ids, snapshots) {\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'GET',\n url: `/${type.modelName}/`,\n dataType: 'json',\n data: { filter: { id: ids.join(',') } }\n }).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n }\n ```\n\n @param {Store} store\n @param {Model} type the Model class of the records\n @param {Array} ids\n @param {Array} snapshots\n @return {Promise} promise\n @public\n */\n\n /**\n Organize records into groups, each of which is to be passed to separate\n calls to `findMany`.\n\n For example, if your API has nested URLs that depend on the parent, you will\n want to group records by their parent.\n\n The default implementation returns the records as a single group.\n\n @public\n @param {Store} store\n @param {Array} snapshots\n @return {Array} an array of arrays of records, each of which is to be\n loaded separately by `findMany`.\n */\n groupRecordsForFindMany(store: Store, snapshots: Snapshot[]): Snapshot[][] {\n return [snapshots];\n }\n\n /**\n This method is used by the store to determine if the store should\n reload a record from the adapter when a record is requested by\n `store.findRecord`.\n\n If this method returns `true`, the store will re-fetch a record from\n the adapter. If this method returns `false`, the store will resolve\n immediately using the cached record.\n\n For example, if you are building an events ticketing system, in which users\n can only reserve tickets for 20 minutes at a time, and want to ensure that\n in each route you have data that is no more than 20 minutes old you could\n write:\n\n ```javascript\n shouldReloadRecord(store, ticketSnapshot) {\n let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n }\n ```\n\n This method would ensure that whenever you do `store.findRecord('ticket',\n id)` you will always get a ticket that is no more than 20 minutes old. In\n case the cached version is more than 20 minutes old, `findRecord` will not\n resolve until you fetched the latest version.\n\n By default this hook returns `false`, as most UIs should not block user\n interactions while waiting on data update.\n\n Note that, with default settings, `shouldBackgroundReloadRecord` will always\n re-fetch the records in the background even if `shouldReloadRecord` returns\n `false`. You can override `shouldBackgroundReloadRecord` if this does not\n suit your use case.\n\n @since 1.13.0\n @param {Store} store\n @param {Snapshot} snapshot\n @return {Boolean}\n @public\n */\n shouldReloadRecord(store: Store, snapshot: Snapshot): boolean {\n return false;\n }\n\n /**\n This method is used by the store to determine if the store should\n reload all records from the adapter when records are requested by\n `store.findAll`.\n\n If this method returns `true`, the store will re-fetch all records from\n the adapter. If this method returns `false`, the store will resolve\n immediately using the cached records.\n\n For example, if you are building an events ticketing system, in which users\n can only reserve tickets for 20 minutes at a time, and want to ensure that\n in each route you have data that is no more than 20 minutes old you could\n write:\n\n ```javascript\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any((ticketSnapshot) => {\n let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n ```\n\n This method would ensure that whenever you do `store.findAll('ticket')` you\n will always get a list of tickets that are no more than 20 minutes old. In\n case a cached version is more than 20 minutes old, `findAll` will not\n resolve until you fetched the latest versions.\n\n By default, this method returns `true` if the passed `snapshotRecordArray`\n is empty (meaning that there are no records locally available yet),\n otherwise, it returns `false`.\n\n Note that, with default settings, `shouldBackgroundReloadAll` will always\n re-fetch all the records in the background even if `shouldReloadAll` returns\n `false`. You can override `shouldBackgroundReloadAll` if this does not suit\n your use case.\n\n @since 1.13.0\n @param {Store} store\n @param {SnapshotRecordArray} snapshotRecordArray\n @return {Boolean}\n @public\n */\n shouldReloadAll(store: Store, snapshotRecordArray: SnapshotRecordArray): boolean {\n return !snapshotRecordArray.length;\n }\n\n /**\n This method is used by the store to determine if the store should\n reload a record after the `store.findRecord` method resolves a\n cached record.\n\n This method is *only* checked by the store when the store is\n returning a cached record.\n\n If this method returns `true` the store will re-fetch a record from\n the adapter.\n\n For example, if you do not want to fetch complex data over a mobile\n connection, or if the network is down, you can implement\n `shouldBackgroundReloadRecord` as follows:\n\n ```javascript\n shouldBackgroundReloadRecord(store, snapshot) {\n let { downlink, effectiveType } = navigator.connection;\n\n return downlink > 0 && effectiveType === '4g';\n }\n ```\n\n By default, this hook returns `true` so the data for the record is updated\n in the background.\n\n @since 1.13.0\n @param {Store} store\n @param {Snapshot} snapshot\n @return {Boolean}\n @public\n */\n shouldBackgroundReloadRecord(store: Store, snapshot: Snapshot): boolean {\n return true;\n }\n\n /**\n This method is used by the store to determine if the store should\n reload a record array after the `store.findAll` method resolves\n with a cached record array.\n\n This method is *only* checked by the store when the store is\n returning a cached record array.\n\n If this method returns `true` the store will re-fetch all records\n from the adapter.\n\n For example, if you do not want to fetch complex data over a mobile\n connection, or if the network is down, you can implement\n `shouldBackgroundReloadAll` as follows:\n\n ```javascript\n shouldBackgroundReloadAll(store, snapshotArray) {\n let { downlink, effectiveType } = navigator.connection;\n\n return downlink > 0 && effectiveType === '4g';\n }\n ```\n\n By default this method returns `true`, indicating that a background reload\n should always be triggered.\n\n @since 1.13.0\n @param {Store} store\n @param {SnapshotRecordArray} snapshotRecordArray\n @return {Boolean}\n @public\n */\n shouldBackgroundReloadAll(store: Store, snapshotRecordArray: SnapshotRecordArray): boolean {\n return true;\n }\n}\n\nexport { BuildURLMixin } from './adapter/-private/build-url-mixin.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuWA,SAASG,SAEPC,WACAC,IACAC,UACAC,aAWAC,OACQ;CASR,QAAQD,aAAR;EACE,KAAK,cACH,OAAO,KAAKE,iBAAiBJ,IAAcD,WAAWE,QAAoB;EAC5E,KAAK,WACH,OAAO,KAAKI,cAAcN,WAAWE,QAA+B;EACtE,KAAK,SACH,OAAO,KAAKK,YAAYH,SAAS,CAAC,GAAGJ,SAAS;EAChD,KAAK,eACH,OAAO,KAAKQ,kBAAkBJ,SAAS,CAAC,GAAGJ,SAAS;EACtD,KAAK,YACH,OAAO,KAAKS,eAAeR,IAAgBD,WAAWE,QAAsB;EAC9E,KAAK,eACH,OAAO,KAAKQ,kBAAkBT,IAAcD,WAAWE,QAAoB;EAC7E,KAAK,iBACH,OAAO,KAAKS,oBAAoBV,IAAcD,WAAWE,QAAoB;EAC/E,KAAK,gBACH,OAAO,KAAKU,mBAAmBZ,WAAWE,QAAoB;EAChE,KAAK,gBACH,OAAO,KAAKW,mBAAmBZ,IAAcD,WAAWE,QAAoB;EAC9E,KAAK,gBACH,OAAO,KAAKY,mBAAmBb,IAAcD,WAAWE,QAAoB;EAC9E,SAGE,OAAO,KAAKa,UAAUf,WAAWC,EAAmB;CACxD;AACF;;;;;;;AAQA,SAASc,UAAmCf,WAAsCC,IAA4B;CAC5G,IAAIe;CACJ,MAAMC,MAAgB,CAAA;CACtB,MAAM,EAAEC,SAAS;CACjB,MAAMC,SAAS,KAAKC,UAAU;CAE9B,IAAIpB,WAAW;EACbgB,OAAO,KAAKK,YAAYrB,SAAS;EACjC,IAAIgB,MACFC,IAAIK,KAAKN,IAAI;CAEjB;CAEA,IAAIf,IACFgB,IAAIK,KAAKC,mBAAmBtB,EAAE,CAAC;CAEjC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