@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,6 +1,6 @@
1
1
  import EmberObject from "@ember/object";
2
2
 
3
- //#region src/serializer/-private/transforms/transform.ts
3
+ // src/serializer/-private/transforms/transform.ts
4
4
  /**
5
5
  The `Transform` class is used to serialize and deserialize model
6
6
  attributes when they are saved or loaded from an
@@ -75,13 +75,14 @@ return new this();
75
75
  }
76
76
  ```
77
77
 
78
+ @summary Legacy base for custom attribute transforms, which implement `serialize` and `deserialize` to convert
79
+ values between payloads and records.
78
80
  @class Transform
79
81
  @public
80
82
  */
81
83
  const Transform = EmberObject;
82
84
 
83
- //#endregion
84
- //#region src/serializer/-private/transforms/boolean.ts
85
+ // src/serializer/-private/transforms/boolean.ts
85
86
  /**
86
87
  The `BooleanTransform` class is used to serialize and deserialize
87
88
  boolean attributes on Ember Data record objects. This transform is
@@ -114,6 +115,8 @@ export default class UserModel extends Model {
114
115
  }
115
116
  ```
116
117
 
118
+ @summary Legacy transform for `attr('boolean')` that converts payload values to and from booleans, optionally
119
+ allowing `null`.
117
120
  @public
118
121
  */
119
122
  var BooleanTransform = class {
@@ -143,8 +146,7 @@ var BooleanTransform = class {
143
146
  }
144
147
  };
145
148
 
146
- //#endregion
147
- //#region src/serializer/-private/transforms/date.ts
149
+ // src/serializer/-private/transforms/date.ts
148
150
  /**
149
151
  The `DateTransform` class is used to serialize and deserialize
150
152
  date attributes on Ember Data record objects. This transform is used
@@ -162,6 +164,8 @@ export default class ScoreModel extends Model {
162
164
  }
163
165
  ```
164
166
 
167
+ @summary Legacy transform for `attr('date')` that converts ISO 8601 strings or epoch numbers to `Date` objects and
168
+ serializes them back to ISO 8601 strings.
165
169
  @public
166
170
  */
167
171
  var DateTransform = class {
@@ -197,8 +201,7 @@ var DateTransform = class {
197
201
  }
198
202
  };
199
203
 
200
- //#endregion
201
- //#region src/serializer/-private/transforms/number.ts
204
+ // src/serializer/-private/transforms/number.ts
202
205
  function isNumber(value) {
203
206
  return value === value && value !== Infinity && value !== -Infinity;
204
207
  }
@@ -220,6 +223,8 @@ export default class ScoreModel extends Model {
220
223
  }
221
224
  ```
222
225
 
226
+ @summary Legacy transform for `attr('number')` that converts payload values to numbers, or `null` when empty or not
227
+ a valid number.
223
228
  @public
224
229
  */
225
230
  var NumberTransform = class {
@@ -252,8 +257,7 @@ var NumberTransform = class {
252
257
  }
253
258
  };
254
259
 
255
- //#endregion
256
- //#region src/serializer/-private/transforms/string.ts
260
+ // src/serializer/-private/transforms/string.ts
257
261
  /**
258
262
  The `StringTransform` class is used to serialize and deserialize
259
263
  string attributes on Ember Data record objects. This transform is
@@ -272,6 +276,7 @@ export default class UserModel extends Model {
272
276
  }
273
277
  ```
274
278
 
279
+ @summary Legacy transform for `attr('string')` that converts payload values to and from strings.
275
280
  @public
276
281
  */
277
282
  var StringTransform = class {
@@ -296,6 +301,5 @@ var StringTransform = class {
296
301
  }
297
302
  };
298
303
 
299
- //#endregion
300
304
  export { BooleanTransform, DateTransform, NumberTransform, StringTransform, Transform };
