@warp-drive/legacy 5.10.0-alpha.2 → 5.10.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/README.md +91 -8
  2. package/blueprints/adapter/files/__root__/__path__/__name__.js +1 -0
  3. package/blueprints/adapter/index.js +27 -0
  4. package/blueprints/adapter-test/index.js +33 -0
  5. package/blueprints/adapter-test/qunit-files/__root__/__path__/__test__.js +1 -0
  6. package/blueprints/model/HELP.md +26 -0
  7. package/blueprints/model/files/__root__/__path__/__name__.js +1 -0
  8. package/blueprints/model/index.js +27 -0
  9. package/blueprints/model-test/index.js +33 -0
  10. package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +1 -0
  11. package/blueprints/serializer/files/__root__/__path__/__name__.js +1 -0
  12. package/blueprints/serializer/index.js +27 -0
  13. package/blueprints/serializer-test/index.js +33 -0
  14. package/blueprints/serializer-test/qunit-files/__root__/__path__/__test__.js +1 -0
  15. package/blueprints/transform/files/__root__/__path__/__name__.js +1 -0
  16. package/blueprints/transform/index.js +17 -0
  17. package/blueprints/transform-test/index.js +33 -0
  18. package/blueprints/transform-test/qunit-files/__root__/__path__/__test__.js +1 -0
  19. package/dist/{-private-DccRZQsm.js → -private-0_Oc-M3x.js} +10 -17
  20. package/dist/-private-0_Oc-M3x.js.map +1 -0
  21. package/dist/{-private-DQ6Iap2t.js → -private-L2BtGGYa.js} +8 -14
  22. package/dist/{-private-DQ6Iap2t.js.map → -private-L2BtGGYa.js.map} +1 -1
  23. package/dist/adapter/-private.d.ts +2 -12
  24. package/dist/adapter/-private.d.ts.map +1 -1
  25. package/dist/adapter/-private.js +1 -1
  26. package/dist/adapter/error.d.ts +1 -1
  27. package/dist/adapter/error.js +54 -2
  28. package/dist/adapter/error.js.map +1 -1
  29. package/dist/adapter/json-api.d.ts +5 -5
  30. package/dist/adapter/json-api.d.ts.map +1 -1
  31. package/dist/adapter/json-api.js +10 -4
  32. package/dist/adapter/json-api.js.map +1 -1
  33. package/dist/adapter/rest.d.ts +1 -1
  34. package/dist/adapter/rest.js +23 -5
  35. package/dist/adapter/rest.js.map +1 -1
  36. package/dist/{adapter-eYo2pIuM.js → adapter-AwGvdMSZ.js} +45 -6
  37. package/dist/adapter-AwGvdMSZ.js.map +1 -0
  38. package/dist/{adapter-CARrK3-8.d.ts → adapter-DvDVeaCc.d.ts} +9 -6
  39. package/dist/adapter-DvDVeaCc.d.ts.map +1 -0
  40. package/dist/adapter.d.ts +1 -1
  41. package/dist/adapter.js +1 -1
  42. package/dist/compat/-private.d.ts +1 -1
  43. package/dist/compat/-private.js +1 -1
  44. package/dist/compat/builders.d.ts +10 -8
  45. package/dist/compat/builders.d.ts.map +1 -1
  46. package/dist/compat/builders.js +15 -9
  47. package/dist/compat/builders.js.map +1 -1
  48. package/dist/compat/extensions.d.ts +1 -1
  49. package/dist/compat/extensions.js +23 -2
  50. package/dist/compat/extensions.js.map +1 -1
  51. package/dist/compat/utils.d.ts +17 -2
  52. package/dist/compat/utils.d.ts.map +1 -1
  53. package/dist/compat/utils.js +19 -2
  54. package/dist/compat/utils.js.map +1 -1
  55. package/dist/{compat-DcHVxuuZ.js → compat-C-yQnbkF.js} +61 -8
  56. package/dist/compat-C-yQnbkF.js.map +1 -0
  57. package/dist/{compat-BbNNmTM-.d.ts → compat-DoWEarkU.d.ts} +30 -17
  58. package/dist/compat-DoWEarkU.d.ts.map +1 -0
  59. package/dist/compat.d.ts +1 -1
  60. package/dist/compat.js +1 -1
  61. package/dist/{error-CzkyXr1Q.d.ts → error-798wGD3r.d.ts} +49 -3
  62. package/dist/error-798wGD3r.d.ts.map +1 -0
  63. package/dist/{errors-CS110tMl.js → errors-BEExAZtv.js} +42 -32
  64. package/dist/errors-BEExAZtv.js.map +1 -0
  65. package/dist/{extensions-DumNm4dA.d.ts → extensions-DcEz1lKv.d.ts} +18 -3
  66. package/dist/extensions-DcEz1lKv.d.ts.map +1 -0
  67. package/dist/index.d.ts +17 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +25 -7
  70. package/dist/index.js.map +1 -1
  71. package/dist/{json-BXNPTlcH.js → json-Baaga4BP.js} +10 -5
  72. package/dist/json-Baaga4BP.js.map +1 -0
  73. package/dist/model/-private.d.ts +1 -1
  74. package/dist/model/-private.js +1 -1
  75. package/dist/model/migration-support.d.ts +19 -4
  76. package/dist/model/migration-support.d.ts.map +1 -1
  77. package/dist/model/migration-support.js +25 -7
  78. package/dist/model/migration-support.js.map +1 -1
  79. package/dist/{model-DWH9f__L.js → model-Be-e84FX.js} +19 -12
  80. package/dist/model-Be-e84FX.js.map +1 -0
  81. package/dist/{model-62hn5_PD.d.ts → model-DAdY1ibr.d.ts} +13 -26
  82. package/dist/model-DAdY1ibr.d.ts.map +1 -0
  83. package/dist/{unpkg/dev-deprecated/model-fragments-DSqu0ptR.js → model-fragments-DCHMDr5f.js} +32 -18
  84. package/dist/model-fragments-DCHMDr5f.js.map +1 -0
  85. package/dist/model-fragments.d.ts +31 -19
  86. package/dist/model-fragments.d.ts.map +1 -1
  87. package/dist/model-fragments.js +1 -1
  88. package/dist/model.d.ts +12 -11
  89. package/dist/model.d.ts.map +1 -1
  90. package/dist/model.js +2 -2
  91. package/dist/{rest-0NhtexIq.d.ts → rest-CmFneLJH.d.ts} +18 -8
  92. package/dist/rest-CmFneLJH.d.ts.map +1 -0
  93. package/dist/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
  94. package/dist/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
  95. package/dist/{schema-provider-DguGmQDS.js → schema-provider-BAB8DyMr.js} +22 -21
  96. package/dist/schema-provider-BAB8DyMr.js.map +1 -0
  97. package/dist/serializer/json-api.d.ts +1 -2
  98. package/dist/serializer/json-api.d.ts.map +1 -1
  99. package/dist/serializer/json-api.js +7 -3
  100. package/dist/serializer/json-api.js.map +1 -1
  101. package/dist/serializer/json.d.ts +2 -2
  102. package/dist/serializer/json.d.ts.map +1 -1
  103. package/dist/serializer/json.js +1 -1
  104. package/dist/serializer/rest.d.ts +4 -4
  105. package/dist/serializer/rest.d.ts.map +1 -1
  106. package/dist/serializer/rest.js +12 -5
  107. package/dist/serializer/rest.js.map +1 -1
  108. package/dist/serializer/transform.d.ts +9 -10
  109. package/dist/serializer/transform.d.ts.map +1 -1
  110. package/dist/serializer/transform.js +14 -10
  111. package/dist/serializer/transform.js.map +1 -1
  112. package/dist/serializer.d.ts +2 -2
  113. package/dist/serializer.d.ts.map +1 -1
  114. package/dist/serializer.js +42 -3
  115. package/dist/serializer.js.map +1 -1
  116. package/dist/{store-C4qYzXei.js → store-BLKEsJyw.js} +13 -7
  117. package/dist/store-BLKEsJyw.js.map +1 -0
  118. package/dist/store.d.ts +3 -2
  119. package/dist/store.d.ts.map +1 -1
  120. package/dist/store.js +1 -1
  121. package/dist/unpkg/dev/{-private-CrEyBE-B.js → -private-BprUAEe_.js} +8 -14
  122. package/dist/unpkg/{dev-deprecated/-private-CrEyBE-B.js.map → dev/-private-BprUAEe_.js.map} +1 -1
  123. package/dist/unpkg/dev/{-private-vOhxVExH.js → -private-Dch4SxkU.js} +10 -17
  124. package/dist/unpkg/dev/-private-Dch4SxkU.js.map +1 -0
  125. package/dist/unpkg/dev/adapter/-private.js +1 -1
  126. package/dist/unpkg/dev/adapter/error.js +54 -2
  127. package/dist/unpkg/dev/adapter/error.js.map +1 -1
  128. package/dist/unpkg/dev/adapter/json-api.js +10 -4
  129. package/dist/unpkg/dev/adapter/json-api.js.map +1 -1
  130. package/dist/unpkg/dev/adapter/rest.js +23 -5
  131. package/dist/unpkg/dev/adapter/rest.js.map +1 -1
  132. package/dist/unpkg/dev/{adapter-oLwyr47q.js → adapter-BAn4SeUA.js} +45 -6
  133. package/dist/unpkg/dev/adapter-BAn4SeUA.js.map +1 -0
  134. package/dist/unpkg/dev/adapter.js +1 -1
  135. package/dist/unpkg/dev/compat/-private.js +1 -1
  136. package/dist/unpkg/dev/compat/builders.js +15 -9
  137. package/dist/unpkg/dev/compat/builders.js.map +1 -1
  138. package/dist/unpkg/dev/compat/extensions.js +23 -2
  139. package/dist/unpkg/dev/compat/extensions.js.map +1 -1
  140. package/dist/unpkg/dev/compat/utils.js +19 -2
  141. package/dist/unpkg/dev/compat/utils.js.map +1 -1
  142. package/dist/unpkg/dev/{compat-DNQT2TQx.js → compat-BdovRRzQ.js} +62 -10
  143. package/dist/unpkg/dev/compat-BdovRRzQ.js.map +1 -0
  144. package/dist/unpkg/dev/compat.js +1 -1
  145. package/dist/unpkg/dev/{errors-DnzvLM2A.js → errors-CGvbM6WH.js} +42 -32
  146. package/dist/unpkg/dev/errors-CGvbM6WH.js.map +1 -0
  147. package/dist/unpkg/dev/index.js +25 -7
  148. package/dist/unpkg/dev/index.js.map +1 -1
  149. package/dist/unpkg/{dev-deprecated/json-DDJji3V3.js → dev/json-BlSBe84o.js} +10 -5
  150. package/dist/unpkg/dev/json-BlSBe84o.js.map +1 -0
  151. package/dist/unpkg/dev/model/-private.js +1 -1
  152. package/dist/unpkg/dev/model/migration-support.js +24 -6
  153. package/dist/unpkg/dev/model/migration-support.js.map +1 -1
  154. package/dist/unpkg/dev/{model-BxPIR7m2.js → model-QCZr8eec.js} +19 -12
  155. package/dist/unpkg/dev/model-QCZr8eec.js.map +1 -0
  156. package/dist/{model-fragments-DSqu0ptR.js → unpkg/dev/model-fragments-DCHMDr5f.js} +32 -18
  157. package/dist/unpkg/dev/model-fragments-DCHMDr5f.js.map +1 -0
  158. package/dist/unpkg/dev/model-fragments.js +1 -1
  159. package/dist/unpkg/dev/model.js +2 -2
  160. package/dist/unpkg/dev/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
  161. package/dist/unpkg/dev/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
  162. package/dist/unpkg/dev/{schema-provider-CI_a48ja.js → schema-provider-IMFO9Kgw.js} +18 -17
  163. package/dist/unpkg/dev/schema-provider-IMFO9Kgw.js.map +1 -0
  164. package/dist/unpkg/dev/serializer/json-api.js +7 -3
  165. package/dist/unpkg/dev/serializer/json-api.js.map +1 -1
  166. package/dist/unpkg/dev/serializer/json.js +1 -1
  167. package/dist/unpkg/dev/serializer/rest.js +12 -5
  168. package/dist/unpkg/dev/serializer/rest.js.map +1 -1
  169. package/dist/unpkg/dev/serializer/transform.js +14 -10
  170. package/dist/unpkg/dev/serializer/transform.js.map +1 -1
  171. package/dist/unpkg/dev/serializer.js +42 -3
  172. package/dist/unpkg/dev/serializer.js.map +1 -1
  173. package/dist/unpkg/dev/{store-D_V8-HQl.js → store-BiXsLLAu.js} +13 -7
  174. package/dist/unpkg/dev/store-BiXsLLAu.js.map +1 -0
  175. package/dist/unpkg/dev/store.js +1 -1
  176. package/dist/unpkg/dev/{util-dSKEgQDp.js → util-CI7b4vAE.js} +2 -3
  177. package/dist/unpkg/dev/{util-dSKEgQDp.js.map → util-CI7b4vAE.js.map} +1 -1
  178. package/dist/unpkg/{prod/utils-DYC9utVJ.js → dev/utils-_O0MjUTU.js} +2 -3
  179. package/dist/unpkg/dev/{utils-DYC9utVJ.js.map → utils-_O0MjUTU.js.map} +1 -1
  180. package/dist/unpkg/dev-deprecated/{-private-CrEyBE-B.js → -private-BprUAEe_.js} +8 -14
  181. package/dist/unpkg/{dev/-private-CrEyBE-B.js.map → dev-deprecated/-private-BprUAEe_.js.map} +1 -1
  182. package/dist/unpkg/dev-deprecated/{-private-vOhxVExH.js → -private-Dch4SxkU.js} +10 -17
  183. package/dist/unpkg/dev-deprecated/-private-Dch4SxkU.js.map +1 -0
  184. package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -1
  185. package/dist/unpkg/dev-deprecated/adapter/error.js +54 -2
  186. package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -1
  187. package/dist/unpkg/dev-deprecated/adapter/json-api.js +10 -4
  188. package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -1
  189. package/dist/unpkg/dev-deprecated/adapter/rest.js +23 -5
  190. package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -1
  191. package/dist/unpkg/dev-deprecated/{adapter-oLwyr47q.js → adapter-BAn4SeUA.js} +45 -6
  192. package/dist/unpkg/dev-deprecated/adapter-BAn4SeUA.js.map +1 -0
  193. package/dist/unpkg/dev-deprecated/adapter.js +1 -1
  194. package/dist/unpkg/dev-deprecated/compat/-private.js +1 -1
  195. package/dist/unpkg/dev-deprecated/compat/builders.js +15 -9
  196. package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -1
  197. package/dist/unpkg/dev-deprecated/compat/extensions.js +23 -2
  198. package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -1
  199. package/dist/unpkg/dev-deprecated/compat/utils.js +19 -2
  200. package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -1
  201. package/dist/unpkg/dev-deprecated/{compat-CeT0PnVX.js → compat-CPVriwH0.js} +62 -10
  202. package/dist/unpkg/dev-deprecated/compat-CPVriwH0.js.map +1 -0
  203. package/dist/unpkg/dev-deprecated/compat.js +1 -1
  204. package/dist/unpkg/dev-deprecated/{errors-jHQESeNQ.js → errors-yPc7D7r3.js} +42 -32
  205. package/dist/unpkg/dev-deprecated/errors-yPc7D7r3.js.map +1 -0
  206. package/dist/unpkg/dev-deprecated/index.js +25 -7
  207. package/dist/unpkg/dev-deprecated/index.js.map +1 -1
  208. package/dist/unpkg/{dev/json-DDJji3V3.js → dev-deprecated/json-BlSBe84o.js} +10 -5
  209. package/dist/unpkg/dev-deprecated/json-BlSBe84o.js.map +1 -0
  210. package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
  211. package/dist/unpkg/dev-deprecated/model/migration-support.js +24 -6
  212. package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -1
  213. package/dist/unpkg/dev-deprecated/{model-BeGORt6h.js → model-B0ZNLaHO.js} +19 -12
  214. package/dist/unpkg/dev-deprecated/model-B0ZNLaHO.js.map +1 -0
  215. package/dist/unpkg/{prod-deprecated/model-fragments-DSqu0ptR.js → dev-deprecated/model-fragments-DCHMDr5f.js} +32 -18
  216. package/dist/unpkg/dev-deprecated/model-fragments-DCHMDr5f.js.map +1 -0
  217. package/dist/unpkg/dev-deprecated/model-fragments.js +1 -1
  218. package/dist/unpkg/dev-deprecated/model.js +2 -2
  219. package/dist/unpkg/dev-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
  220. package/dist/unpkg/dev-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
  221. package/dist/unpkg/dev-deprecated/{schema-provider-NmtdR4n_.js → schema-provider-DGWYnFno.js} +18 -17
  222. package/dist/unpkg/dev-deprecated/schema-provider-DGWYnFno.js.map +1 -0
  223. package/dist/unpkg/dev-deprecated/serializer/json-api.js +7 -3
  224. package/dist/unpkg/dev-deprecated/serializer/json-api.js.map +1 -1
  225. package/dist/unpkg/dev-deprecated/serializer/json.js +1 -1
  226. package/dist/unpkg/dev-deprecated/serializer/rest.js +12 -5
  227. package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -1
  228. package/dist/unpkg/dev-deprecated/serializer/transform.js +14 -10
  229. package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -1
  230. package/dist/unpkg/dev-deprecated/serializer.js +42 -3
  231. package/dist/unpkg/dev-deprecated/serializer.js.map +1 -1
  232. package/dist/unpkg/dev-deprecated/{store-BCOLSC6z.js → store-Ci8k7Lh6.js} +13 -7
  233. package/dist/unpkg/dev-deprecated/store-Ci8k7Lh6.js.map +1 -0
  234. package/dist/unpkg/dev-deprecated/store.js +1 -1
  235. package/dist/unpkg/dev-deprecated/{util-CXA3RNYH.js → util-DL_8JecH.js} +2 -3
  236. package/dist/unpkg/dev-deprecated/{util-CXA3RNYH.js.map → util-DL_8JecH.js.map} +1 -1
  237. package/dist/unpkg/dev-deprecated/{utils-DQkMqhDv.js → utils-DyGjRZ14.js} +2 -3
  238. package/dist/unpkg/dev-deprecated/{utils-DQkMqhDv.js.map → utils-DyGjRZ14.js.map} +1 -1
  239. package/dist/unpkg/{prod-deprecated/-private-B4bxoTuK.js → prod/-private-Dc9yg98O.js} +8 -14
  240. package/dist/unpkg/{prod-deprecated/-private-B4bxoTuK.js.map → prod/-private-Dc9yg98O.js.map} +1 -1
  241. package/dist/unpkg/prod/{-private-SfXkkHKd.js → -private-DuRzYAyW.js} +9 -15
  242. package/dist/unpkg/prod/-private-DuRzYAyW.js.map +1 -0
  243. package/dist/unpkg/prod/adapter/-private.js +1 -1
  244. package/dist/unpkg/prod/adapter/error.js +54 -2
  245. package/dist/unpkg/prod/adapter/error.js.map +1 -1
  246. package/dist/unpkg/prod/adapter/json-api.js +10 -4
  247. package/dist/unpkg/prod/adapter/json-api.js.map +1 -1
  248. package/dist/unpkg/prod/adapter/rest.js +23 -5
  249. package/dist/unpkg/prod/adapter/rest.js.map +1 -1
  250. package/dist/unpkg/prod/{adapter-DQ9UA7FC.js → adapter-D0HCLrwm.js} +45 -6
  251. package/dist/unpkg/prod/adapter-D0HCLrwm.js.map +1 -0
  252. package/dist/unpkg/prod/adapter.js +1 -1
  253. package/dist/unpkg/prod/compat/-private.js +1 -1
  254. package/dist/unpkg/prod/compat/builders.js +15 -9
  255. package/dist/unpkg/prod/compat/builders.js.map +1 -1
  256. package/dist/unpkg/prod/compat/extensions.js +23 -2
  257. package/dist/unpkg/prod/compat/extensions.js.map +1 -1
  258. package/dist/unpkg/prod/compat/utils.js +19 -2
  259. package/dist/unpkg/prod/compat/utils.js.map +1 -1
  260. package/dist/unpkg/{prod-deprecated/compat-DxiVkCUb.js → prod/compat-PrUuencH.js} +62 -10
  261. package/dist/unpkg/prod/compat-PrUuencH.js.map +1 -0
  262. package/dist/unpkg/prod/compat.js +1 -1
  263. package/dist/unpkg/prod/{errors-DQDfNqVx.js → errors-Bw8niCo8.js} +38 -27
  264. package/dist/unpkg/prod/errors-Bw8niCo8.js.map +1 -0
  265. package/dist/unpkg/prod/index.js +25 -7
  266. package/dist/unpkg/prod/index.js.map +1 -1
  267. package/dist/unpkg/prod/{json-BD1kRTfB.js → json-D1bH8enA.js} +10 -5
  268. package/dist/unpkg/prod/json-D1bH8enA.js.map +1 -0
  269. package/dist/unpkg/prod/model/-private.js +1 -1
  270. package/dist/unpkg/prod/model/migration-support.js +24 -6
  271. package/dist/unpkg/prod/model/migration-support.js.map +1 -1
  272. package/dist/unpkg/prod/{model-CYMA-e_S.js → model-QtC0IWbE.js} +19 -12
  273. package/dist/unpkg/prod/model-QtC0IWbE.js.map +1 -0
  274. package/dist/unpkg/prod/model-fragments-DCHMDr5f.js +348 -0
  275. package/dist/unpkg/prod/model-fragments-DCHMDr5f.js.map +1 -0
  276. package/dist/unpkg/prod/model-fragments.js +1 -1
  277. package/dist/unpkg/prod/model.js +2 -2
  278. package/dist/unpkg/prod/runtime--fcdnjmJ-5yaSpa-d.js +52 -0
  279. package/dist/unpkg/prod/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
  280. package/dist/unpkg/prod/{schema-provider-05U1H-Kl.js → schema-provider-DPOzTa8e.js} +18 -17
  281. package/dist/unpkg/prod/schema-provider-DPOzTa8e.js.map +1 -0
  282. package/dist/unpkg/prod/serializer/json-api.js +7 -3
  283. package/dist/unpkg/prod/serializer/json-api.js.map +1 -1
  284. package/dist/unpkg/prod/serializer/json.js +1 -1
  285. package/dist/unpkg/prod/serializer/rest.js +12 -5
  286. package/dist/unpkg/prod/serializer/rest.js.map +1 -1
  287. package/dist/unpkg/prod/serializer/transform.js +14 -10
  288. package/dist/unpkg/prod/serializer/transform.js.map +1 -1
  289. package/dist/unpkg/prod/serializer.js +42 -3
  290. package/dist/unpkg/prod/serializer.js.map +1 -1
  291. package/dist/unpkg/{prod-deprecated/store-0L2CkYzh.js → prod/store-BsSkzWgk.js} +13 -7
  292. package/dist/unpkg/{prod-deprecated/store-0L2CkYzh.js.map → prod/store-BsSkzWgk.js.map} +1 -1
  293. package/dist/unpkg/prod/store.js +1 -1
  294. package/dist/unpkg/prod/{util-dSKEgQDp.js → util-CI7b4vAE.js} +2 -3
  295. package/dist/unpkg/prod/{util-dSKEgQDp.js.map → util-CI7b4vAE.js.map} +1 -1
  296. package/dist/unpkg/{dev/utils-DYC9utVJ.js → prod/utils-_O0MjUTU.js} +2 -3
  297. package/dist/unpkg/prod/{utils-DYC9utVJ.js.map → utils-_O0MjUTU.js.map} +1 -1
  298. package/dist/unpkg/{prod/-private-B4bxoTuK.js → prod-deprecated/-private-Dc9yg98O.js} +8 -14
  299. package/dist/unpkg/{prod/-private-B4bxoTuK.js.map → prod-deprecated/-private-Dc9yg98O.js.map} +1 -1
  300. package/dist/unpkg/prod-deprecated/{-private-SfXkkHKd.js → -private-DuRzYAyW.js} +9 -15
  301. package/dist/unpkg/prod-deprecated/-private-DuRzYAyW.js.map +1 -0
  302. package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -1
  303. package/dist/unpkg/prod-deprecated/adapter/error.js +54 -2
  304. package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -1
  305. package/dist/unpkg/prod-deprecated/adapter/json-api.js +10 -4
  306. package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -1
  307. package/dist/unpkg/prod-deprecated/adapter/rest.js +23 -5
  308. package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -1
  309. package/dist/unpkg/prod-deprecated/{adapter-DQ9UA7FC.js → adapter-D0HCLrwm.js} +45 -6
  310. package/dist/unpkg/prod-deprecated/adapter-D0HCLrwm.js.map +1 -0
  311. package/dist/unpkg/prod-deprecated/adapter.js +1 -1
  312. package/dist/unpkg/prod-deprecated/compat/-private.js +1 -1
  313. package/dist/unpkg/prod-deprecated/compat/builders.js +15 -9
  314. package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -1
  315. package/dist/unpkg/prod-deprecated/compat/extensions.js +23 -2
  316. package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -1
  317. package/dist/unpkg/prod-deprecated/compat/utils.js +19 -2
  318. package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -1
  319. package/dist/unpkg/{prod/compat-DxiVkCUb.js → prod-deprecated/compat-PrUuencH.js} +62 -10
  320. package/dist/unpkg/prod-deprecated/compat-PrUuencH.js.map +1 -0
  321. package/dist/unpkg/prod-deprecated/compat.js +1 -1
  322. package/dist/unpkg/prod-deprecated/{errors-ii4L43_1.js → errors-D20lKboZ.js} +38 -27
  323. package/dist/unpkg/prod-deprecated/errors-D20lKboZ.js.map +1 -0
  324. package/dist/unpkg/prod-deprecated/index.js +25 -7
  325. package/dist/unpkg/prod-deprecated/index.js.map +1 -1
  326. package/dist/unpkg/prod-deprecated/{json-BD1kRTfB.js → json-D1bH8enA.js} +10 -5
  327. package/dist/unpkg/prod-deprecated/json-D1bH8enA.js.map +1 -0
  328. package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
  329. package/dist/unpkg/prod-deprecated/model/migration-support.js +24 -6
  330. package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -1
  331. package/dist/unpkg/prod-deprecated/{model-D3oCPHtM.js → model-B946S2pl.js} +19 -12
  332. package/dist/unpkg/prod-deprecated/model-B946S2pl.js.map +1 -0
  333. package/dist/unpkg/{dev/model-fragments-DSqu0ptR.js → prod-deprecated/model-fragments-DCHMDr5f.js} +32 -18
  334. package/dist/unpkg/prod-deprecated/model-fragments-DCHMDr5f.js.map +1 -0
  335. package/dist/unpkg/prod-deprecated/model-fragments.js +1 -1
  336. package/dist/unpkg/prod-deprecated/model.js +2 -2
  337. package/dist/unpkg/prod-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
  338. package/dist/unpkg/prod-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
  339. package/dist/unpkg/prod-deprecated/{schema-provider-CKH_bnnS.js → schema-provider-xcaytn9y.js} +18 -17
  340. package/dist/unpkg/prod-deprecated/schema-provider-xcaytn9y.js.map +1 -0
  341. package/dist/unpkg/prod-deprecated/serializer/json-api.js +7 -3
  342. package/dist/unpkg/prod-deprecated/serializer/json-api.js.map +1 -1
  343. package/dist/unpkg/prod-deprecated/serializer/json.js +1 -1
  344. package/dist/unpkg/prod-deprecated/serializer/rest.js +12 -5
  345. package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -1
  346. package/dist/unpkg/prod-deprecated/serializer/transform.js +14 -10
  347. package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -1
  348. package/dist/unpkg/prod-deprecated/serializer.js +42 -3
  349. package/dist/unpkg/prod-deprecated/serializer.js.map +1 -1
  350. package/dist/unpkg/{prod/store-RGGc1ilN.js → prod-deprecated/store-Dsw2f4s-.js} +13 -7
  351. package/dist/unpkg/{prod/store-RGGc1ilN.js.map → prod-deprecated/store-Dsw2f4s-.js.map} +1 -1
  352. package/dist/unpkg/prod-deprecated/store.js +1 -1
  353. package/dist/unpkg/prod-deprecated/{util-CQQdHX3n.js → util-CVu5_VeN.js} +2 -3
  354. package/dist/unpkg/prod-deprecated/{util-CQQdHX3n.js.map → util-CVu5_VeN.js.map} +1 -1
  355. package/dist/unpkg/prod-deprecated/{utils-BMI_JwFP.js → utils-z1h-zTls.js} +2 -3
  356. package/dist/unpkg/prod-deprecated/{utils-BMI_JwFP.js.map → utils-z1h-zTls.js.map} +1 -1
  357. package/dist/{util-Bnx8nm-D.js → util-fMuLguoj.js} +2 -3
  358. package/dist/{util-Bnx8nm-D.js.map → util-fMuLguoj.js.map} +1 -1
  359. package/dist/{utils-ZAytYep8.js → utils-UqBsN9IU.js} +2 -3
  360. package/dist/{utils-ZAytYep8.js.map → utils-UqBsN9IU.js.map} +1 -1
  361. package/logos/README.md +1 -1
  362. package/package.json +17 -12
  363. package/dist/-private-DccRZQsm.js.map +0 -1
  364. package/dist/adapter-CARrK3-8.d.ts.map +0 -1
  365. package/dist/adapter-eYo2pIuM.js.map +0 -1
  366. package/dist/compat-BbNNmTM-.d.ts.map +0 -1
  367. package/dist/compat-DcHVxuuZ.js.map +0 -1
  368. package/dist/error-CzkyXr1Q.d.ts.map +0 -1
  369. package/dist/errors-CS110tMl.js.map +0 -1
  370. package/dist/extensions-DumNm4dA.d.ts.map +0 -1
  371. package/dist/json-BXNPTlcH.js.map +0 -1
  372. package/dist/model-62hn5_PD.d.ts.map +0 -1
  373. package/dist/model-DWH9f__L.js.map +0 -1
  374. package/dist/model-fragments-DSqu0ptR.js.map +0 -1
  375. package/dist/rest-0NhtexIq.d.ts.map +0 -1
  376. package/dist/schema-provider-DguGmQDS.js.map +0 -1
  377. package/dist/store-C4qYzXei.js.map +0 -1
  378. package/dist/unpkg/dev/-private-vOhxVExH.js.map +0 -1
  379. package/dist/unpkg/dev/adapter-oLwyr47q.js.map +0 -1
  380. package/dist/unpkg/dev/compat-DNQT2TQx.js.map +0 -1
  381. package/dist/unpkg/dev/errors-DnzvLM2A.js.map +0 -1
  382. package/dist/unpkg/dev/json-DDJji3V3.js.map +0 -1
  383. package/dist/unpkg/dev/model-BxPIR7m2.js.map +0 -1
  384. package/dist/unpkg/dev/model-fragments-DSqu0ptR.js.map +0 -1
  385. package/dist/unpkg/dev/schema-provider-CI_a48ja.js.map +0 -1
  386. package/dist/unpkg/dev/store-D_V8-HQl.js.map +0 -1
  387. package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js.map +0 -1
  388. package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js.map +0 -1
  389. package/dist/unpkg/dev-deprecated/compat-CeT0PnVX.js.map +0 -1
  390. package/dist/unpkg/dev-deprecated/errors-jHQESeNQ.js.map +0 -1
  391. package/dist/unpkg/dev-deprecated/json-DDJji3V3.js.map +0 -1
  392. package/dist/unpkg/dev-deprecated/model-BeGORt6h.js.map +0 -1
  393. package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
  394. package/dist/unpkg/dev-deprecated/schema-provider-NmtdR4n_.js.map +0 -1
  395. package/dist/unpkg/dev-deprecated/store-BCOLSC6z.js.map +0 -1
  396. package/dist/unpkg/prod/-private-SfXkkHKd.js.map +0 -1
  397. package/dist/unpkg/prod/adapter-DQ9UA7FC.js.map +0 -1
  398. package/dist/unpkg/prod/compat-DxiVkCUb.js.map +0 -1
  399. package/dist/unpkg/prod/errors-DQDfNqVx.js.map +0 -1
  400. package/dist/unpkg/prod/json-BD1kRTfB.js.map +0 -1
  401. package/dist/unpkg/prod/model-CYMA-e_S.js.map +0 -1
  402. package/dist/unpkg/prod/model-fragments-DSqu0ptR.js +0 -334
  403. package/dist/unpkg/prod/model-fragments-DSqu0ptR.js.map +0 -1
  404. package/dist/unpkg/prod/runtime--fcdnjmJ-DMTJ0Kb3.js +0 -53
  405. package/dist/unpkg/prod/schema-provider-05U1H-Kl.js.map +0 -1
  406. package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js.map +0 -1
  407. package/dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js.map +0 -1
  408. package/dist/unpkg/prod-deprecated/compat-DxiVkCUb.js.map +0 -1
  409. package/dist/unpkg/prod-deprecated/errors-ii4L43_1.js.map +0 -1
  410. package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js.map +0 -1
  411. package/dist/unpkg/prod-deprecated/model-D3oCPHtM.js.map +0 -1
  412. package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
  413. package/dist/unpkg/prod-deprecated/schema-provider-CKH_bnnS.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"store-C4qYzXei.js","names":["defineSignal","assertPrivateStore","ensureStringId","recordIdentifierFor","getOrSetGlobal","macroCondition","getGlobalConfig","preloadData","store","identifier","preload","jsonPayload","schemas","schema","fields","Object","keys","forEach","key","preloadValue","field","get","kind","relationships","preloadRelationship","attributes","cache","hasRecord","Boolean","_instanceCache","peek","upsert","relatedType","type","WarpDrive","env","DEBUG","test","Error","Array","isArray","data","map","value","_convertPreloadRelationshipToJSON","id","_resourceIsFullDeleted","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","RecordReference","___token","___identifier","constructor","notifications","subscribe","_","bucket","notifiedKey","_ref","destroy","unsubscribe","remoteType","push","objectOrPromise","Promise","resolve","then","peekRecord","load","findRecord","reload","prototype","AvailableShims","WeakMap","getShimClass","modelName","shims","create","set","shim","undefined","ShimModelClass","__store","Map","fieldSchemas","attrs","relationshipsByName","rels","eachAttribute","callback","binding","call","eachRelationship","eachTransformedAttribute","assertPrivateStore","constructResource","ensureStringId","recordIdentifierFor","storeFor","SkipCache","isMaybeIdentifier","normalizeModelName","getShimClass","preloadData","RecordReference","resourceIsFullyDeleted","macroCondition","getGlobalConfig","restoreDeprecatedStoreBehaviors","StoreKlass","prototype","findRecord","resource","id","options","WarpDrive","env","DEBUG","test","Error","isDestroying","isDestroyed","type","normalizedId","identifier","cacheKeyManager","getOrCreateRecordIdentifier","preload","_instanceCache","recordIsLoaded","reload","_join","promise","request","op","data","record","cacheOptions","then","document","content","findAll","query","queryRecord","getReference","resourceIdentifier","arguments","length","cache","upgradeInstanceCaches","__instances","reference","get","set","modelFor","schema","hasResource","saveRecord","Promise","reject","lid","resolve","operation","isNew","isDeleted","records","withReferences","WeakMap"],"sources":["../src/store/-private.ts","../src/store.ts"],"sourcesContent":["import type { NotificationType } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { defineSignal } from '@warp-drive/core/signals/-leaked';\nimport {\n assertPrivateStore,\n ensureStringId,\n type InstanceCache,\n recordIdentifierFor,\n} from '@warp-drive/core/store/-private';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { NewResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type {\n LegacyAttributeField,\n LegacyRelationshipField,\n LegacyRelationshipField as RelationshipSchema,\n} from '@warp-drive/core/types/schema/fields';\nimport type {\n ExistingResourceIdentifierObject,\n ExistingResourceObject,\n InnerRelationshipDocument,\n SingleResourceDocument,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { Store } from '../store.ts';\n\n/*\n When a find request is triggered on the store, the user can optionally pass in\n attributes and relationships to be preloaded. These are meant to behave as if they\n came back from the server, except the user obtained them out of band and is informing\n the store of their existence. The most common use case is for supporting client side\n nested URLs, such as `/posts/1/comments/2` so the user can do\n `store.findRecord('comment', 2, { preload: { post: 1 } })` without having to fetch the post.\n\n Preloaded data can be attributes and relationships passed in either as IDs or as actual\n models.\n */\ntype PreloadRelationshipValue = OpaqueRecordInstance | string;\nexport function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void {\n const jsonPayload: Partial<ExistingResourceObject> = {};\n //TODO(Igor) consider the polymorphic case\n const schemas = store.schema;\n const fields = schemas.fields(identifier);\n Object.keys(preload).forEach((key) => {\n const preloadValue = preload[key];\n\n const field = fields.get(key);\n if (field && (field.kind === 'hasMany' || field.kind === 'belongsTo')) {\n if (!jsonPayload.relationships) {\n jsonPayload.relationships = {};\n }\n jsonPayload.relationships[key] = preloadRelationship(field, preloadValue);\n } else {\n if (!jsonPayload.attributes) {\n jsonPayload.attributes = {};\n }\n jsonPayload.attributes[key] = preloadValue;\n }\n });\n const cache = store.cache;\n assertPrivateStore(store);\n const hasRecord = Boolean(store._instanceCache.peek(identifier));\n cache.upsert(identifier, jsonPayload, hasRecord);\n}\n\nfunction preloadRelationship(\n schema: RelationshipSchema,\n preloadValue: PreloadRelationshipValue | null | Array<PreloadRelationshipValue>\n): InnerRelationshipDocument<ExistingResourceIdentifierObject> {\n const relatedType = schema.type;\n\n if (schema.kind === 'hasMany') {\n assert('You need to pass in an array to set a hasMany property on a record', Array.isArray(preloadValue));\n return { data: preloadValue.map((value) => _convertPreloadRelationshipToJSON(value, relatedType)) };\n }\n\n assert('You should not pass in an array to set a belongsTo property on a record', !Array.isArray(preloadValue));\n return { data: preloadValue ? _convertPreloadRelationshipToJSON(preloadValue, relatedType) : null };\n}\n\n/*\n findRecord('user', '1', { preload: { friends: ['1'] }});\n findRecord('user', '1', { preload: { friends: [record] }});\n*/\nfunction _convertPreloadRelationshipToJSON(\n value: OpaqueRecordInstance | string,\n type: string\n): ExistingResourceIdentifierObject {\n if (typeof value === 'string' || typeof value === 'number') {\n return { type, id: ensureStringId(value) };\n }\n // TODO if not a record instance assert it's an identifier\n // and allow identifiers to be used\n return recordIdentifierFor(value) as ExistingResourceIdentifierObject;\n}\n\nexport interface BaseFinderOptions {\n reload?: boolean;\n backgroundReload?: boolean;\n include?: string | string[];\n adapterOptions?: Record<string, unknown>;\n}\nexport interface FindRecordOptions extends BaseFinderOptions {\n /**\n * Data to preload into the store before the request is made.\n * This feature is *highly* discouraged and has no corresponding\n * feature when using builders and handlers.\n *\n * Excepting relationships: the data should be in the form of a\n * JSON object where the keys are fields on the record and the value\n * is the raw value to be added to the cache.\n *\n * Relationships can either be provided as string IDs from which\n * an identifier will be built base upon the relationship's expected\n * resource type, or be record instances from which the identifier\n * will be extracted.\n *\n */\n preload?: Record<string, Value>;\n}\n\nexport type QueryOptions = {\n [K in string | 'adapterOptions']?: K extends 'adapterOptions' ? Record<string, unknown> : unknown;\n};\n\nexport type FindAllOptions = BaseFinderOptions;\nexport type LegacyResourceQuery = {\n include?: string | string[];\n [key: string]: Value | undefined;\n};\n\nexport type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;\n\n/**\n * Minimum subset of static schema methods and properties on the\n * \"model\" class.\n *\n * Only used when using the legacy schema-service implementation\n * for @ember-data/model or when wrapping schema for legacy\n * Adapters/Serializers.\n *\n */\nexport interface ModelSchema<T = unknown> {\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n fields: Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>;\n attributes: Map<KeyOrString<T>, LegacyAttributeField>;\n relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;\n eachAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void;\n eachRelationship<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void;\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, type: string | null) => void,\n binding?: T\n ): void;\n}\n\nfunction _resourceIsFullDeleted(identifier: ResourceKey, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nexport function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n A `RecordReference` is a low-level API that allows users and\n addon authors to perform meta-operations on a record.\n\n @hideconstructor\n @public\n*/\nexport class RecordReference {\n /** @internal */\n declare private store: Store;\n // unsubscribe token given to us by the notification manager\n /** @internal */\n private ___token!: object;\n /** @internal */\n private ___identifier: ResourceKey;\n /** @internal */\n declare private _ref: number;\n\n constructor(store: Store, identifier: ResourceKey) {\n this.store = store;\n this.___identifier = identifier;\n this.___token = store.notifications.subscribe(\n identifier,\n (_: ResourceKey, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'identity' || (bucket === 'attributes' && notifiedKey === 'id')) {\n this._ref++;\n }\n }\n );\n }\n\n /** @internal */\n destroy(): void {\n this.store.notifications.unsubscribe(this.___token);\n }\n\n get type(): string {\n return this.identifier().type;\n }\n\n /**\n The `id` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.id(); // '1'\n ```\n\n @public\n @return The id of the record.\n */\n id(): string | null {\n // oxlint-disable-next-line no-unused-expressions\n this._ref; // consume the tracked prop\n return this.___identifier.id;\n }\n\n /**\n The `identifier` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.identifier(); // '1'\n ```\n\n @public\n @return The identifier of the record.\n */\n identifier(): ResourceKey {\n return this.___identifier;\n }\n\n /**\n How the reference will be looked up when it is loaded. Currently\n this always returns `identity` to signify that a record will be\n loaded by its `type` and `id`.\n\n Example\n\n ```javascript\n const userRef = store.getReference('user', 1);\n\n userRef.remoteType(); // 'identity'\n ```\n\n @public\n */\n remoteType(): 'identity' {\n return 'identity';\n }\n\n /**\n This API allows you to provide a reference with new data. The\n simplest usage of this API is similar to `store.push`: you provide a\n normalized hash of data and the object represented by the reference\n will update.\n\n If you pass a promise to `push`, WarpDrive will not ask the adapter\n for the data if another attempt to fetch it is made in the\n interim. When the promise resolves, the underlying object is updated\n with the new data, and the promise returned by *this function* is resolved\n with that object.\n\n For example, `recordReference.push(promise)` will be resolved with a\n record.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({\n data: {\n id: \"1\",\n type: \"user\",\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n ```\n\n @public\n @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one\n @return a promise for the value (record or relationship)\n */\n push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance> {\n // TODO @deprecate pushing unresolved payloads\n return Promise.resolve(objectOrPromise).then((data) => {\n return this.store.push(data);\n });\n }\n\n /**\n If the entity referred to by the reference is already loaded, it is\n present as `reference.value`. Otherwise the value returned by this function\n is `null`.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.value(); // user\n ```\n\n @public\n @return the record for this RecordReference\n */\n value(): OpaqueRecordInstance | null {\n return this.store.peekRecord(this.___identifier);\n }\n\n /**\n Triggers a fetch for the backing entity based on its `remoteType`\n (see `remoteType` definitions per reference type).\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // load user (via store.find)\n userRef.load().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n load(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id);\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n\n /**\n Reloads the record if it is already loaded. If the record is not\n loaded it will load the record via `store.findRecord`\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // or trigger a reload\n userRef.reload().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n reload(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id, { reload: true });\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n}\n\ndefineSignal(RecordReference.prototype, '_ref');\n\n// if modelFor turns out to be a bottleneck we should replace with a Map\n// and clear it during store teardown.\nconst AvailableShims = getOrSetGlobal('AvailableShims', new WeakMap<Store, Record<string, ShimModelClass>>());\n\nexport function getShimClass<T>(\n store: Store,\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n): ShimModelClass<T> {\n let shims = AvailableShims.get(store);\n\n if (!shims) {\n shims = Object.create(null) as Record<string, ShimModelClass>;\n AvailableShims.set(store, shims);\n }\n\n let shim = shims[modelName];\n if (shim === undefined) {\n shim = shims[modelName] = new ShimModelClass<unknown>(store, modelName);\n }\n\n return shim;\n}\n\n// Mimics the static apis of @ember-data/model\nexport class ShimModelClass<T = unknown> implements ModelSchema<T> {\n declare __store: Store;\n declare modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string) {\n this.__store = store;\n this.modelName = modelName;\n }\n\n get fields(): Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'> {\n const fields = new Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>();\n const fieldSchemas = this.__store.schema.fields({ type: this.modelName });\n\n fieldSchemas.forEach((schema, key) => {\n if (schema.kind === 'attribute' || schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n fields.set(key as KeyOrString<T>, schema.kind);\n }\n });\n\n return fields;\n }\n\n get attributes(): Map<KeyOrString<T>, LegacyAttributeField> {\n const attrs = new Map<KeyOrString<T>, LegacyAttributeField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n attrs.set(key as KeyOrString<T>, schema);\n }\n });\n\n return attrs;\n }\n\n get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField> {\n const rels = new Map<KeyOrString<T>, LegacyRelationshipField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n rels.set(key as KeyOrString<T>, schema);\n }\n });\n\n return rels;\n }\n\n eachAttribute<K extends KeyOrString<T>>(\n callback: (key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachRelationship<K extends KeyOrString<T>>(\n callback: (key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (key: K, type: string | null) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n const type = schema.type;\n if (type) callback.call(binding, key as K, type);\n }\n });\n }\n}\n","import type { Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { LegacyLiveArray, LegacyQueryArray, PrivateStore } from '@warp-drive/core/store/-private';\nimport {\n assertPrivateStore,\n constructResource,\n ensureStringId,\n recordIdentifierFor,\n storeFor,\n} from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { isMaybeIdentifier } from './compat/builders/utils.ts';\nimport { normalizeModelName } from './model/-private/util.ts';\nimport type {\n FindAllOptions,\n FindRecordOptions,\n LegacyResourceQuery,\n ModelSchema,\n QueryOptions,\n} from './store/-private.ts';\nimport { getShimClass, preloadData, RecordReference, resourceIsFullyDeleted } from './store/-private.ts';\n\n/**\n * Restores the deprecated `findRecord`/`findAll`/`query`/`queryRecord`/\n * `findBelongsTo`/`findHasMany`/`createRecord`/`deleteRecord`/`saveRecord`\n * legacy-network-layer implementations of these methods onto the given\n * `Store` subclass, for apps that have not yet migrated to the\n * `RequestManager`-based equivalents.\n */\nexport function restoreDeprecatedStoreBehaviors(StoreKlass: typeof Store): void {\n StoreKlass.prototype.findRecord = function (\n resource: string | ResourceIdentifierObject,\n id?: string | number | FindRecordOptions,\n options?: FindRecordOptions\n ): Promise<unknown> {\n assert(\n `Attempted to call store.findRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = id as FindRecordOptions;\n } else {\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(id as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resource);\n options = options || {};\n assertPrivateStore(this);\n\n if (options.preload) {\n // force reload if we preload to ensure we don't resolve the promise\n // until we are complete, else we will end up background-reloading\n // even for initial load.\n if (!this._instanceCache.recordIsLoaded(identifier)) {\n options.reload = true;\n }\n this._join(() => {\n preloadData(this, identifier, options.preload!);\n });\n }\n\n const promise = this.request<OpaqueRecordInstance>({\n op: 'findRecord',\n data: {\n record: identifier,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => {\n return document.content;\n });\n };\n\n StoreKlass.prototype.findAll = function <T>(\n type: TypeFromInstance<T> | string,\n options: FindAllOptions = {}\n ): Promise<LegacyLiveArray<T>> {\n assert(\n `Attempted to call store.findAll(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's findAll method`, type);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyLiveArray<T>>({\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.query = function (\n type: string,\n query: LegacyResourceQuery,\n options: QueryOptions = {}\n ): Promise<LegacyQueryArray> {\n assert(\n `Attempted to call store.query(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's query method`, type);\n assert(`You need to pass a query hash to the store's query method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyQueryArray>({\n op: 'query',\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.queryRecord = function (\n type: string,\n query: Record<string, unknown>,\n options?: QueryOptions\n ): Promise<OpaqueRecordInstance | null> {\n assert(\n `Attempted to call store.queryRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's queryRecord method`, type);\n assert(`You need to pass a query hash to the store's queryRecord method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<OpaqueRecordInstance | null>({\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n // do not put a ts-expect-error here, because typedoc will fail to\n // build due to this error only occurring when references are in use in the editor.\n // The return statement below casts to `PrivateStore['getReference']`'s return\n // type rather than annotating this function `: RecordReference` directly,\n // since this package's `RecordReference` and core's `deprecated/-private.ts`\n // copy are structurally identical but nominally distinct classes (TS treats\n // their private fields as separate brands); casting only the return value\n // (instead of the whole function) keeps `this` contextually typed from the\n // assignment target below.\n StoreKlass.prototype.getReference = function (resource: string | ResourceIdentifierObject, id: string | number) {\n assert(\n `Attempted to call store.getReference(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n let resourceIdentifier: ResourceIdentifierObject;\n if (arguments.length === 1 && isMaybeIdentifier(resource)) {\n resourceIdentifier = resource;\n } else {\n const type = normalizeModelName(resource as string);\n const normalizedId = ensureStringId(id);\n resourceIdentifier = constructResource(type, normalizedId);\n }\n\n assert(\n 'getReference expected to receive either a resource identifier or type and id as arguments',\n isMaybeIdentifier(resourceIdentifier)\n );\n\n const identifier: ResourceKey = this.cacheKeyManager.getOrCreateRecordIdentifier(resourceIdentifier);\n assertPrivateStore(this);\n\n const cache = upgradeInstanceCaches(this._instanceCache.__instances).reference;\n let reference = cache.get(identifier);\n\n if (!reference) {\n reference = new RecordReference(this, identifier);\n cache.set(identifier, reference);\n }\n return reference;\n };\n\n StoreKlass.prototype.modelFor = function <T>(\n type: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n ): ModelSchema<T> {\n assert(`Attempted to call store.modelFor(), but the store instance has already been destroyed.`, !this.isDestroyed);\n assert(`You need to pass <type> to the store's modelFor method`, typeof type === 'string' && type.length);\n assert(`No model was found for '${type}' and no schema handles the type`, this.schema.hasResource({ type }));\n\n return getShimClass<T>(this, type);\n };\n\n StoreKlass.prototype.saveRecord = function <T>(record: T, options: Record<string, unknown> = {}): Promise<T> {\n assert(\n `Attempted to call store.saveRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`Unable to initiate save for a record in a disconnected state`, storeFor(record, true));\n const identifier = recordIdentifierFor(record);\n const cache = this.cache;\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we reject here to prevent bad things.\n return Promise.reject(new Error(`Record Is Disconnected`));\n }\n assertPrivateStore(this);\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n this._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(this._instanceCache, identifier)) {\n return Promise.resolve(record);\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n const request = {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n\n return this.request<T>(request).then((document) => document.content);\n };\n}\n\nexport type { Store };\n\ntype Caches = PrivateStore['_instanceCache']['__instances'];\nfunction upgradeInstanceCaches(cache: Caches): Caches & { reference: WeakMap<ResourceKey, RecordReference> } {\n const withReferences = cache as Caches & { reference: WeakMap<ResourceKey, RecordReference> };\n if (!withReferences.reference) {\n withReferences.reference = new WeakMap();\n }\n\n return withRefer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js","names":["Context","upgradeStore","SnapshotRecordArray","constructor","store","type","options","__store","_snapshots","modelName","adapterOptions","include","_recordArray","peekAll","length","snapshots","_fetchManager","LiveArrayContext","source","map","identifier","createSnapshot","assertIdentifierHasId","identifier","test","Error","id","validateDocumentStructure","doc","errors","push","data","Array","isArray","meta","links","jsonapi","included","test","Error","join","length","normalizeResponseHelper","serializer","store","modelClass","payload","id","requestType","normalizedResponse","normalizeResponse","assertPrivateStore","upgradeStore","Snapshot","constructor","options","identifier","store","_store","__attributes","_belongsToRelationships","Object","create","_belongsToIds","_hasManyRelationships","_hasManyIds","hasRecord","_instanceCache","peek","modelName","type","_attributes","id","adapterOptions","include","cache","_changedAttributes","changedAttrs","record","peekRecord","test","Error","lid","attributes","eachAttribute","key","meta","getAttr","isNew","attr","keyName","changedAttributes","changedAttributeKeys","keys","i","length","slice","belongsTo","returnModeIsId","result","relationshipMeta","schema","fields","get","kind","_graph","relationship","value","getRelationship","data","inverseIdentifier","cacheKeyManager","getOrCreateRecordIdentifier","undefined","isDeleted","_fetchManager","createSnapshot","hasMany","returnModeIsIds","ids","results","cachedIds","cachedSnapshots","forEach","member","push","callback","binding","modelFor","modelSchema","field","call","eachRelationship","serialize","serializer","serializerFor","createDeferred","waitFor","assertPrivateStore","coerceId","getOrSetGlobal","upgradeStore","assertIdentifierHasId","payloadIsNotBlank","normalizeResponseHelper","Snapshot","SaveOp","Symbol","FetchManager","constructor","store","_store","_pendingFetch","Map","requestCache","getRequestStateService","isDestroyed","createSnapshot","identifier","options","scheduleSave","resolver","query","op","recordIdentifier","queryRequest","data","snapshot","pendingSaveItem","monitored","_enqueue","promise","_flushPendingSave","scheduleFetch","request","pendingFetch","getPendingFetch","modelName","type","pendingFetchItem","resolverPromise","isInitialLoad","_instanceCache","recordIsLoaded","then","payload","Array","isArray","lid","potentiallyNewIm","_push","reload","error","test","Error","cache","isEmpty","isReleasable","_graph","graph","unload","_enableAsyncFlush","unloadRecord","size","Promise","resolve","setTimeout","flushAllPendingFetches","fetchesByType","fetchesById","get","set","requestsForIdentifier","push","disableTestWaiter","pendingFetches","matchingPendingFetch","find","fetch","isSameRequest","forEach","fetchItem","_flushPendingFetchForType","clear","fetchDataIfNeededForIdentifier","_isEmpty","isLoading","_isLoading","Object","assign","destroy","instanceCache","isNew","isDeleted","req","isLoaded","getPendingRequestsForRecord","some","r","includesSatisfies","current","existing","length","arrCurrent","split","sort","arrExisting","join","i","includes","optionsSatisfies","keys","existingOptions","adapterOptions","include","_findMany","adapter","snapshots","modelClass","modelFor","ids","map","s","id","every","v","findMany","ret","undefined","adapterPayload","serializer","serializerFor","rejectFetchedItems","fetchMap","l","pair","reject","handleFoundRecords","coalescedPayload","snapshotsById","snapshotGroup","included","resources","resource","delete","rejected","snapshotArray","console","warn","values","_fetchRecord","findRecord","_fetchManager","klass","isDestroying","_processCoalescedGroup","group","payloads","catch","pendingFetchMap","adapterFor","shouldCoalesce","coalesceFindRequests","pendingFetchItems","totalItems","groups","groupRecordsForFindMany","pending","operation"],"sources":["../../../src/compat/legacy-network-handler/snapshot-record-array.ts","../../../src/compat/legacy-network-handler/identifier-has-id.ts","../../../src/compat/legacy-network-handler/legacy-data-utils.ts","../../../src/compat/legacy-network-handler/serializer-response.ts","../../../src/compat/legacy-network-handler/snapshot.ts","../../../src/compat/legacy-network-handler/fetch-manager.ts","../../../src/compat/-private.ts"],"sourcesContent":["import type { Store } from '@warp-drive/core';\nimport { Context } from '@warp-drive/core/reactive/-private';\nimport type { LegacyLiveArray, PrivateReactiveResourceArray } from '@warp-drive/core/store/-private';\nimport type { FindAllOptions, ModelSchema } from '@warp-drive/core/types';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\n\nimport { upgradeStore } from '../-private.ts';\nimport type { Snapshot } from './snapshot.ts';\n/**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters for certain `findAll` requests.\n\n @hideconstructor\n @public\n*/\nexport class SnapshotRecordArray {\n /**\n * An array of snapshots\n *\n * @internal\n */\n declare private _snapshots: Snapshot[] | null;\n\n /** @internal */\n declare private _type: ModelSchema | null;\n\n /**\n * The ResourceType of the underlying records for the {@link Snapshot | Snapshots} in the array\n */\n declare modelName: string;\n\n /** @internal */\n declare private __store: Store;\n\n /**\n * A hash of adapter options passed into the store method for this request.\n\n Example\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n */\n declare adapterOptions?: Record<string, unknown>;\n /**\n * The relationships to include for this request.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type, snapshotRecordArray) {\n let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n }\n ```\n */\n declare include?: string | string[];\n\n /**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters and serializers for certain requests.\n\n @private\n @constructor\n @param {Store} store\n @param {String} type\n @param options\n */\n constructor(store: Store, type: string, options: FindAllOptions = {}) {\n this.__store = store;\n this._snapshots = null;\n this.modelName = type;\n this.adapterOptions = options.adapterOptions;\n this.include = options.include;\n }\n\n /**\n An array of records\n\n @internal\n */\n get _recordArray(): LegacyLiveArray {\n return this.__store.peekAll(this.modelName);\n }\n\n /**\n Number of records in the array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n });\n ```\n */\n get length(): number {\n return this._recordArray.length;\n }\n\n /**\n Get snapshots of the underlying record array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n }\n ```\n\n @public\n @return Array of snapshots\n */\n snapshots(): Snapshot[] {\n if (this._snapshots !== null) {\n return this._snapshots;\n }\n upgradeStore(this.__store);\n\n const { _fetchManager } = this.__store;\n const LiveArrayContext = (this._recordArray as unknown as PrivateReactiveResourceArray)[Context];\n this._snapshots = LiveArrayContext.source.map((identifier: ResourceKey) =>\n _fetchManager.createSnapshot(identifier)\n );\n\n return this._snapshots;\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport type { PersistedResourceKey } from '@warp-drive/core/types/identifier';\n\nexport function assertIdentifierHasId(identifier: unknown): asserts identifier is PersistedResourceKey {\n assert(\n `Attempted to schedule a fetch for a record without an id.`,\n identifier && (identifier as PersistedResourceKey).id !== null\n );\n}\n","import type { AdapterPayload } from './minimum-adapter-interface.ts';\n\ntype IteratorCB<T> = ((o: T, index: number) => T) | ((o: T) => T);\n\nexport function iterateData<T>(data: T[] | T, fn: IteratorCB<T>): T | T[] {\n if (Array.isArray(data)) {\n return data.map(fn);\n } else {\n return fn(data, 0);\n }\n}\n\nexport function payloadIsNotBlank<T>(adapterPayload: T | AdapterPayload): adapterPayload is AdapterPayload {\n if (Array.isArray(adapterPayload)) {\n return true;\n } else {\n return Object.keys(adapterPayload || {}).length !== 0;\n }\n}\n","import type { Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { ModelSchema } from '@warp-drive/core/types';\nimport type { JsonApiDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { AdapterPayload } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface, RequestType } from './minimum-serializer-interface.ts';\n\n/**\n This is a helper method that validates a JSON API top-level document\n\n The format of a document is described here:\n http://jsonapi.org/format/#document-top-level\n\n @internal\n*/\nfunction validateDocumentStructure(doc?: AdapterPayload | JsonApiDocument): asserts doc is JsonApiDocument {\n if (DEBUG) {\n const errors: string[] = [];\n if (!doc || typeof doc !== 'object') {\n errors.push('Top level of a JSON API document must be an object');\n } else {\n if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {\n errors.push('One or more of the following keys must be present: \"data\", \"errors\", \"meta\".');\n } else {\n if ('data' in doc && 'errors' in doc) {\n errors.push('Top level keys \"errors\" and \"data\" cannot both be present in a JSON API document');\n }\n }\n if ('data' in doc) {\n if (!(doc.data === null || Array.isArray(doc.data) || typeof doc.data === 'object')) {\n errors.push('data must be null, an object, or an array');\n }\n }\n if ('meta' in doc) {\n if (typeof doc.meta !== 'object') {\n errors.push('meta must be an object');\n }\n }\n if ('errors' in doc) {\n if (!Array.isArray(doc.errors)) {\n errors.push('errors must be an array');\n }\n }\n if ('links' in doc) {\n if (typeof doc.links !== 'object') {\n errors.push('links must be an object');\n }\n }\n if ('jsonapi' in doc) {\n if (typeof doc.jsonapi !== 'object') {\n errors.push('jsonapi must be an object');\n }\n }\n if ('included' in doc) {\n if (typeof doc.included !== 'object') {\n errors.push('included must be an array');\n }\n }\n }\n\n assert(\n `Response must be normalized to a valid JSON API document:\\n\\t* ${errors.join('\\n\\t* ')}`,\n errors.length === 0\n );\n }\n}\n\nexport function normalizeResponseHelper(\n serializer: MinimumSerializerInterface | null,\n store: Store,\n modelClass: ModelSchema,\n payload: AdapterPayload,\n id: string | null,\n requestType: RequestType\n): JsonApiDocument {\n const normalizedResponse = serializer\n ? serializer.normalizeResponse(store, modelClass, payload, id, requestType)\n : payload;\n\n validateDocumentStructure(normalizedResponse);\n\n return normalizedResponse;\n}\n","import type { Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { FindRecordOptions } from '@warp-drive/core/types';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core/types/cache/relationship';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core/types/schema/fields';\n\nimport { upgradeStore } from '../-private';\nimport type { SerializerOptions } from './minimum-serializer-interface';\n\ntype RecordId = string | null;\n\n/**\n Snapshot is not directly instantiable.\n Instances are provided to a consuming application's\n adapters and serializers for certain requests.\n\n Snapshots are only available when using `@ember-data/legacy-compat`\n for legacy compatibility with adapters and serializers.\n\n For serialization of records in modern paradigms, request data from\n the cache or off the record directly.\n\n @hideconstructor\n @public\n*/\nexport class Snapshot<R = unknown> {\n /** @internal */\n declare private __attributes: Record<keyof R & string, unknown> | null;\n /** @internal */\n declare private _belongsToRelationships: Record<string, Snapshot>;\n /** @internal */\n declare private _belongsToIds: Record<string, RecordId>;\n /** @internal */\n declare private _hasManyRelationships: Record<string, Snapshot[]>;\n /** @internal */\n declare private _hasManyIds: Record<string, RecordId[]>;\n /** @internal */\n declare private _changedAttributes: ChangedAttributesHash;\n /** @internal */\n declare private _store: Store;\n\n /**\n The unique ResourceKey associated with this Snapshot.\n\n @public\n */\n declare identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;\n\n /**\n The ResourceType of the underlying record for this Snapshot, as a string.\n\n @public\n */\n declare modelName: R extends TypedRecordInstance ? TypeFromInstance<R> : string;\n\n /**\n The id of the snapshot's underlying record\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.id; // => '1'\n ```\n\n @public\n */\n declare id: string | null;\n\n /**\n If `include` was passed to the options for the request, the value\n would be available here.\n\n @public\n */\n declare include?: string | string[];\n\n /**\n The adapterOptions passed to the request which generated this Snapshot, if any\n\n @public\n */\n declare adapterOptions?: Record<string, unknown>;\n\n constructor(\n options: FindRecordOptions,\n identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>,\n store: Store\n ) {\n this._store = store;\n\n this.__attributes = null;\n this._belongsToRelationships = Object.create(null) as Record<string, Snapshot>;\n this._belongsToIds = Object.create(null) as Record<string, RecordId>;\n this._hasManyRelationships = Object.create(null) as Record<string, Snapshot[]>;\n this._hasManyIds = Object.create(null) as Record<string, RecordId[]>;\n\n assertPrivateStore(store);\n const hasRecord = !!store._instanceCache.peek(identifier);\n this.modelName = identifier.type;\n this.identifier = identifier;\n\n /*\n If the we do not yet have a record, then we are\n likely a snapshot being provided to a find request, so we\n populate __attributes lazily. Else, to preserve the \"moment\n in time\" in which a snapshot is created, we greedily grab\n the values.\n */\n if (hasRecord) {\n // oxlint-disable-next-line no-unused-expressions\n this._attributes;\n }\n\n this.id = identifier.id;\n this.adapterOptions = options.adapterOptions;\n this.include = options.include;\n this.modelName = identifier.type;\n\n if (hasRecord) {\n const cache = this._store.cache;\n this._changedAttributes = cache.changedAttrs(identifier);\n }\n }\n\n /**\n The underlying record for this snapshot. Can be used to access methods and\n properties defined on the record.\n\n ```js\n const someValue = snapshot.record.someProp;\n ```\n\n @property record\n @public\n */\n get record(): R | null {\n const record = this._store.peekRecord<R>(this.identifier);\n assert(\n `Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`,\n record !== null\n );\n return record;\n }\n\n /** @internal */\n private get _attributes(): Record<keyof R & string, unknown> {\n if (this.__attributes !== null) {\n return this.__attributes;\n }\n const attributes = (this.__attributes = Object.create(null) as Record<string, unknown>);\n const { identifier } = this;\n const cache = this._store.cache;\n\n this.eachAttribute((key: string, meta: LegacyAttributeField) => {\n attributes[key] = cache.getAttr(identifier, key);\n });\n\n return attributes;\n }\n\n get isNew(): boolean {\n const cache = this._store.cache;\n return cache?.isNew(this.identifier) || false;\n }\n\n /**\n Returns the value of an attribute.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attr('author'); // => 'Tomster'\n postSnapshot.attr('title'); // => 'Ember.js rocks'\n ```\n\n Note: Values are loaded eagerly and cached when the snapshot is created.\n\n @return The attribute value or undefined\n @public\n */\n attr(keyName: keyof R & string): unknown {\n if (keyName in this._attributes) {\n return this._attributes[keyName];\n }\n assert(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`, false);\n }\n\n /**\n Returns all attributes and their corresponding values.\n\n ::: warning ⚠️ WARNING\n Attributes are SHALLOW copied from the cache.\n Because they are NOT deep copied from the cache, mutating\n any object or array fields will cause unintended side-effects\n and bugs.\n :::\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n ```\n\n @return All attributes of the current snapshot\n @public\n */\n attributes(): Record<keyof R & string, unknown> {\n return { ...this._attributes };\n }\n\n /**\n Returns all changed attributes and their old and new values.\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postModel.set('title', 'Ember.js rocks!');\n postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n ```\n\n @return All changed attributes of the current snapshot\n @public\n */\n changedAttributes(): ChangedAttributesHash {\n const changedAttributes = Object.create(null) as ChangedAttributesHash;\n if (!this._changedAttributes) {\n return changedAttributes;\n }\n\n const changedAttributeKeys = Object.keys(this._changedAttributes);\n\n for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {\n const key = changedAttributeKeys[i];\n changedAttributes[key] = this._changedAttributes[key].slice() as [Value | undefined, Value];\n }\n\n return changedAttributes;\n }\n\n /**\n Returns the current value of a belongsTo relationship.\n\n `belongsTo` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `id`: set to `true` if you only want the ID of the related record to be\n returned.\n\n Example\n\n ```js\n // store.push('post', { id: 1, title: 'Hello World' });\n // store.createRecord('comment', { body: 'Lorem ipsum', post: post });\n commentSnapshot.belongsTo('post'); // => Snapshot\n commentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n // store.push('comment', { id: 1, body: 'Lorem ipsum' });\n commentSnapshot.belongsTo('post'); // => undefined\n ```\n\n Calling `belongsTo` will return a new Snapshot as long as there's any known\n data for the relationship available, such as an ID. If the relationship is\n known but unset, `belongsTo` will return `null`. If the contents of the\n relationship is unknown `belongsTo` will return `undefined`.\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @public\n @return A snapshot or ID of a known relationship or null if the\n relationship is known but unset. undefined will be returned if the\n contents of the relationship are unknown.\n */\n belongsTo(keyName: string, options?: { id?: boolean }): Snapshot | RecordId | undefined {\n const returnModeIsId = !!(options && options.id);\n let result: Snapshot | RecordId | undefined;\n const store = this._store;\n\n if (returnModeIsId === true && keyName in this._belongsToIds) {\n return this._belongsToIds[keyName];\n }\n\n if (returnModeIsId === false && keyName in this._belongsToRelationships) {\n return this._belongsToRelationships[keyName];\n }\n\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'belongsTo'\n );\n\n assert(`snapshot.belongsTo only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a hasMany.`,\n relationship.kind === 'belongsTo'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName);\n const data = value && value.data;\n upgradeStore(store);\n\n const inverseIdentifier = data ? store.cacheKeyManager.getOrCreateRecordIdentifier(data) : null;\n\n if (value && value.data !== undefined) {\n const cache = store.cache;\n\n if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsId) {\n result = inverseIdentifier.id;\n } else {\n result = store._fetchManager.createSnapshot(inverseIdentifier);\n }\n } else {\n result = null;\n }\n }\n\n if (returnModeIsId) {\n this._belongsToIds[keyName] = result as RecordId;\n } else {\n this._belongsToRelationships[keyName] = result as Snapshot;\n }\n\n return result;\n }\n\n /**\n Returns the current value of a hasMany relationship.\n\n `hasMany` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `ids`: set to `true` if you only want the IDs of the related records to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\n postSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\n postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n // store.push('post', { id: 1, title: 'Hello World' });\n postSnapshot.hasMany('comments'); // => undefined\n ```\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @public\n @return An array of snapshots or IDs of a known\n relationship or an empty array if the relationship is known but unset.\n undefined will be returned if the contents of the relationship is unknown.\n */\n hasMany(keyName: string, options?: { ids?: boolean }): RecordId[] | Snapshot[] | undefined {\n const returnModeIsIds = !!(options && options.ids);\n let results: RecordId[] | Snapshot[] | undefined;\n const cachedIds: RecordId[] | undefined = this._hasManyIds[keyName];\n const cachedSnapshots: Snapshot[] | undefined = this._hasManyRelationships[keyName];\n\n if (returnModeIsIds === true && keyName in this._hasManyIds) {\n return cachedIds;\n }\n\n if (returnModeIsIds === false && keyName in this._hasManyRelationships) {\n return cachedSnapshots;\n }\n\n const store = this._store;\n upgradeStore(store);\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'hasMany'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n assert(`snapshot.hasMany only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a belongsTo.`,\n relationship.kind === 'hasMany'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName) as CollectionRelationship;\n\n if (value.data) {\n results = [];\n value.data.forEach((member) => {\n const inverseIdentifier = store.cacheKeyManager.getOrCreateRecordIdentifier(member);\n const cache = store.cache;\n\n if (!cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsIds) {\n (results as RecordId[]).push(inverseIdentifier.id);\n } else {\n (results as Snapshot[]).push(store._fetchManager.createSnapshot(inverseIdentifier));\n }\n }\n });\n }\n\n // we assign even if `undefined` so that we don't reprocess the relationship\n // on next access. This works with the `keyName in` checks above.\n if (returnModeIsIds) {\n this._hasManyIds[keyName] = results as RecordId[];\n } else {\n this._hasManyRelationships[keyName] = results as Snapshot[];\n }\n\n return results;\n }\n\n /**\n Iterates through all the attributes of the model, calling the passed\n function on each attribute.\n\n Example\n\n ```javascript\n snapshot.eachAttribute(function(name, meta) {\n // ...\n });\n ```\n\n @param callback the callback to execute\n @param binding the optional value to which the callback's `this` should be bound\n @public\n */\n eachAttribute(callback: (key: string, meta: LegacyAttributeField) => void, binding?: unknown): void {\n // if the store has a modelFor implementation, we use it to iterate attributes. This allows\n // a custom \"ModelSchema\" class for legacy serializers to adapt to new fields if desired.\n if (typeof this._store.modelFor === 'function') {\n const modelSchema = this._store.modelFor(this.identifier.type);\n modelSchema.eachAttribute(callback, binding);\n } else {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'attribute') {\n callback.call(binding, key, field);\n }\n });\n }\n }\n\n /**\n Iterates through all the relationships of the model, calling the passed\n function on each relationship.\n\n Example\n\n ```javascript\n snapshot.eachRelationship(function(name, relationship) {\n // ...\n });\n ```\n\n @param callback the callback to execute\n @param binding the optional value to which the callback's `this` should be bound\n @public\n */\n eachRelationship(callback: (key: string, meta: LegacyRelationshipField) => void, binding?: unknown): void {\n // if the store has a modelFor implementation, we use it to iterate relationships. This allows\n // a custom \"ModelSchema\" class for legacy serializers to adapt to new fields if desired.\n if (typeof this._store.modelFor === 'function') {\n const modelSchema = this._store.modelFor(this.identifier.type);\n modelSchema.eachRelationship(callback, binding);\n } else {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'belongsTo' || field.kind === 'hasMany') {\n callback.call(binding, key, field);\n }\n });\n }\n }\n\n /**\n Serializes the snapshot using the serializer for the model.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = snapshot.serialize({ includeId: true });\n let url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n });\n ```\n\n @return an object whose values are primitive JSON values only\n @public\n */\n serialize(options?: SerializerOptions): unknown {\n upgradeStore(this._store);\n const serializer = this._store.serializerFor(this.modelName);\n assert(`Cannot serialize record, no serializer found`, serializer);\n return serializer.serialize(this, options);\n }\n}\n","import { warn } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { createDeferred } from '@warp-drive/core/request';\nimport { waitFor } from '@warp-drive/core/signals/-leaked';\nimport type {\n FindRecordQuery,\n InstanceCache,\n PrivateRequestStateService,\n PrivateStore,\n Request,\n SaveRecordMutation,\n} from '@warp-drive/core/store/-private';\nimport { assertPrivateStore, coerceId } from '@warp-drive/core/store/-private';\nimport type { FindRecordOptions, ModelSchema } from '@warp-drive/core/types';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { PersistedResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { ImmutableRequestInfo } from '@warp-drive/core/types/request';\nimport type { CollectionResourceDocument, SingleResourceDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private.ts';\nimport { assertIdentifierHasId } from './identifier-has-id.ts';\nimport { payloadIsNotBlank } from './legacy-data-utils.ts';\nimport type { AdapterPayload, MinimumAdapterInterface } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface.ts';\nimport { normalizeResponseHelper } from './serializer-response.ts';\nimport { Snapshot } from './snapshot.ts';\n\ntype Deferred<T> = ReturnType<typeof createDeferred<T>>;\ntype AdapterErrors = Error & { errors?: string[]; isAdapterError?: true };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nexport const SaveOp: '___(unique) Symbol(SaveOp)' = getOrSetGlobal('SaveOp', Symbol('SaveOp'));\n\nexport type FetchMutationOptions = FindRecordOptions & { [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord' };\n\ninterface PendingFetchItem {\n identifier: PersistedResourceKey;\n queryRequest: Request;\n // oxlint-disable-next-line typescript/no-explicit-any\n resolver: Deferred<any>;\n options: FindRecordOptions;\n trace?: unknown;\n promise: Promise<PersistedResourceKey>;\n}\n\ninterface PendingSaveItem {\n // oxlint-disable-next-line typescript/no-explicit-any\n resolver: Deferred<any>;\n snapshot: Snapshot;\n identifier: ResourceKey;\n options: FetchMutationOptions;\n queryRequest: Request;\n}\n\n/**\n * @private\n */\nexport class FetchManager {\n /**\n * @internal\n */\n declare isDestroyed: boolean;\n /** @internal */\n declare private requestCache: PrivateRequestStateService;\n // fetches pending in the runloop, waiting to be coalesced\n /**\n * @internal\n */\n declare _pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;\n\n /** @internal */\n declare private _store: PrivateStore;\n\n constructor(store: Store) {\n assertPrivateStore(store);\n this._store = store;\n // used to keep track of all the find requests that need to be coalesced\n this._pendingFetch = new Map();\n this.requestCache = store.getRequestStateService();\n this.isDestroyed = false;\n }\n\n createSnapshot<T>(identifier: ResourceKey<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;\n createSnapshot(identifier: ResourceKey, options?: FindRecordOptions): Snapshot;\n createSnapshot(identifier: ResourceKey, options: FindRecordOptions = {}): Snapshot {\n return new Snapshot(options, identifier, this._store);\n }\n\n /**\n This method is called by `record.save`, and gets passed a\n resolver for the promise that `record.save` returns.\n\n It schedules saving to happen at the end of the run loop.\n\n @private\n */\n scheduleSave(identifier: ResourceKey, options: FetchMutationOptions): Promise<null | SingleResourceDocument> {\n const resolver = createDeferred<SingleResourceDocument | null>();\n const query: SaveRecordMutation = {\n op: 'saveRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const snapshot = this.createSnapshot(identifier, options);\n const pendingSaveItem: PendingSaveItem = {\n snapshot: snapshot,\n resolver: resolver,\n identifier,\n options,\n queryRequest,\n };\n\n const monitored = this.requestCache._enqueue(resolver.promise, pendingSaveItem.queryRequest);\n _flushPendingSave(this._store, pendingSaveItem);\n\n return monitored;\n }\n\n scheduleFetch(\n identifier: PersistedResourceKey,\n options: FindRecordOptions,\n request: ImmutableRequestInfo\n ): Promise<PersistedResourceKey> {\n const query: FindRecordQuery = {\n op: 'findRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const pendingFetch = this.getPendingFetch(identifier, options);\n if (pendingFetch) {\n return pendingFetch;\n }\n\n const modelName = identifier.type;\n\n const resolver = createDeferred<SingleResourceDocument>();\n const pendingFetchItem: PendingFetchItem = {\n identifier,\n resolver,\n options,\n queryRequest,\n } as PendingFetchItem;\n\n const resolverPromise = resolver.promise;\n const store = this._store;\n const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request\n\n const monitored = this.requestCache._enqueue(resolverPromise, pendingFetchItem.queryRequest);\n let promise = monitored.then(\n (payload) => {\n // ensure that regardless of id returned we assign to the correct record\n if (payload.data && !Array.isArray(payload.data)) {\n payload.data.lid = identifier.lid;\n }\n\n // additional data received in the payload\n // may result in the merging of identifiers (and thus records)\n const potentiallyNewIm = store._push(payload, options.reload);\n if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {\n return potentiallyNewIm;\n }\n\n return identifier;\n },\n (error) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !store.isDestroyed);\n const cache = store.cache;\n if (!cache || cache.isEmpty(identifier) || isInitialLoad) {\n let isReleasable = true;\n if (store._graph) {\n const graph = store._graph;\n if (!cache) {\n isReleasable = graph.isReleasable(identifier);\n if (!isReleasable) {\n graph.unload(identifier, true);\n }\n }\n }\n if (cache || isReleasable) {\n store._enableAsyncFlush = true;\n store._instanceCache.unloadRecord(identifier);\n store._enableAsyncFlush = null;\n }\n }\n throw error;\n }\n );\n\n if (this._pendingFetch.size === 0) {\n void new Promise((resolve) => setTimeout(resolve, 0)).then(() => {\n this.flushAllPendingFetches();\n });\n }\n\n const fetchesByType = this._pendingFetch;\n let fetchesById = fetchesByType.get(modelName);\n\n if (!fetchesById) {\n fetchesById = new Map();\n fetchesByType.set(modelName, fetchesById);\n }\n\n let requestsForIdentifier = fetchesById.get(identifier);\n if (!requestsForIdentifier) {\n requestsForIdentifier = [];\n fetchesById.set(identifier, requestsForIdentifier);\n }\n\n requestsForIdentifier.push(pendingFetchItem);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n promise = waitFor(promise);\n }\n }\n\n pendingFetchItem.promise = promise;\n return promise;\n }\n\n getPendingFetch(\n identifier: PersistedResourceKey,\n options: FindRecordOptions\n ): Promise<PersistedResourceKey> | undefined {\n const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);\n\n // We already have a pending fetch for this\n if (pendingFetches) {\n const matchingPendingFetch = pendingFetches.find((fetch) => isSameRequest(options, fetch.options));\n if (matchingPendingFetch) {\n return matchingPendingFetch.promise;\n }\n }\n }\n\n flushAllPendingFetches(): void {\n if (this.isDestroyed) {\n return;\n }\n\n const store = this._store;\n this._pendingFetch.forEach((fetchItem, type) => _flushPendingFetchForType(store, fetchItem, type));\n this._pendingFetch.clear();\n }\n\n fetchDataIfNeededForIdentifier(\n identifier: PersistedResourceKey,\n options: FindRecordOptions | undefined = {},\n request: ImmutableRequestInfo\n ): Promise<PersistedResourceKey> {\n // pre-loading will change the isEmpty value\n const isEmpty = _isEmpty(this._store._instanceCache, identifier);\n const isLoading = _isLoading(this._store._instanceCache, identifier);\n\n let promise: Promise<PersistedResourceKey>;\n if (isEmpty) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n promise = this.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), request);\n } else {\n options.reload = true;\n promise = this.scheduleFetch(identifier, options, request);\n }\n } else if (isLoading) {\n promise = this.getPendingFetch(identifier, options)!;\n assert(`Expected to find a pending request for a record in the loading state, but found none`, promise);\n } else {\n promise = Promise.resolve(identifier);\n }\n\n return promise;\n }\n\n destroy(): void {\n this.isDestroyed = true;\n }\n}\n\n/**\n * This type exists for internal use only for\n * where intimate contracts still exist either for\n * the Test Suite or for Legacy code.\n *\n * @private\n */\nexport interface PrivateFetchManager extends FetchManager {\n _pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;\n}\n\nfunction _isEmpty(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n if (!cache) {\n return true;\n }\n const isNew = cache.isNew(identifier);\n const isDeleted = cache.isDeleted(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n return (!isNew || isDeleted) && isEmpty;\n}\n\nfunction _isLoading(cache: InstanceCache, identifier: ResourceKey): boolean {\n const req = cache.store.getRequestStateService();\n // const fulfilled = req.getLastRequestForRecord(identifier);\n const isLoaded = cache.recordIsLoaded(identifier);\n\n return (\n !isLoaded &&\n // fulfilled === null &&\n req.getPendingRequestsForRecord(identifier).some((r) => r.type === 'query')\n );\n}\n\nfunction includesSatisfies(current: undefined | string | string[], existing: undefined | string | string[]): boolean {\n // if we have no includes we are good\n if (!current?.length) {\n return true;\n }\n\n // if we are here we have includes,\n // and if existing has no includes then we will need a new request\n if (!existing?.length) {\n return false;\n }\n\n const arrCurrent = (Array.isArray(current) ? current : current.split(',')).sort();\n const arrExisting = (Array.isArray(existing) ? existing : existing.split(',')).sort();\n\n // includes are identical\n if (arrCurrent.join(',') === arrExisting.join(',')) {\n return true;\n }\n\n // if all of current includes are in existing includes then we are good\n // so if we find one that is not in existing then we need a new request\n for (let i = 0; i < arrCurrent.length; i++) {\n if (!arrExisting.includes(arrCurrent[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction optionsSatisfies(current: object | undefined, existing: object | undefined): boolean {\n return !current || current === existing || Object.keys(current).length === 0;\n}\n\n// this function helps resolve whether we have a pending request that we should use instead\nfunction isSameRequest(options: FindRecordOptions = {}, existingOptions: FindRecordOptions = {}) {\n return (\n optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) &&\n includesSatisfies(options.include, existingOptions.include)\n );\n}\n\nfunction _findMany(\n store: Store,\n adapter: MinimumAdapterInterface,\n modelName: string,\n snapshots: Snapshot[]\n): Promise<CollectionResourceDocument> {\n const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still\n const promise = Promise.resolve().then(() => {\n const ids = snapshots.map((s) => s.id!);\n assert(\n `Cannot fetch a record without an id`,\n ids.every((v) => v !== null)\n );\n // oxlint-disable-next-line typescript/unbound-method\n assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);\n const ret = adapter.findMany(store, modelClass, ids, snapshots);\n assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);\n return ret;\n });\n upgradeStore(store);\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findMany' request for '${modelName}' records with ids '[${snapshots\n .map((s) => s.id!)\n .join(',')}]', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');\n return payload as CollectionResourceDocument;\n });\n}\n\nfunction rejectFetchedItems(fetchMap: Map<Snapshot, PendingFetchItem>, snapshots: Snapshot[], error?: Error) {\n for (let i = 0, l = snapshots.length; i < l; i++) {\n const snapshot = snapshots[i];\n const pair = fetchMap.get(snapshot);\n\n if (pair) {\n pair.resolver.reject(\n error ||\n new Error(\n `Expected: '<${\n snapshot.modelName\n }:${snapshot.id!}>' to be present in the adapter provided payload, but it was not found.`\n )\n );\n }\n }\n}\n\nfunction handleFoundRecords(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n snapshots: Snapshot[],\n coalescedPayload: CollectionResourceDocument\n) {\n /*\n It is possible that the same ID is included multiple times\n via multiple snapshots. This happens when more than one\n options hash was supplied, each of which must be uniquely\n accounted for.\n\n However, since we can't map from response to a specific\n options object, we resolve all snapshots by id with\n the first response we see.\n */\n const snapshotsById = new Map<string, Snapshot[]>();\n for (let i = 0; i < snapshots.length; i++) {\n const id = snapshots[i].id!;\n let snapshotGroup = snapshotsById.get(id);\n if (!snapshotGroup) {\n snapshotGroup = [];\n snapshotsById.set(id, snapshotGroup);\n }\n snapshotGroup.push(snapshots[i]);\n }\n\n const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];\n\n // resolve found records\n const resources = coalescedPayload.data;\n for (let i = 0, l = resources.length; i < l; i++) {\n const resource = resources[i];\n const snapshotGroup = snapshotsById.get(resource.id);\n snapshotsById.delete(resource.id);\n\n if (!snapshotGroup) {\n // TODO consider whether this should be a deprecation/assertion\n included.push(resource);\n } else {\n snapshotGroup.forEach((snapshot) => {\n const pair = fetchMap.get(snapshot)!;\n const resolver = pair.resolver;\n resolver.resolve({ data: resource });\n });\n }\n }\n\n if (included.length > 0) {\n store._push({ data: null, included }, true);\n }\n\n if (snapshotsById.size === 0) {\n return;\n }\n\n // reject missing records\n const rejected: Snapshot[] = [];\n snapshotsById.forEach((snapshotArray) => {\n rejected.push(...snapshotArray);\n });\n warn(\n 'Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ \"' +\n [...snapshotsById.values()].map((r) => r[0].id).join('\", \"') +\n '\" ]',\n {\n id: 'ds.store.missing-records-from-adapter',\n }\n );\n\n rejectFetchedItems(fetchMap, rejected);\n}\n\nfunction _fetchRecord(store: Store, adapter: MinimumAdapterInterface, fetchItem: PendingFetchItem) {\n upgradeStore(store);\n const identifier = fetchItem.identifier;\n const modelName = identifier.type;\n\n assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`,\n typeof adapter.findRecord === 'function'\n );\n\n const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);\n const klass = store.modelFor(identifier.type);\n const id = identifier.id;\n\n let promise = Promise.resolve().then(() => {\n return adapter.findRecord(store, klass, identifier.id, snapshot);\n });\n\n promise = promise.then((adapterPayload) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));\n assert(\n `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');\n assert(\n `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,\n !Array.isArray(payload.data)\n );\n assert(\n `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,\n 'data' in payload && payload.data !== null && typeof payload.data === 'object'\n );\n\n warn(\n `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,\n coerceId(payload.data.id) === coerceId(id),\n {\n id: 'ds.store.findRecord.id-mismatch',\n }\n );\n\n return payload;\n });\n\n fetchItem.resolver.resolve(promise);\n}\n\nfunction _processCoalescedGroup(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n group: Snapshot[],\n adapter: MinimumAdapterInterface,\n modelName: string\n) {\n if (group.length > 1) {\n _findMany(store, adapter, modelName, group)\n .then((payloads: CollectionResourceDocument) => {\n handleFoundRecords(store, fetchMap, group, payloads);\n })\n .catch((error: Error) => {\n rejectFetchedItems(fetchMap, group, error);\n });\n } else if (group.length === 1) {\n _fetchRecord(store, adapter, fetchMap.get(group[0])!);\n } else {\n assert(\"You cannot return an empty array from adapter's method groupRecordsForFindMany\", false);\n }\n}\n\nfunction _flushPendingFetchForType(\n store: Store,\n pendingFetchMap: Map<PersistedResourceKey, PendingFetchItem[]>,\n modelName: string\n) {\n upgradeStore(store);\n const adapter = store.adapterFor(modelName);\n const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;\n\n if (shouldCoalesce) {\n const pendingFetchItems: PendingFetchItem[] = [];\n pendingFetchMap.forEach((requestsForIdentifier, identifier) => {\n if (requestsForIdentifier.length > 1) {\n return;\n }\n\n // remove this entry from the map so it's not processed again\n pendingFetchMap.delete(identifier);\n pendingFetchItems.push(requestsForIdentifier[0]);\n });\n\n const totalItems = pendingFetchItems.length;\n\n if (totalItems > 1) {\n const snapshots = new Array<Snapshot>(totalItems);\n const fetchMap = new Map<Snapshot, PendingFetchItem>();\n for (let i = 0; i < totalItems; i++) {\n const fetchItem = pendingFetchItems[i];\n snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);\n fetchMap.set(snapshots[i], fetchItem);\n }\n\n let groups: Snapshot[][];\n if (adapter.groupRecordsForFindMany) {\n groups = adapter.groupRecordsForFindMany(store, snapshots);\n } else {\n groups = [snapshots];\n }\n\n for (let i = 0, l = groups.length; i < l; i++) {\n _processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);\n }\n } else if (totalItems === 1) {\n _fetchRecord(store, adapter, pendingFetchItems[0]);\n }\n }\n\n pendingFetchMap.forEach((pendingFetchItems) => {\n pendingFetchItems.forEach((pendingFetchItem) => {\n _fetchRecord(store, adapter, pendingFetchItem);\n });\n });\n}\n\nfunction _flushPendingSave(store: Store, pending: PendingSaveItem) {\n const { snapshot, resolver, identifier, options } = pending;\n upgradeStore(store);\n const adapter = store.adapterFor(identifier.type);\n const operation = options[SaveOp];\n\n const modelName = snapshot.modelName;\n const modelClass = store.modelFor(modelName);\n\n assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`,\n typeof adapter[operation] === 'function'\n );\n\n let promise: Promise<AdapterPayload> = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));\n const serializer: SerializerWithParseErrors | null = store.serializerFor(modelName);\n\n assert(\n `Your adapter's '${operation}' method must return a value, but it returned 'undefined'`,\n promise !== undefined\n );\n\n promise = promise.then((adapterPayload) => {\n if (adapterPayload) {\n return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);\n }\n }) as Promise<AdapterPayload>;\n\n resolver.resolve(promise);\n}\n","import type { Store } from '@warp-drive/core';\n\nimport type { CompatStore } from '../compat.ts';\n\n/**\n * Utilities - often temporary - for maintaining backwards compatibility with\n * older parts of WarpDrive.\n *\n @module\n*/\nexport { SnapshotRecordArray } from './legacy-network-handler/snapshot-record-array.ts';\nexport { SaveOp } from './legacy-network-handler/fetch-manager.ts';\nexport { FetchManager } from './legacy-network-handler/fetch-manager.ts';\nexport { Snapshot } from './legacy-network-handler/snapshot.ts';\n\nexport function upgradeStore(store: Store): asserts store is CompatStore {}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAaE,sBAAb,MAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE/BC,YAAYC,OAAcC,MAAcC,UAA0B,CAAC,GAAG;EACpE,KAAKC,UAAUH;EACf,KAAKI,aAAa;EAClB,KAAKC,YAAYJ;EACjB,KAAKK,iBAAiBJ,QAAQI;EAC9B,KAAKC,UAAUL,QAAQK;CACzB;;;;;CAOA,IAAIC,eAAgC;EAClC,OAAO,KAAKL,QAAQM,QAAQ,KAAKJ,SAAS;CAC5C;;;;;;;;;;;;;CAiBA,IAAIK,SAAiB;EACnB,OAAO,KAAKF,aAAaE;CAC3B;;;;;;;;;;;;;;;;;;;;;;;CA6BAC,YAAwB;EACtB,IAAI,KAAKP,eAAe,MACtB,OAAO,KAAKA;EAEdP,6BAAa,KAAKM,OAAO;EAEzB,MAAM,EAAES,kBAAkB,KAAKT;EAC/B,MAAMU,mBAAoB,KAAKL,aAAyDZ;EACxF,KAAKQ,aAAaS,iBAAiBC,OAAOC,KAAKC,eAC7CJ,cAAcK,eAAeD,UAAU,CACzC;EAEA,OAAO,KAAKZ;CACd;AACF;;;;AC9JA,SAAgBc,sBAAsBC,YAAiE;CACrG,EAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,2DAA2D;CAAA,EAAA,CAC3DF,cAAeA,WAAoCG,OAAO,IAAI;AAElE;;;;ACJA,SAAgB,YAAe,MAAe,IAA4B;CACxE,IAAI,MAAM,QAAQ,IAAI,GACpB,OAAO,KAAK,IAAI,EAAE;MAElB,OAAO,GAAG,MAAM,CAAC;AAErB;AA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,MAAA,IAAAC,MAAO,6DAA6DjB,UAAS,EAAG;CAAA,EAAA,CAAE+E,OAAO;CACzF,EAAA/D,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,sDAAsDjB,UAAS,wBAAyBmI,UAAS,EAAG;CAAA,EAAA,CACpG,OAAOpD,QAAQoD,eAAe,UAAU;CAG1C,IAAIzI,UAAmCiC,QAAQC,QAAQ,CAAC,CAACrB,WAAWwE,QAAQoD,UAAU,CAAC9J,OAAO4G,YAAY3F,QAAQ,CAAC;CACnH,MAAMuG,aAA+CxH,MAAMyH,cAAc9F,SAAS;CAElF,EAAAgB,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,mBAAmBkH,UAAS,0DAA2D;CAAA,EAAA,CACvFzI,YAAYiG,MAAS;CAGvBjG,UAAUA,QAAQa,MAAMqF,mBAAmB;EACzC,IAAIA,gBACF,OAAO7H,wBAAwB8H,YAAYxH,OAAO4G,YAAYW,gBAAgBtG,SAASgG,IAAI6C,SAAS;CAExG,CAAC;CAEDnJ,SAAS4C,QAAQlC,OAAO;AAC1B;;;;AC/nBA,SAAgB,aAAa,OAA4C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter-oLwyr47q.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","Error","findAll","neverSet","snapshotRecordArray","query","queryRecord","adapterOptions","serialize","options","serialized","test","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,OA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