301
305
  //# sourceMappingURL=transform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","names":["EmberObject","Transform","BooleanTransform","deserialize","serialized","options","undefined","allowNull","test","serialize","deserialized","Boolean","create","DateTransform","deserialize","serialized","_options","offset","indexOf","length","Date","slice","undefined","serialize","date","isNaN","toISOString","create","isNumber","value","Infinity","NumberTransform","deserialize","serialized","_options","undefined","transformed","Number","serialize","deserialized","create","StringTransform","deserialize","serialized","_options","String","serialize","deserialized","create"],"sources":["../../../../src/serializer/-private/transforms/transform.ts","../../../../src/serializer/-private/transforms/boolean.ts","../../../../src/serializer/-private/transforms/date.ts","../../../../src/serializer/-private/transforms/number.ts","../../../../src/serializer/-private/transforms/string.ts"],"sourcesContent":["import EmberObject from '@ember/object';\n\nimport type { LegacyAttributeField } from '@warp-drive/core/types/schema/fields';\n\nexport interface Transform {\n /**\n When given a deserialized value from a record attribute this\n method must return the serialized value.\n\n Example\n\n ```javascript\n serialize(deserialized, options) {\n return deserialized ? null : Number(deserialized);\n }\n ```\n\n @public\n @param deserialized The deserialized value\n @param options hash of options passed to `attr`\n @return The serialized value\n */\n serialize(value: unknown, options: LegacyAttributeField['options']): unknown;\n\n /**\n When given a serialized value from a JSON object this method must\n return the deserialized value for the record attribute.\n\n Example\n\n ```javascript\n deserialize(serialized, options) {\n return empty(serialized) ? null : Number(serialized);\n }\n ```\n\n @public\n @param serialized The serialized value\n @param options hash of options passed to `attr`\n @return The deserialized value\n */\n deserialize(value: unknown, options: LegacyAttributeField['options']): unknown;\n}\n\n/**\n The `Transform` class is used to serialize and deserialize model\n attributes when they are saved or loaded from an\n adapter. Subclassing `Transform` is useful for creating custom\n attributes. All subclasses of `Transform` must implement a\n `serialize` and a `deserialize` method.\n\n Example\n\n ```js [app/transforms/temperature.js]\n\n // Converts centigrade in the JSON to fahrenheit in the app\n export default class TemperatureTransform {\n deserialize(serialized, options) {\n return (serialized * 1.8) + 32;\n }\n\n serialize(deserialized, options) {\n return (deserialized - 32) / 1.8;\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n Usage\n\n ```js [app/models/requirement.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class RequirementModel extends Model {\n @attr('string') name;\n @attr('temperature') temperature;\n }\n ```\n\n The options passed into the `attr` function when the attribute is\n declared on the model is also available in the transform.\n\n ```js [app/models/post.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @attr('string') title;\n @attr('markdown', {\n markdown: {\n gfm: false,\n sanitize: true\n }\n })\n markdown;\n }\n ```\n\n ```js [app/transforms/markdown.js]\n export default class MarkdownTransform {\n serialize(deserialized, options) {\n return deserialized.raw;\n }\n\n deserialize(serialized, options) {\n let markdownOptions = options.markdown || {};\n\n return marked(serialized, markdownOptions);\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n @class Transform\n @public\n */\nexport const Transform: typeof EmberObject = EmberObject;\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nexport interface BooleanTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'boolean';\n}\n\n/**\n The `BooleanTransform` class is used to serialize and deserialize\n boolean attributes on Ember Data record objects. This transform is\n used when `'boolean'` is passed as the type parameter to the\n {@link attr}function.\n\n Usage\n\n ```js [app/models/user.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('boolean') isAdmin;\n @attr('string') name;\n @attr('string') email;\n }\n ```\n\n By default, the boolean transform only allows for values of `true` or\n `false`. You can opt into allowing `null` values for\n boolean attributes via `attr('boolean', { allowNull: true })`\n\n ```js [app/models/user.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('string') email;\n @attr('string') username;\n @attr('boolean', { allowNull: true }) wantsWeeklyEmail;\n }\n ```\n\n @public\n */\nexport class BooleanTransform {\n /**\n * Converts a serialized (raw payload) value into a `boolean` (or `null`\n * when `allowNull` is set and the value is nullish).\n */\n deserialize(serialized: boolean | null | number | string, options?: { allowNull?: boolean }): boolean | null {\n if ((serialized === null || serialized === undefined) && options?.allowNull === true) {\n return null;\n }\n\n if (typeof serialized === 'boolean') {\n return serialized;\n } else if (typeof serialized === 'string') {\n return /^(true|t|1)$/i.test(serialized);\n } else if (typeof serialized === 'number') {\n return serialized === 1;\n } else {\n return false;\n }\n }\n\n /**\n * Converts a `boolean` attribute value into its serialized (raw payload) form.\n */\n serialize(deserialized: boolean | null, options?: { allowNull?: boolean }): boolean | null {\n if ((deserialized === null || deserialized === undefined) && options?.allowNull === true) {\n return null;\n }\n\n return Boolean(deserialized);\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): BooleanTransform {\n return new this();\n }\n}\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nexport interface DateTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'date';\n}\n/**\n The `DateTransform` class is used to serialize and deserialize\n date attributes on Ember Data record objects. This transform is used\n when `'date'` is passed as the type parameter to the\n {@link attr} function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)\n standard.\n\n ```js [app/models/score.js]\n import Model, { attr, belongsTo } from '@warp-drive/legacy/model';\n\n export default class ScoreModel extends Model {\n @attr('number') value;\n @belongsTo('player') player;\n @attr('date') date;\n }\n ```\n\n @public\n */\n\nexport class DateTransform {\n /**\n * Converts a serialized (raw payload) `ISO 8601` string, epoch number,\n * or nullish value into a `Date` (or `null`/`undefined`).\n */\n deserialize(serialized: string | number | null, _options?: Record<string, unknown>): Date | null {\n if (typeof serialized === 'string') {\n let offset = serialized.indexOf('+');\n\n if (offset !== -1 && serialized.length - 5 === offset) {\n offset += 3;\n return new Date(serialized.slice(0, offset) + ':' + serialized.slice(offset));\n }\n return new Date(serialized);\n } else if (typeof serialized === 'number') {\n return new Date(serialized);\n } else if (serialized === null || serialized === undefined) {\n // if the value is null return null\n // if the value is not present in the data return undefined\n return serialized;\n } else {\n return null;\n }\n }\n\n /**\n * Converts a `Date` attribute value into an `ISO 8601` string, or `null`\n * if the value is not a valid `Date`.\n */\n serialize(date: Date, _options?: Record<string, unknown>): string | null {\n // @ts-expect-error isNaN accepts date as it is coercible\n if (date instanceof Date && !isNaN(date)) {\n return date.toISOString();\n } else {\n return null;\n }\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): DateTransform {\n return new this();\n }\n}\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nfunction isNumber(value: number) {\n return value === value && value !== Infinity && value !== -Infinity;\n}\n\nexport interface NumberTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'number';\n}\n\n/**\n The `NumberTransform` class is used to serialize and deserialize\n numeric attributes on Ember Data record objects. This transform is\n used when `number` is passed as the type parameter to the\n {@link attr} function.\n\n Usage\n\n ```js [app/models/score.js]\n import Model, { attr, belongsTo } from '@warp-drive/legacy/model';\n\n export default class ScoreModel extends Model {\n @attr('number') value;\n @belongsTo('player') player;\n @attr('date') date;\n }\n ```\n\n @public\n */\nexport class NumberTransform {\n /**\n * Converts a serialized (raw payload) value into a `number`, or `null`\n * if the value is empty, nullish, or not a valid number.\n */\n deserialize(serialized: string | number | null | undefined, _options?: Record<string, unknown>): number | null {\n if (serialized === '' || serialized === null || serialized === undefined) {\n return null;\n } else {\n const transformed = Number(serialized);\n\n return isNumber(transformed) ? transformed : null;\n }\n }\n\n /**\n * Converts a `number` attribute value into its serialized (raw payload) form.\n */\n serialize(deserialized: string | number | null | undefined, _options?: Record<string, unknown>): number | null {\n if (deserialized === '' || deserialized === null || deserialized === undefined) {\n return null;\n } else {\n const transformed = Number(deserialized);\n\n return isNumber(transformed) ? transformed : null;\n }\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): NumberTransform {\n return new this();\n }\n}\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nexport interface StringTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'string';\n}\n/**\n The `StringTransform` class is used to serialize and deserialize\n string attributes on Ember Data record objects. This transform is\n used when `string` is passed as the type parameter to the\n {@link attr} function.\n\n Usage\n\n ```js [app/models/user.js]\n import Model, { attr, belongsTo } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('boolean') isAdmin;\n @attr('string') name;\n @attr('string') email;\n }\n ```\n\n @public\n */\nexport class StringTransform {\n /**\n * Converts a serialized (raw payload) value into a `string`, or `null`\n * if the value is falsy (and not an empty string).\n */\n deserialize(serialized: unknown, _options?: Record<string, unknown>): string | null {\n return !serialized && serialized !== '' ? null : String(serialized);\n }\n /**\n * Converts a `string` attribute value into its serialized (raw payload) form.\n */\n serialize(deserialized: unknown, _options?: Record<string, unknown>): string | null {\n return !deserialized && deserialized !== '' ? null : String(deserialized);\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): StringTransform {\n return new this();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AOC,SAAwB;EAC7B,OAAO,IAAI,KAAK;CAClB;AACF;;;;ACtEA,SAASC,SAASC,OAAe;CAC/B,OAAOA,UAAUA,SAASA,UAAUC,YAAYD,UAAU;AAC5D;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAaE,kBAAb,MAA6B;;;;;CAK3BC,YAAYC,YAAgDC,UAAmD;EAC7G,IAAID,eAAe,MAAMA,eAAe,QAAQA,eAAeE,QAC7D,OAAO;OACF;GACL,MAAMC,cAAcC,OAAOJ,UAAU;GAErC,OAAOL,SAASQ,WAAW,IAAIA,cAAc;EAC/C;CACF;;;;CAKAE,UAAUC,cAAkDL,UAAmD;EAC7G,IAAIK,iBAAiB,MAAMA,iBAAiB,QAAQA,iBAAiBJ,QACnE,OAAO;OACF;GACL,MAAMC,cAAcC,OAAOE,YAAY;GAEvC,OAAOX,SAASQ,WAAW,IAAIA,cAAc;EAC/C;CACF;;;;CAKA,OAAOI,SAA0B;EAC/B,OAAO,IAAI,KAAK;CAClB;AACF;;;;;;;;;;;;;;;;;;;;;;;;ACvCA,IAAaC,kBAAb,MAA6B;;;;;CAK3BC,YAAYC,YAAqBC,UAAmD;EAClF,OAAO,CAACD,cAAcA,eAAe,KAAK,OAAOE,OAAOF,UAAU;CACpE;;;;CAIAG,UAAUC,cAAuBH,UAAmD;EAClF,OAAO,CAACG,gBAAgBA,iBAAiB,KAAK,OAAOF,OAAOE,YAAY;CAC1E;;;;CAKA,OAAOC,SAA0B;EAC/B,OAAO,IAAI,KAAK;CAClB;AACF"}
1
+ {"version":3,"file":"transform.js","names":["EmberObject","Transform","BooleanTransform","deserialize","serialized","options","undefined","allowNull","test","serialize","deserialized","Boolean","create","DateTransform","deserialize","serialized","_options","offset","indexOf","length","Date","slice","undefined","serialize","date","isNaN","toISOString","create","isNumber","value","Infinity","NumberTransform","deserialize","serialized","_options","undefined","transformed","Number","serialize","deserialized","create","StringTransform","deserialize","serialized","_options","String","serialize","deserialized","create"],"sources":["../../../../src/serializer/-private/transforms/transform.ts","../../../../src/serializer/-private/transforms/boolean.ts","../../../../src/serializer/-private/transforms/date.ts","../../../../src/serializer/-private/transforms/number.ts","../../../../src/serializer/-private/transforms/string.ts"],"sourcesContent":["import EmberObject from '@ember/object';\n\nimport type { LegacyAttributeField } from '@warp-drive/core/types/schema/fields';\n\nexport interface Transform {\n /**\n When given a deserialized value from a record attribute this\n method must return the serialized value.\n\n Example\n\n ```javascript\n serialize(deserialized, options) {\n return deserialized ? null : Number(deserialized);\n }\n ```\n\n @public\n @param deserialized The deserialized value\n @param options hash of options passed to `attr`\n @return The serialized value\n */\n serialize(value: unknown, options: LegacyAttributeField['options']): unknown;\n\n /**\n When given a serialized value from a JSON object this method must\n return the deserialized value for the record attribute.\n\n Example\n\n ```javascript\n deserialize(serialized, options) {\n return empty(serialized) ? null : Number(serialized);\n }\n ```\n\n @public\n @param serialized The serialized value\n @param options hash of options passed to `attr`\n @return The deserialized value\n */\n deserialize(value: unknown, options: LegacyAttributeField['options']): unknown;\n}\n\n/**\n The `Transform` class is used to serialize and deserialize model\n attributes when they are saved or loaded from an\n adapter. Subclassing `Transform` is useful for creating custom\n attributes. All subclasses of `Transform` must implement a\n `serialize` and a `deserialize` method.\n\n Example\n\n ```js [app/transforms/temperature.js]\n\n // Converts centigrade in the JSON to fahrenheit in the app\n export default class TemperatureTransform {\n deserialize(serialized, options) {\n return (serialized * 1.8) + 32;\n }\n\n serialize(deserialized, options) {\n return (deserialized - 32) / 1.8;\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n Usage\n\n ```js [app/models/requirement.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class RequirementModel extends Model {\n @attr('string') name;\n @attr('temperature') temperature;\n }\n ```\n\n The options passed into the `attr` function when the attribute is\n declared on the model is also available in the transform.\n\n ```js [app/models/post.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @attr('string') title;\n @attr('markdown', {\n markdown: {\n gfm: false,\n sanitize: true\n }\n })\n markdown;\n }\n ```\n\n ```js [app/transforms/markdown.js]\n export default class MarkdownTransform {\n serialize(deserialized, options) {\n return deserialized.raw;\n }\n\n deserialize(serialized, options) {\n let markdownOptions = options.markdown || {};\n\n return marked(serialized, markdownOptions);\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n @summary Legacy base for custom attribute transforms, which implement `serialize` and `deserialize` to convert\n values between payloads and records.\n @class Transform\n @public\n */\nexport const Transform: typeof EmberObject = EmberObject;\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nexport interface BooleanTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'boolean';\n}\n\n/**\n The `BooleanTransform` class is used to serialize and deserialize\n boolean attributes on Ember Data record objects. This transform is\n used when `'boolean'` is passed as the type parameter to the\n {@link attr}function.\n\n Usage\n\n ```js [app/models/user.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('boolean') isAdmin;\n @attr('string') name;\n @attr('string') email;\n }\n ```\n\n By default, the boolean transform only allows for values of `true` or\n `false`. You can opt into allowing `null` values for\n boolean attributes via `attr('boolean', { allowNull: true })`\n\n ```js [app/models/user.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('string') email;\n @attr('string') username;\n @attr('boolean', { allowNull: true }) wantsWeeklyEmail;\n }\n ```\n\n @summary Legacy transform for `attr('boolean')` that converts payload values to and from booleans, optionally\n allowing `null`.\n @public\n */\nexport class BooleanTransform {\n /**\n * Converts a serialized (raw payload) value into a `boolean` (or `null`\n * when `allowNull` is set and the value is nullish).\n */\n deserialize(serialized: boolean | null | number | string, options?: { allowNull?: boolean }): boolean | null {\n if ((serialized === null || serialized === undefined) && options?.allowNull === true) {\n return null;\n }\n\n if (typeof serialized === 'boolean') {\n return serialized;\n } else if (typeof serialized === 'string') {\n return /^(true|t|1)$/i.test(serialized);\n } else if (typeof serialized === 'number') {\n return serialized === 1;\n } else {\n return false;\n }\n }\n\n /**\n * Converts a `boolean` attribute value into its serialized (raw payload) form.\n */\n serialize(deserialized: boolean | null, options?: { allowNull?: boolean }): boolean | null {\n if ((deserialized === null || deserialized === undefined) && options?.allowNull === true) {\n return null;\n }\n\n return Boolean(deserialized);\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): BooleanTransform {\n return new this();\n }\n}\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nexport interface DateTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'date';\n}\n/**\n The `DateTransform` class is used to serialize and deserialize\n date attributes on Ember Data record objects. This transform is used\n when `'date'` is passed as the type parameter to the\n {@link attr} function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)\n standard.\n\n ```js [app/models/score.js]\n import Model, { attr, belongsTo } from '@warp-drive/legacy/model';\n\n export default class ScoreModel extends Model {\n @attr('number') value;\n @belongsTo('player') player;\n @attr('date') date;\n }\n ```\n\n @summary Legacy transform for `attr('date')` that converts ISO 8601 strings or epoch numbers to `Date` objects and\n serializes them back to ISO 8601 strings.\n @public\n */\n\nexport class DateTransform {\n /**\n * Converts a serialized (raw payload) `ISO 8601` string, epoch number,\n * or nullish value into a `Date` (or `null`/`undefined`).\n */\n deserialize(serialized: string | number | null, _options?: Record<string, unknown>): Date | null {\n if (typeof serialized === 'string') {\n let offset = serialized.indexOf('+');\n\n if (offset !== -1 && serialized.length - 5 === offset) {\n offset += 3;\n return new Date(serialized.slice(0, offset) + ':' + serialized.slice(offset));\n }\n return new Date(serialized);\n } else if (typeof serialized === 'number') {\n return new Date(serialized);\n } else if (serialized === null || serialized === undefined) {\n // if the value is null return null\n // if the value is not present in the data return undefined\n return serialized;\n } else {\n return null;\n }\n }\n\n /**\n * Converts a `Date` attribute value into an `ISO 8601` string, or `null`\n * if the value is not a valid `Date`.\n */\n serialize(date: Date, _options?: Record<string, unknown>): string | null {\n // @ts-expect-error isNaN accepts date as it is coercible\n if (date instanceof Date && !isNaN(date)) {\n return date.toISOString();\n } else {\n return null;\n }\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): DateTransform {\n return new this();\n }\n}\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nfunction isNumber(value: number) {\n return value === value && value !== Infinity && value !== -Infinity;\n}\n\nexport interface NumberTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'number';\n}\n\n/**\n The `NumberTransform` class is used to serialize and deserialize\n numeric attributes on Ember Data record objects. This transform is\n used when `number` is passed as the type parameter to the\n {@link attr} function.\n\n Usage\n\n ```js [app/models/score.js]\n import Model, { attr, belongsTo } from '@warp-drive/legacy/model';\n\n export default class ScoreModel extends Model {\n @attr('number') value;\n @belongsTo('player') player;\n @attr('date') date;\n }\n ```\n\n @summary Legacy transform for `attr('number')` that converts payload values to numbers, or `null` when empty or not\n a valid number.\n @public\n */\nexport class NumberTransform {\n /**\n * Converts a serialized (raw payload) value into a `number`, or `null`\n * if the value is empty, nullish, or not a valid number.\n */\n deserialize(serialized: string | number | null | undefined, _options?: Record<string, unknown>): number | null {\n if (serialized === '' || serialized === null || serialized === undefined) {\n return null;\n } else {\n const transformed = Number(serialized);\n\n return isNumber(transformed) ? transformed : null;\n }\n }\n\n /**\n * Converts a `number` attribute value into its serialized (raw payload) form.\n */\n serialize(deserialized: string | number | null | undefined, _options?: Record<string, unknown>): number | null {\n if (deserialized === '' || deserialized === null || deserialized === undefined) {\n return null;\n } else {\n const transformed = Number(deserialized);\n\n return isNumber(transformed) ? transformed : null;\n }\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): NumberTransform {\n return new this();\n }\n}\n","import type { TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { attr } from '../../../model';\n\nexport interface StringTransform {\n /**\n * see {@link TransformName}\n */\n [TransformName]: 'string';\n}\n/**\n The `StringTransform` class is used to serialize and deserialize\n string attributes on Ember Data record objects. This transform is\n used when `string` is passed as the type parameter to the\n {@link attr} function.\n\n Usage\n\n ```js [app/models/user.js]\n import Model, { attr, belongsTo } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('boolean') isAdmin;\n @attr('string') name;\n @attr('string') email;\n }\n ```\n\n @summary Legacy transform for `attr('string')` that converts payload values to and from strings.\n @public\n */\nexport class StringTransform {\n /**\n * Converts a serialized (raw payload) value into a `string`, or `null`\n * if the value is falsy (and not an empty string).\n */\n deserialize(serialized: unknown, _options?: Record<string, unknown>): string | null {\n return !serialized && serialized !== '' ? null : String(serialized);\n }\n /**\n * Converts a `string` attribute value into its serialized (raw payload) form.\n */\n serialize(deserialized: unknown, _options?: Record<string, unknown>): string | null {\n return !deserialized && deserialized !== '' ? null : String(deserialized);\n }\n\n /**\n * Creates a new instance of this transform.\n */\n static create(): StringTransform {\n return new this();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HA,MAAaC,YAAgCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3E7C,IAAaE,mBAAb,MAA8B;;;;;CAK5BC,YAAYC,YAA8CC,SAAmD;EAC3G,KAAKD,eAAe,QAAQA,eAAeE,WAAcD,SAASE,cAAc,MAC9E,OAAO;EAGT,IAAI,OAAOH,eAAe,WACxB,OAAOA;OACF,IAAI,OAAOA,eAAe,UAC/B,OAAO,gBAAgBI,KAAKJ,UAAU;OACjC,IAAI,OAAOA,eAAe,UAC/B,OAAOA,eAAe;OAEtB,OAAO;CAEX;;;;CAKAK,UAAUC,cAA8BL,SAAmD;EACzF,KAAKK,iBAAiB,QAAQA,iBAAiBJ,WAAcD,SAASE,cAAc,MAClF,OAAO;EAGT,OAAOI,QAAQ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EvC,OAAOX,SAASQ,WAAW,IAAIA,cAAc;EAC/C;CACF;;;;CAKA,OAAOI,SAA0B;EAC/B,OAAO,IAAI,KAAK;CAClB;AACF;;;;;;;;;;;;;;;;;;;;;;;;ACxCA,IAAaC,kBAAb,MAA6B;;;;;CAK3BC,YAAYC,YAAqBC,UAAmD;EAClF,OAAO,CAACD,cAAcA,eAAe,KAAK,OAAOE,OAAOF,UAAU;CACpE;;;;CAIAG,UAAUC,cAAuBH,UAAmD;EAClF,OAAO,CAACG,gBAAgBA,iBAAiB,KAAK,OAAOF,OAAOE,YAAY;CAC1E;;;;CAKA,OAAOC,SAA0B;EAC/B,OAAO,IAAI,KAAK;CAClB;AACF"}
@@ -1,8 +1,8 @@
1
- import { r as initializeDeferredDecorator, t as decorateFieldV2 } from "./runtime--fcdnjmJ-DMTJ0Kb3.js";
1
+ import { r as initializeDeferredDecorator, t as decorateFieldV2 } from "./runtime--fcdnjmJ-5yaSpa-d.js";
2
2
  import EmberObject from "@ember/object";
3
3
  import * as s from "@ember/service";
4
4
 
5
- //#region src/serializer.ts
5
+ // src/serializer.ts
6
6
  /**
7
7
  ## Overview
8
8
 
@@ -23,6 +23,42 @@ Data received from an API response is **normalized** into
23
23
  by WarpDrive), while data sent to an API is **serialized**
24
24
  into the format the API expects.
25
25
 
26
+ ### Why It's Legacy
27
+
28
+ The Serializer pattern was designed to transform data between your API's format and the
29
+ {json:api} format the legacy store works with:
30
+
31
+ - `store.serializerFor` resolves a serializer by resource type at runtime, looking up
32
+ `serializer:<type>` and then `serializer:application` through Ember's owner, though an
33
+ API's format more often varies per API version than per resource type (see Serializer
34
+ Resolution below).
35
+ - Every response is converted into {json:api} before it reaches the cache, whatever format
36
+ the API actually uses.
37
+ - The provided serializer classes extend `EmberObject`, which, together with the owner
38
+ lookup, ties the pattern to Ember.
39
+
40
+ ### Modern Alternative
41
+
42
+ Use [Handlers](/api/@warp-drive/core/request/types/Handler) with the {@link RequestManager}.
43
+ Modern ***Warp*Drive**:
44
+
45
+ - normalizes a payload inside a handler when it needs transforming, using plain functions
46
+ and helpers such as `dasherize` and `singularize` from `@warp-drive/utilities/string`
47
+ - lets you pick a cache that understands your API's format natively, such as `JSONAPICache`
48
+ from `@warp-drive/json-api` for {json:api}, or write your own that implements the Cache
49
+ interface
50
+
51
+ For an alternative modern pattern to Serializers, see the
52
+ [Request Handlers Guide](/guides/the-manual/requests/handlers).
53
+
54
+ ### Setup
55
+
56
+ Serializers run inside the `LegacyNetworkHandler` from
57
+ [`@warp-drive/legacy/compat`](/api/@warp-drive/legacy/compat/). A store created with
58
+ `useLegacyStore` adds it unless `linksMode` is `true`; a store you build yourself must add it
59
+ to its `RequestManager`, as shown in
60
+ [Configure the Store](/guides/configuration/legacy-package-setup/setup/universal.md#configure-the-store).
61
+
26
62
  ### Implementing a Serializer
27
63
 
28
64
  There are only two required serializer methods, one for
@@ -106,6 +142,8 @@ by these serializers.
106
142
  It is recommended that apps write their own serializer to best suit the needs of their API and
107
143
  application.
108
144
 
145
+ @summary Legacy serializer layer that converts data between an API's format and JSON:API for the adapter-based
146
+ request flow.
109
147
  @module
110
148
  */
111
149
  const service = s.service ?? s.inject;
@@ -126,6 +164,8 @@ And you can optionally override the following methods:
126
164
 
127
165
  For an example implementation, see the included {@link JSONSerializer}.
128
166
 
167
+ @summary Legacy abstract base class for serializers that normalize API responses into JSON:API and serialize
168
+ records into the API's request format.
129
169
  @class Serializer
130
170
  @public
131
171
  */
@@ -240,6 +280,5 @@ var Serializer = class extends EmberObject {
240
280
  }
241
281
  };
242
282
 
243
- //#endregion
244
283
  export { Serializer };
245
284
  //# sourceMappingURL=serializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.js","names":["EmberObject","s","g","i","service","inject","Serializer","prototype","store","normalize","_typeClass","hash"],"sources":["../../../src/serializer.ts"],"sourcesContent":["/**\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 serializer, consider writing a\n {@link Handler} instead to be used with the {@link RequestManager}\n :::\n\n In order to properly manage and present your data, WarpDrive\n needs to understand the structure of data it receives.\n\n `Serializers` convert data between the server's API format and\n the format WarpDrive understands.\n\n Data received from an API response is **normalized** into\n [{json:api}](https://jsonapi.org/) (the format used internally\n by WarpDrive), while data sent to an API is **serialized**\n into the format the API expects.\n\n ### Implementing a Serializer\n\n There are only two required serializer methods, one for\n normalizing data from the server API format into {json:api}, and\n another for serializing records via `Snapshots` into the expected\n server API format.\n\n To implement a serializer, export a class that conforms to the structure\n described by {@link MinimumSerializerInterface}\n from the `app/serializers/` directory. An example is below.\n\n ```ts\n import EmberObject from '@ember/object';\n\n export default class ApplicationSerializer extends EmberObject {\n normalizeResponse(store, schema, rawPayload) {\n return rawPayload;\n }\n\n serialize(snapshot, options) {\n const serializedResource = {\n id: snapshot.id,\n type: snapshot.modelName,\n attributes: snapshot.attributes()\n };\n\n return serializedResource;\n }\n }\n ```\n\n\n ### Serializer Resolution\n\n `store.serializerFor(name)` will lookup serializers defined in\n `app/serializers/` and return an instance. If no serializer is found, an\n error will be thrown.\n\n `serializerFor` first attempts to find a serializer with an exact match on `name`,\n then falls back to checking for the presence of a serializer named `application`.\n\n ```ts\n store.serializerFor('author');\n\n // lookup paths (in order) =>\n // app/serializers/author.js\n // app/serializers/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 Typically `serializerFor` will be used to find a serializer with a name matching that of the primary\n resource `type` for the request, falling back to the `application` serializer for those types that\n do not have a defined serializer. This is often described as a `per-model` or `per-type` strategy\n for defining serializers. However, because APIs rarely format payloads per-type but rather\n per-API-version, this may not be a desired strategy.\n\n It is recommended that applications define only a single `application` adapter and serializer\n where possible.\n\n If you have multiple API formats and the per-type strategy is not viable, one strategy is to\n write an `application` adapter and serializer that make use of `options` to specify the desired\n format when making a request.\n\n ### Using a Serializer\n\n Any serializer in `app/serializers/` can be looked up by `name` using `store.serializerFor(name)`.\n\n ### Default Serializers\n\n For applications whose APIs are *very close to* or *exactly* the **REST** format or **JSON:API**\n format the `@warp-drive/legacy/serializer` package contains implementations these applications can\n extend. It also contains a simple `JSONSerializer` for serializing to/from very basic JSON objects.\n\n Many applications will find writing their own serializer to be more performant and less\n complex than extending these classes even when their API format is very close to that expected\n by these serializers.\n\n It is recommended that apps write their own serializer to best suit the needs of their API and\n application.\n\n @module\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';\n// oxlint-disable-next-line no-unused-vars\nimport type { Handler } from '@warp-drive/core/request';\nimport type { ModelSchema } from '@warp-drive/core/types';\nimport type { EmptyResourceDocument, SingleResourceDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { MinimumSerializerInterface } from './compat';\n// oxlint-disable-next-line no-unused-vars\nimport type { JSONSerializer } from './serializer/json';\n\nconst service = s.service ?? s.inject;\n\n/**\n > ⚠️ CAUTION you likely want the docs for {@link MinimumSerializerInterface}\n > as extending this abstract class is unnecessary.\n\n `Serializer` is an abstract base class that you may override in your\n application to customize it for your backend. The minimum set of methods\n that you should implement is:\n\n * `normalizeResponse()`\n * `serialize()`\n\n And you can optionally override the following methods:\n\n * `normalize()`\n\n For an example implementation, see the included {@link JSONSerializer}.\n\n @class Serializer\n @public\n*/\n\nexport class Serializer extends EmberObject {\n /**\n The `store` property is the application's `store` that contains\n all records. It can be used to look up serializers for other model\n types that may be nested inside the payload response.\n\n Example:\n\n ```js\n Serializer.extend({\n extractRelationship(relationshipModelName, relationshipHash) {\n let modelClass = this.store.modelFor(relationshipModelName);\n let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n return relationshipSerializer.normalize(modelClass, relationshipHash);\n }\n });\n ```\n\n @public\n */\n @service declare store: Store;\n\n /**\n The `normalizeResponse` method is used to normalize a payload from the\n server to a JSON-API Document.\n\n http://jsonapi.org/format/#document-structure\n\n Example:\n\n ```js\n Serializer.extend({\n normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n if (requestType === 'findRecord') {\n return this.normalize(primaryModelClass, payload);\n } else {\n return payload.reduce(function(documentHash, item) {\n let { data, included } = this.normalize(primaryModelClass, item);\n documentHash.included.push(...included);\n documentHash.data.push(data);\n return documentHash;\n }, { data: [], included: [] })\n }\n }\n });\n ```\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n\n /**\n The `serialize` method is used when a record is saved in order to convert\n the record into the form that your external data source expects.\n\n `serialize` takes an optional `options` hash with a single option:\n\n - `includeId`: If this is `true`, `serialize` should include the ID\n in the serialized object it builds.\n\n Example:\n\n ```js\n Serializer.extend({\n serialize(snapshot, options) {\n let json = {\n id: snapshot.id\n };\n\n snapshot.eachAttribute((key, attribute) => {\n json[key] = snapshot.attr(key);\n });\n\n snapshot.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n json[key] = snapshot.belongsTo(key, { id: true });\n } else if (relationship.kind === 'hasMany') {\n json[key] = snapshot.hasMany(key, { ids: true });\n }\n });\n\n return json;\n },\n });\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} [options]\n @return {Object}\n */\n\n /**\n The `normalize` method is used to convert a payload received from your\n external data source into the normalized form `store.push()` expects. You\n should override this method, munge the hash and return the normalized\n payload.\n\n Example:\n\n ```js\n Serializer.extend({\n normalize(modelClass, resourceHash) {\n let data = {\n id: resourceHash.id,\n type: modelClass.modelName,\n attributes: resourceHash\n };\n return { data: data };\n }\n })\n ```\n\n @public\n @param _typeClass - the model class the hash is being normalized for\n @param hash - the raw payload hash to normalize\n @return the normalized resource document\n */\n normalize(_typeClass: ModelSchema, hash: Record<string, unknown>): SingleResourceDocument | EmptyResourceDocument {\n return hash as unknown as SingleResourceDocument;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwHA,MAAMI,UAAUH,EAAEG,WAAWH,EAAEI;;;;;;;;;;;;;;;;;;;;;AAuB/B,IAAaC,aAAb,cAAgCN,YAAY;CAAA;EAAAE,gBAAA,KAAAK,WAAA,SAAA,CAoBzCH,OAAO,CAAA;CAAA;CAAA,UAAAD,4BAAA,MAAA,OAAA,GAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGRM,UAAUC,YAAyBC,MAA+E;EAChH,OAAOA;CACT;AACF"}
1
+ {"version":3,"file":"serializer.js","names":["EmberObject","s","g","i","service","inject","Serializer","prototype","store","normalize","_typeClass","hash","i"],"sources":["../../../src/serializer.ts"],"sourcesContent":["/**\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 serializer, consider writing a\n {@link Handler} instead to be used with the {@link RequestManager}\n :::\n\n In order to properly manage and present your data, WarpDrive\n needs to understand the structure of data it receives.\n\n `Serializers` convert data between the server's API format and\n the format WarpDrive understands.\n\n Data received from an API response is **normalized** into\n [{json:api}](https://jsonapi.org/) (the format used internally\n by WarpDrive), while data sent to an API is **serialized**\n into the format the API expects.\n\n ### Why It's Legacy\n\n The Serializer pattern was designed to transform data between your API's format and the\n {json:api} format the legacy store works with:\n\n - `store.serializerFor` resolves a serializer by resource type at runtime, looking up\n `serializer:<type>` and then `serializer:application` through Ember's owner, though an\n API's format more often varies per API version than per resource type (see Serializer\n Resolution below).\n - Every response is converted into {json:api} before it reaches the cache, whatever format\n the API actually uses.\n - The provided serializer classes extend `EmberObject`, which, together with the owner\n lookup, ties the pattern to Ember.\n\n ### Modern Alternative\n\n Use [Handlers](/api/@warp-drive/core/request/types/Handler) with the {@link RequestManager}.\n Modern ***Warp*Drive**:\n\n - normalizes a payload inside a handler when it needs transforming, using plain functions\n and helpers such as `dasherize` and `singularize` from `@warp-drive/utilities/string`\n - lets you pick a cache that understands your API's format natively, such as `JSONAPICache`\n from `@warp-drive/json-api` for {json:api}, or write your own that implements the Cache\n interface\n\n For an alternative modern pattern to Serializers, see the\n [Request Handlers Guide](/guides/the-manual/requests/handlers).\n\n ### Setup\n\n Serializers run inside the `LegacyNetworkHandler` from\n [`@warp-drive/legacy/compat`](/api/@warp-drive/legacy/compat/). A store created with\n `useLegacyStore` adds it unless `linksMode` is `true`; a store you build yourself must add it\n to its `RequestManager`, as shown in\n [Configure the Store](/guides/configuration/legacy-package-setup/setup/universal.md#configure-the-store).\n\n ### Implementing a Serializer\n\n There are only two required serializer methods, one for\n normalizing data from the server API format into {json:api}, and\n another for serializing records via `Snapshots` into the expected\n server API format.\n\n To implement a serializer, export a class that conforms to the structure\n described by {@link MinimumSerializerInterface}\n from the `app/serializers/` directory. An example is below.\n\n ```ts\n import EmberObject from '@ember/object';\n\n export default class ApplicationSerializer extends EmberObject {\n normalizeResponse(store, schema, rawPayload) {\n return rawPayload;\n }\n\n serialize(snapshot, options) {\n const serializedResource = {\n id: snapshot.id,\n type: snapshot.modelName,\n attributes: snapshot.attributes()\n };\n\n return serializedResource;\n }\n }\n ```\n\n\n ### Serializer Resolution\n\n `store.serializerFor(name)` will lookup serializers defined in\n `app/serializers/` and return an instance. If no serializer is found, an\n error will be thrown.\n\n `serializerFor` first attempts to find a serializer with an exact match on `name`,\n then falls back to checking for the presence of a serializer named `application`.\n\n ```ts\n store.serializerFor('author');\n\n // lookup paths (in order) =>\n // app/serializers/author.js\n // app/serializers/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 Typically `serializerFor` will be used to find a serializer with a name matching that of the primary\n resource `type` for the request, falling back to the `application` serializer for those types that\n do not have a defined serializer. This is often described as a `per-model` or `per-type` strategy\n for defining serializers. However, because APIs rarely format payloads per-type but rather\n per-API-version, this may not be a desired strategy.\n\n It is recommended that applications define only a single `application` adapter and serializer\n where possible.\n\n If you have multiple API formats and the per-type strategy is not viable, one strategy is to\n write an `application` adapter and serializer that make use of `options` to specify the desired\n format when making a request.\n\n ### Using a Serializer\n\n Any serializer in `app/serializers/` can be looked up by `name` using `store.serializerFor(name)`.\n\n ### Default Serializers\n\n For applications whose APIs are *very close to* or *exactly* the **REST** format or **JSON:API**\n format the `@warp-drive/legacy/serializer` package contains implementations these applications can\n extend. It also contains a simple `JSONSerializer` for serializing to/from very basic JSON objects.\n\n Many applications will find writing their own serializer to be more performant and less\n complex than extending these classes even when their API format is very close to that expected\n by these serializers.\n\n It is recommended that apps write their own serializer to best suit the needs of their API and\n application.\n\n @summary Legacy serializer layer that converts data between an API's format and JSON:API for the adapter-based\n request flow.\n @module\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';\n// oxlint-disable-next-line no-unused-vars\nimport type { Handler } from '@warp-drive/core/request';\nimport type { ModelSchema } from '@warp-drive/core/types';\nimport type { EmptyResourceDocument, SingleResourceDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { MinimumSerializerInterface } from './compat';\n// oxlint-disable-next-line no-unused-vars\nimport type { JSONSerializer } from './serializer/json';\n\nconst service = s.service ?? s.inject;\n\n/**\n > ⚠️ CAUTION you likely want the docs for {@link MinimumSerializerInterface}\n > as extending this abstract class is unnecessary.\n\n `Serializer` is an abstract base class that you may override in your\n application to customize it for your backend. The minimum set of methods\n that you should implement is:\n\n * `normalizeResponse()`\n * `serialize()`\n\n And you can optionally override the following methods:\n\n * `normalize()`\n\n For an example implementation, see the included {@link JSONSerializer}.\n\n @summary Legacy abstract base class for serializers that normalize API responses into JSON:API and serialize\n records into the API's request format.\n @class Serializer\n @public\n*/\n\nexport class Serializer extends EmberObject {\n /**\n The `store` property is the application's `store` that contains\n all records. It can be used to look up serializers for other model\n types that may be nested inside the payload response.\n\n Example:\n\n ```js\n Serializer.extend({\n extractRelationship(relationshipModelName, relationshipHash) {\n let modelClass = this.store.modelFor(relationshipModelName);\n let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n return relationshipSerializer.normalize(modelClass, relationshipHash);\n }\n });\n ```\n\n @public\n */\n @service declare store: Store;\n\n /**\n The `normalizeResponse` method is used to normalize a payload from the\n server to a JSON-API Document.\n\n http://jsonapi.org/format/#document-structure\n\n Example:\n\n ```js\n Serializer.extend({\n normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n if (requestType === 'findRecord') {\n return this.normalize(primaryModelClass, payload);\n } else {\n return payload.reduce(function(documentHash, item) {\n let { data, included } = this.normalize(primaryModelClass, item);\n documentHash.included.push(...included);\n documentHash.data.push(data);\n return documentHash;\n }, { data: [], included: [] })\n }\n }\n });\n ```\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n\n /**\n The `serialize` method is used when a record is saved in order to convert\n the record into the form that your external data source expects.\n\n `serialize` takes an optional `options` hash with a single option:\n\n - `includeId`: If this is `true`, `serialize` should include the ID\n in the serialized object it builds.\n\n Example:\n\n ```js\n Serializer.extend({\n serialize(snapshot, options) {\n let json = {\n id: snapshot.id\n };\n\n snapshot.eachAttribute((key, attribute) => {\n json[key] = snapshot.attr(key);\n });\n\n snapshot.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n json[key] = snapshot.belongsTo(key, { id: true });\n } else if (relationship.kind === 'hasMany') {\n json[key] = snapshot.hasMany(key, { ids: true });\n }\n });\n\n return json;\n },\n });\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} [options]\n @return {Object}\n */\n\n /**\n The `normalize` method is used to convert a payload received from your\n external data source into the normalized form `store.push()` expects. You\n should override this method, munge the hash and return the normalized\n payload.\n\n Example:\n\n ```js\n Serializer.extend({\n normalize(modelClass, resourceHash) {\n let data = {\n id: resourceHash.id,\n type: modelClass.modelName,\n attributes: resourceHash\n };\n return { data: data };\n }\n })\n ```\n\n @public\n @param _typeClass - the model class the hash is being normalized for\n @param hash - the raw payload hash to normalize\n @return the normalized resource document\n */\n normalize(_typeClass: ModelSchema, hash: Record<string, unknown>): SingleResourceDocument | EmptyResourceDocument {\n return hash as unknown as SingleResourceDocument;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8JA,MAAMI,UAAUH,EAAEG,WAAWH,EAAEI;;;;;;;;;;;;;;;;;;;;;;;AAyB/B,IAAaC,aAAb,cAAgCN,YAAY;CAAA;EAAAE,gBAAA,KAAAK,WAAA,SAAA,CAoBzCH,OAAO,CAAA;CAAA;CAAA,UAAAD,4BAAA,MAAA,OAAA,GAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGRM,UAAUC,YAAyBC,MAA+E;EAChH,OAAOA;CACT;AACF"}
@@ -1,11 +1,11 @@
1
- import { n as normalizeModelName } from "./util-dSKEgQDp.js";
2
- import { t as isMaybeIdentifier } from "./utils-DYC9utVJ.js";
1
+ import { n as normalizeModelName } from "./util-CI7b4vAE.js";
2
+ import { t as isMaybeIdentifier } from "./utils-_O0MjUTU.js";
3
3
  import { assertPrivateStore, constructResource, ensureStringId, recordIdentifierFor, storeFor } from "@warp-drive/core/store/-private";
4
4
  import { defineSignal } from "@warp-drive/core/signals/-leaked";
5
5
  import { getOrSetGlobal } from "@warp-drive/core/types/-private";
6
6
  import { SkipCache } from "@warp-drive/core/types/request";
7
7
 
8
- //#region src/store/-private.ts
8
+ // src/store/-private.ts
9
9
  function preloadData(store, identifier, preload) {
10
10
  const jsonPayload = {};
11
11
  const fields = store.schema.fields(identifier);
@@ -283,14 +283,21 @@ var ShimModelClass = class {
283
283
  }
284
284
  };
285
285
 
286
- //#endregion
287
- //#region src/store.ts
286
+ // src/store.ts
287
+ /**
288
+ * @module
289
+ * @summary Legacy `restoreDeprecatedStoreBehaviors`, which restores the adapter-based `findRecord`, `findAll`, `query`,
290
+ * `saveRecord` and related methods onto a `Store` class.
291
+ */
288
292
  /**
289
293
  * Restores the deprecated `findRecord`/`findAll`/`query`/`queryRecord`/
290
294
  * `findBelongsTo`/`findHasMany`/`createRecord`/`deleteRecord`/`saveRecord`
291
295
  * legacy-network-layer implementations of these methods onto the given
292
296
  * `Store` subclass, for apps that have not yet migrated to the
293
297
  * `RequestManager`-based equivalents.
298
+ *
299
+ * @summary Legacy opt-in that restores the adapter-based `findRecord`, `findAll`, `query`, `saveRecord`, and related
300
+ * methods onto a `Store` class.
294
301
  */
295
302
  function restoreDeprecatedStoreBehaviors(StoreKlass) {
296
303
  StoreKlass.prototype.findRecord = function(resource, id, options) {
@@ -467,6 +474,5 @@ function upgradeInstanceCaches(cache) {
467
474
  return withReferences;
468
475
  }
469
476
 
470
- //#endregion
471
477
  export { restoreDeprecatedStoreBehaviors as t };
472
- //# sourceMappingURL=store-D_V8-HQl.js.map
478
+ //# sourceMappingURL=store-BiXsLLAu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-BiXsLLAu.js","names":["defineSignal","assertPrivateStore","ensureStringId","recordIdentifierFor","getOrSetGlobal","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","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","restoreDeprecatedStoreBehaviors","StoreKlass","prototype","findRecord","resource","id","options","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","/**\n * @module\n * @summary Legacy `restoreDeprecatedStoreBehaviors`, which restores the adapter-based `findRecord`, `findAll`, `query`,\n * `saveRecord` and related methods onto a `Store` class.\n */\n\nimport 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 *\n * @summary Legacy opt-in that restores the adapter-based `findRecord`, `findAll`, `query`, `saveRecord`, and related\n * methods onto a `Store` class.\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 withReferences;\n}\n"],"mappings":";;;;;;;;AAwCA,SAAgBK,YAAYC,OAAcC,YAA4BC,SAAsC;CAC1G,MAAMC,cAA+C,CAAC;CAGtD,MAAMG,SADUN,MAAMK,OACCC,OAAOL,UAAU;CACxCM,OAAOC,KAAKN,OAAO,CAAC,CAACO,SAASC,QAAQ;EACpC,MAAMC,eAAeT,QAAQQ;EAE7B,MAAME,QAAQN,OAAOO,IAAIH,GAAG;EAC5B,IAAIE,UAAUA,MAAME,SAAS,aAAaF,MAAME,SAAS,cAAc;GACrE,IAAI,CAACX,YAAYY,eACfZ,YAAYY,gBAAgB,CAAC;GAE/BZ,YAAYY,cAAcL,OAAOM,oBAAoBJ,OAAOD,YAAY;EAC1E,OAAO;GACL,IAAI,CAACR,YAAYc,YACfd,YAAYc,aAAa,CAAC;GAE5Bd,YAAYc,WAAWP,OAAOC;EAChC;CACF,CAAC;CACD,MAAMO,QAAQlB,MAAMkB;CACpBvB,mBAAmBK,KAAK;CACxB,MAAMmB,YAAYC,QAAQpB,MAAMqB,eAAeC,KAAKrB,UAAU,CAAC;CAC/DiB,MAAMK,OAAOtB,YAAYE,aAAagB,SAAS;AACjD;AAEA,SAASH,oBACPX,QACAM,cAC6D;CAC7D,MAAMa,cAAcnB,OAAOoB;CAE3B,IAAIpB,OAAOS,SAAS,WAAW;EAC7B,EAAAY,SAAA;GAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,oEAAoE;EAAA,EAAA,CAAEC,MAAMC,QAAQlB,YAAY,CAAC;EACxG,OAAO,EAAEmB,MAAMnB,aAAaoB,KAAKC,UAAUC,kCAAkCD,OAAOR,WAAW,CAAC,EAAE;CACpG;CAEA,EAAAE,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,yE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 @@
1
- import { t as restoreDeprecatedStoreBehaviors } from "./store-D_V8-HQl.js";
1
+ import { t as restoreDeprecatedStoreBehaviors } from "./store-BiXsLLAu.js";
2
2
 
3
3
  export { restoreDeprecatedStoreBehaviors };
@@ -1,4 +1,4 @@
1
- //#region src/model/-private/util.ts
1
+ // src/model/-private/util.ts
2
2
  function isElementDescriptor(args) {
3
3
  const [maybeTarget, maybeKey, maybeDesc] = args;
4
4
  return args.length === 3 && (typeof maybeTarget === "function" || typeof maybeTarget === "object" && maybeTarget !== null) && typeof maybeKey === "string" && (typeof maybeDesc === "object" && maybeDesc !== null && "enumerable" in maybeDesc && "configurable" in maybeDesc || maybeDesc === void 0);
@@ -7,6 +7,5 @@ function normalizeModelName(type) {
7
7
  return type;
8
8
  }
9
9
 
10
- //#endregion
11
10
  export { normalizeModelName as n, isElementDescriptor as t };
12
- //# sourceMappingURL=util-dSKEgQDp.js.map
11
+ //# sourceMappingURL=util-CI7b4vAE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util-dSKEgQDp.js","names":["dasherize","isElementDescriptor","args","maybeTarget","maybeKey","maybeDesc","length","undefined","normalizeModelName","type"],"sources":["../../../src/model/-private/util.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/core/build-config/deprecations';\nimport { dasherize } from '@warp-drive/utilities/string';\n\nexport type DecoratorPropertyDescriptor = (PropertyDescriptor & { initializer?: () => unknown }) | undefined;\n\nexport function isElementDescriptor(args: unknown[]): args is [object, string, DecoratorPropertyDescriptor] {\n const [maybeTarget, maybeKey, maybeDesc] = args;\n\n return (\n // Ensure we have the right number of args\n args.length === 3 &&\n // Make sure the target is a class or object (prototype)\n (typeof maybeTarget === 'function' || (typeof maybeTarget === 'object' && maybeTarget !== null)) &&\n // Make sure the key is a string\n typeof maybeKey === 'string' &&\n // Make sure the descriptor is the right shape\n ((typeof maybeDesc === 'object' &&\n maybeDesc !== null &&\n 'enumerable' in maybeDesc &&\n 'configurable' in maybeDesc) ||\n // TS compatibility\n maybeDesc === undefined)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n"],"mappings":";AAOA,SAAgBC,oBAAoBC,MAAwE;CAC1G,MAAM,CAACC,aAAaC,UAAUC,aAAaH;CAE3C,OAEEA,KAAKI,WAAW,MAEf,OAAOH,gBAAgB,cAAe,OAAOA,gBAAgB,YAAYA,gBAAgB,SAE1F,OAAOC,aAAa,aAElB,OAAOC,cAAc,YACrBA,cAAc,QACd,gBAAgBA,aAChB,kBAAkBA,aAElBA,cAAcE;AAEpB;AAEA,SAAgBC,mBAAmBC,MAAsB;CAqBvD,OAAOA;AACT"}
1
+ {"version":3,"file":"util-CI7b4vAE.js","names":["dasherize","isElementDescriptor","args","maybeTarget","maybeKey","maybeDesc","length","undefined","normalizeModelName","type"],"sources":["../../../src/model/-private/util.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/core/build-config/deprecations';\nimport { dasherize } from '@warp-drive/utilities/string';\n\nexport type DecoratorPropertyDescriptor = (PropertyDescriptor & { initializer?: () => unknown }) | undefined;\n\nexport function isElementDescriptor(args: unknown[]): args is [object, string, DecoratorPropertyDescriptor] {\n const [maybeTarget, maybeKey, maybeDesc] = args;\n\n return (\n // Ensure we have the right number of args\n args.length === 3 &&\n // Make sure the target is a class or object (prototype)\n (typeof maybeTarget === 'function' || (typeof maybeTarget === 'object' && maybeTarget !== null)) &&\n // Make sure the key is a string\n typeof maybeKey === 'string' &&\n // Make sure the descriptor is the right shape\n ((typeof maybeDesc === 'object' &&\n maybeDesc !== null &&\n 'enumerable' in maybeDesc &&\n 'configurable' in maybeDesc) ||\n // TS compatibility\n maybeDesc === undefined)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n"],"mappings":";AAOA,SAAgBC,oBAAoBC,MAAwE;CAC1G,MAAM,CAACC,aAAaC,UAAUC,aAAaH;CAE3C,OAEEA,KAAKI,WAAW,MAEf,OAAOH,gBAAgB,cAAe,OAAOA,gBAAgB,YAAYA,gBAAgB,SAE1F,OAAOC,aAAa,aAElB,OAAOC,cAAc,YACrBA,cAAc,QACd,gBAAgBA,aAChB,kBAAkBA,aAElBA,cAAcE;AAEpB;AAEA,SAAgBC,mBAAmBC,MAAsB;CAqBvD,OAAOA;AACT"}
@@ -1,4 +1,4 @@
1
- //#region src/compat/builders/utils.ts
1
+ // src/compat/builders/utils.ts
2
2
  function isMaybeIdentifier(maybeIdentifier) {
3
3
  return Boolean(maybeIdentifier !== null && typeof maybeIdentifier === "object" && ("id" in maybeIdentifier && "type" in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type || maybeIdentifier.lid));
4
4
  }
@@ -6,6 +6,5 @@ function normalizeModelName(type) {
6
6
  return type;
7
7
  }
8
8
 
9
- //#endregion
10
9
  export { normalizeModelName as n, isMaybeIdentifier as t };
11
- //# sourceMappingURL=utils-DYC9utVJ.js.map
10
+ //# sourceMappingURL=utils-_O0MjUTU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-DYC9utVJ.js","names":["dasherize","isMaybeIdentifier","maybeIdentifier","Boolean","id","type","lid","normalizeModelName"],"sources":["../../../src/compat/builders/utils.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/core/build-config/deprecations';\nimport type { ResourceIdentifierObject } from '@warp-drive/core/types/spec/json-api-raw';\nimport { dasherize } from '@warp-drive/utilities/string';\n\nexport function isMaybeIdentifier(\n maybeIdentifier: string | ResourceIdentifierObject\n): maybeIdentifier is ResourceIdentifierObject {\n return Boolean(\n maybeIdentifier !== null &&\n typeof maybeIdentifier === 'object' &&\n (('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type) ||\n maybeIdentifier.lid)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n"],"mappings":";AAMA,SAAgBC,kBACdC,iBAC6C;CAC7C,OAAOC,QACLD,oBAAoB,QACpB,OAAOA,oBAAoB,aACzB,QAAQA,mBAAmB,UAAUA,mBAAmBA,gBAAgBE,MAAMF,gBAAgBG,QAC9FH,gBAAgBI,IACpB;AACF;AAEA,SAAgBC,mBAAmBF,MAAsB;CAqBvD,OAAOA;AACT"}
1
+ {"version":3,"file":"utils-_O0MjUTU.js","names":["dasherize","isMaybeIdentifier","maybeIdentifier","Boolean","id","type","lid","normalizeModelName"],"sources":["../../../src/compat/builders/utils.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/core/build-config/deprecations';\nimport type { ResourceIdentifierObject } from '@warp-drive/core/types/spec/json-api-raw';\nimport { dasherize } from '@warp-drive/utilities/string';\n\nexport function isMaybeIdentifier(\n maybeIdentifier: string | ResourceIdentifierObject\n): maybeIdentifier is ResourceIdentifierObject {\n return Boolean(\n maybeIdentifier !== null &&\n typeof maybeIdentifier === 'object' &&\n (('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type) ||\n maybeIdentifier.lid)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n"],"mappings":";AAMA,SAAgBC,kBACdC,iBAC6C;CAC7C,OAAOC,QACLD,oBAAoB,QACpB,OAAOA,oBAAoB,aACzB,QAAQA,mBAAmB,UAAUA,mBAAmBA,gBAAgBE,MAAMF,gBAAgBG,QAC9FH,gBAAgBI,IACpB;AACF;AAEA,SAAgBC,mBAAmBF,MAAsB;CAqBvD,OAAOA;AACT"}
@@ -1,6 +1,6 @@
1
- import { t as upgradeStore } from "./-private-vOhxVExH.js";
1
+ import { t as upgradeStore } from "./-private-Dch4SxkU.js";
2
2
 
3
- //#region src/adapter/-private/utils/parse-response-headers.ts
3
+ // src/adapter/-private/utils/parse-response-headers.ts
4
4
  const newline = /\r?\n/;
5
5
  function parseResponseHeaders(headersString) {
6
6
  const headers = Object.create(null);
@@ -26,8 +26,7 @@ function parseResponseHeaders(headersString) {
26
26
  return headers;
27
27
  }
28
28
 
29
- //#endregion
30
- //#region src/adapter/-private/utils/continue-on-reject.ts
29
+ // src/adapter/-private/utils/continue-on-reject.ts
31
30
  /**
32
31
  * A utility function that returns a promise that resolves
33
32
  * even when the source promise rejects.
@@ -38,8 +37,7 @@ function continueOnReject(promise) {
38
37
  return Promise.resolve(promise).catch((e) => e);
39
38
  }
40
39
 
41
- //#endregion
42
- //#region src/adapter/-private/utils/determine-body-promise.ts
40
+ // src/adapter/-private/utils/determine-body-promise.ts
43
41
  function _determineContent(response, requestData, payload) {
44
42
  let ret = payload;
45
43
  let error = null;
@@ -69,8 +67,7 @@ function determineBodyPromise(response, requestData) {
69
67
  return continueOnReject(response.text()).then((payload) => _determineContent(response, requestData, payload));
70
68
  }
71
69
 
72
- //#endregion
73
- //#region src/adapter/-private/utils/serialize-query-params.ts
70
+ // src/adapter/-private/utils/serialize-query-params.ts
74
71
  const RBRACKET = /\[\]$/;
75
72
  function isPlainObject(obj) {
76
73
  return Object.prototype.toString.call(obj) === "[object Object]";
@@ -118,8 +115,7 @@ function add(s, k, v) {
118
115
  s[s.length] = `${encodeURIComponent(k)}=${encodeURIComponent(v)}`;
119
116
  }
120
117
 
121
- //#endregion
122
- //#region src/adapter/-private/utils/fetch.ts
118
+ // src/adapter/-private/utils/fetch.ts
123
119
  let _fetch = null;
124
120
  let REQUEST = null;
125
121
  function getFetchFunction() {
@@ -168,8 +164,7 @@ function setupFastboot(fastBootRequest) {
168
164
  REQUEST = fastBootRequest;
169
165
  }
170
166
 
171
- //#endregion
172
- //#region src/adapter/-private/utils/serialize-into-hash.ts
167
+ // src/adapter/-private/utils/serialize-into-hash.ts
173
168
  function serializeIntoHash(store, modelClass, snapshot, options = { includeId: true }) {
174
169
  /* @__PURE__ */ upgradeStore(store);
175
170
  const serializer = store.serializerFor(modelClass.modelName);
@@ -184,6 +179,5 @@ function serializeIntoHash(store, modelClass, snapshot, options = { includeId: t
184
179
  return serializer.serialize(snapshot, options);
185
180
  }
186
181
 
187
- //#endregion
188
182
  export { determineBodyPromise as a, serializeQueryParams as i, getFetchFunction as n, parseResponseHeaders as o, setupFastboot as r, serializeIntoHash as t };
189
- //# sourceMappingURL=-private-CrEyBE-B.js.map
183
+ //# sourceMappingURL=-private-BprUAEe_.js.map