@warp-drive/legacy 5.9.0-alpha.21 → 5.9.0-alpha.22

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 (467) hide show
  1. package/dist/-private-DQ6Iap2t.js +193 -0
  2. package/dist/-private-DQ6Iap2t.js.map +1 -0
  3. package/dist/-private-DccRZQsm.js +904 -0
  4. package/dist/-private-DccRZQsm.js.map +1 -0
  5. package/dist/adapter/-private.d.ts +33 -0
  6. package/dist/adapter/-private.d.ts.map +1 -0
  7. package/dist/adapter/-private.js +3 -1
  8. package/dist/adapter/error.d.ts +2 -0
  9. package/dist/adapter/error.js +422 -453
  10. package/dist/adapter/error.js.map +1 -0
  11. package/{declarations → dist}/adapter/json-api.d.ts +30 -29
  12. package/dist/adapter/json-api.d.ts.map +1 -0
  13. package/dist/adapter/json-api.js +265 -143
  14. package/dist/adapter/json-api.js.map +1 -0
  15. package/dist/adapter/rest.d.ts +2 -0
  16. package/dist/adapter/rest.js +937 -1136
  17. package/dist/adapter/rest.js.map +1 -0
  18. package/dist/adapter-CARrK3-8.d.ts +784 -0
  19. package/dist/adapter-CARrK3-8.d.ts.map +1 -0
  20. package/dist/adapter-XgLAkYVs.js +1130 -0
  21. package/dist/adapter-XgLAkYVs.js.map +1 -0
  22. package/dist/adapter.d.ts +2 -0
  23. package/dist/adapter.js +1 -1248
  24. package/dist/compat/-private.d.ts +2 -0
  25. package/dist/compat/-private.js +3 -1
  26. package/dist/compat/builders.d.ts +169 -0
  27. package/dist/compat/builders.d.ts.map +1 -0
  28. package/dist/compat/builders.js +205 -245
  29. package/dist/compat/builders.js.map +1 -0
  30. package/dist/compat/extensions.d.ts +2 -0
  31. package/dist/compat/extensions.js +265 -304
  32. package/dist/compat/extensions.js.map +1 -0
  33. package/dist/compat/utils.d.ts +151 -0
  34. package/dist/compat/utils.d.ts.map +1 -0
  35. package/dist/compat/utils.js +187 -206
  36. package/dist/compat/utils.js.map +1 -0
  37. package/dist/compat-BbNNmTM-.d.ts +1386 -0
  38. package/dist/compat-BbNNmTM-.d.ts.map +1 -0
  39. package/dist/compat-g__Pfy2S.js +734 -0
  40. package/dist/compat-g__Pfy2S.js.map +1 -0
  41. package/dist/compat.d.ts +2 -0
  42. package/dist/compat.js +1 -1036
  43. package/dist/error-CzkyXr1Q.d.ts +435 -0
  44. package/dist/error-CzkyXr1Q.d.ts.map +1 -0
  45. package/dist/errors-LQhmDVdd.js +2134 -0
  46. package/dist/errors-LQhmDVdd.js.map +1 -0
  47. package/dist/extensions-DumNm4dA.d.ts +102 -0
  48. package/dist/extensions-DumNm4dA.d.ts.map +1 -0
  49. package/dist/index.d.ts +243 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +267 -339
  52. package/dist/index.js.map +1 -0
  53. package/dist/json-BXNPTlcH.js +1106 -0
  54. package/dist/json-BXNPTlcH.js.map +1 -0
  55. package/dist/model/-private.d.ts +3 -0
  56. package/dist/model/-private.js +3 -1
  57. package/dist/model/migration-support.d.ts +335 -0
  58. package/dist/model/migration-support.d.ts.map +1 -0
  59. package/dist/model/migration-support.js +504 -575
  60. package/dist/model/migration-support.js.map +1 -0
  61. package/dist/model-62hn5_PD.d.ts +3107 -0
  62. package/dist/model-62hn5_PD.d.ts.map +1 -0
  63. package/dist/model-BtIEHqYZ.js +683 -0
  64. package/dist/model-BtIEHqYZ.js.map +1 -0
  65. package/dist/model-fragments-Dpn9285r.js +334 -0
  66. package/dist/model-fragments-Dpn9285r.js.map +1 -0
  67. package/dist/model-fragments.d.ts +294 -0
  68. package/dist/model-fragments.d.ts.map +1 -0
  69. package/dist/model-fragments.js +2 -94
  70. package/dist/model.d.ts +404 -0
  71. package/dist/model.d.ts.map +1 -0
  72. package/dist/model.js +3 -670
  73. package/{declarations/adapter/rest.d.ts → dist/rest-0NhtexIq.d.ts} +183 -173
  74. package/dist/rest-0NhtexIq.d.ts.map +1 -0
  75. package/dist/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
  76. package/dist/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
  77. package/dist/schema-provider-DsKuB5Wb.js +1929 -0
  78. package/dist/schema-provider-DsKuB5Wb.js.map +1 -0
  79. package/{declarations → dist}/serializer/json-api.d.ts +3 -0
  80. package/dist/serializer/json-api.d.ts.map +1 -0
  81. package/dist/serializer/json-api.js +527 -519
  82. package/dist/serializer/json-api.js.map +1 -0
  83. package/{declarations → dist}/serializer/json.d.ts +3 -0
  84. package/dist/serializer/json.d.ts.map +1 -0
  85. package/dist/serializer/json.js +3 -6
  86. package/{declarations/serializer/-private/embedded-records-mixin.d.ts → dist/serializer/rest.d.ts} +56 -1
  87. package/dist/serializer/rest.d.ts.map +1 -0
  88. package/dist/serializer/rest.js +958 -1199
  89. package/dist/serializer/rest.js.map +1 -0
  90. package/dist/serializer/transform.d.ts +313 -0
  91. package/dist/serializer/transform.d.ts.map +1 -0
  92. package/dist/serializer/transform.js +283 -308
  93. package/dist/serializer/transform.js.map +1 -0
  94. package/dist/serializer.d.ts +151 -0
  95. package/dist/serializer.d.ts.map +1 -0
  96. package/dist/serializer.js +205 -205
  97. package/dist/serializer.js.map +1 -0
  98. package/dist/store-C4qYzXei.js +473 -0
  99. package/dist/store-C4qYzXei.js.map +1 -0
  100. package/dist/store.d.ts +13 -0
  101. package/dist/store.d.ts.map +1 -0
  102. package/dist/store.js +1 -641
  103. package/dist/unpkg/dev/-private-CrEyBE-B.js +189 -0
  104. package/dist/unpkg/dev/-private-CrEyBE-B.js.map +1 -0
  105. package/dist/unpkg/dev/-private-vOhxVExH.js +896 -0
  106. package/dist/unpkg/dev/-private-vOhxVExH.js.map +1 -0
  107. package/dist/unpkg/dev/adapter/-private.js +3 -1
  108. package/dist/unpkg/dev/adapter/error.js +421 -452
  109. package/dist/unpkg/dev/adapter/error.js.map +1 -0
  110. package/dist/unpkg/dev/adapter/json-api.js +239 -257
  111. package/dist/unpkg/dev/adapter/json-api.js.map +1 -0
  112. package/dist/unpkg/dev/adapter/rest.js +935 -1134
  113. package/dist/unpkg/dev/adapter/rest.js.map +1 -0
  114. package/dist/unpkg/dev/adapter-Cw0uSl8d.js +1129 -0
  115. package/dist/unpkg/dev/adapter-Cw0uSl8d.js.map +1 -0
  116. package/dist/unpkg/dev/adapter.js +1 -1247
  117. package/dist/unpkg/dev/compat/-private.js +3 -1
  118. package/dist/unpkg/dev/compat/builders.js +204 -247
  119. package/dist/unpkg/dev/compat/builders.js.map +1 -0
  120. package/dist/unpkg/dev/compat/extensions.js +264 -303
  121. package/dist/unpkg/dev/compat/extensions.js.map +1 -0
  122. package/dist/unpkg/dev/compat/utils.js +186 -205
  123. package/dist/unpkg/dev/compat/utils.js.map +1 -0
  124. package/dist/unpkg/dev/compat-CeyxXB7K.js +825 -0
  125. package/dist/unpkg/dev/compat-CeyxXB7K.js.map +1 -0
  126. package/dist/unpkg/dev/compat.js +1 -1178
  127. package/dist/unpkg/dev/errors-1javxsPo.js +2127 -0
  128. package/dist/unpkg/dev/errors-1javxsPo.js.map +1 -0
  129. package/dist/unpkg/dev/index.js +266 -344
  130. package/dist/unpkg/dev/index.js.map +1 -0
  131. package/dist/unpkg/dev/json-DDJji3V3.js +1104 -0
  132. package/dist/unpkg/dev/json-DDJji3V3.js.map +1 -0
  133. package/dist/unpkg/dev/model/-private.js +3 -1
  134. package/dist/unpkg/dev/model/migration-support.js +481 -549
  135. package/dist/unpkg/dev/model/migration-support.js.map +1 -0
  136. package/dist/unpkg/dev/model-C9Xb1R1x.js +655 -0
  137. package/dist/unpkg/dev/model-C9Xb1R1x.js.map +1 -0
  138. package/dist/unpkg/dev/model-fragments-Dpn9285r.js +334 -0
  139. package/dist/unpkg/dev/model-fragments-Dpn9285r.js.map +1 -0
  140. package/dist/unpkg/dev/model-fragments.js +2 -94
  141. package/dist/unpkg/dev/model.js +3 -681
  142. package/dist/unpkg/dev/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
  143. package/dist/unpkg/dev/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
  144. package/dist/unpkg/dev/schema-provider-Dy6c1J5f.js +1834 -0
  145. package/dist/unpkg/dev/schema-provider-Dy6c1J5f.js.map +1 -0
  146. package/dist/unpkg/dev/serializer/json-api.js +514 -634
  147. package/dist/unpkg/dev/serializer/json-api.js.map +1 -0
  148. package/dist/unpkg/dev/serializer/json.js +3 -4
  149. package/dist/unpkg/dev/serializer/rest.js +954 -1196
  150. package/dist/unpkg/dev/serializer/rest.js.map +1 -0
  151. package/dist/unpkg/dev/serializer/transform.js +283 -308
  152. package/dist/unpkg/dev/serializer/transform.js.map +1 -0
  153. package/dist/unpkg/dev/serializer.js +205 -205
  154. package/dist/unpkg/dev/serializer.js.map +1 -0
  155. package/dist/unpkg/dev/store-D_V8-HQl.js +472 -0
  156. package/dist/unpkg/dev/store-D_V8-HQl.js.map +1 -0
  157. package/dist/unpkg/dev/store.js +1 -649
  158. package/dist/unpkg/dev/util-dSKEgQDp.js +12 -0
  159. package/dist/unpkg/dev/util-dSKEgQDp.js.map +1 -0
  160. package/dist/unpkg/dev/utils-DYC9utVJ.js +11 -0
  161. package/dist/unpkg/dev/utils-DYC9utVJ.js.map +1 -0
  162. package/dist/unpkg/dev-deprecated/-private-CrEyBE-B.js +189 -0
  163. package/dist/unpkg/dev-deprecated/-private-CrEyBE-B.js.map +1 -0
  164. package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js +896 -0
  165. package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js.map +1 -0
  166. package/dist/unpkg/dev-deprecated/adapter/-private.js +3 -1
  167. package/dist/unpkg/dev-deprecated/adapter/error.js +421 -452
  168. package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -0
  169. package/dist/unpkg/dev-deprecated/adapter/json-api.js +239 -257
  170. package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -0
  171. package/dist/unpkg/dev-deprecated/adapter/rest.js +935 -1134
  172. package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -0
  173. package/dist/unpkg/dev-deprecated/adapter-Cw0uSl8d.js +1129 -0
  174. package/dist/unpkg/dev-deprecated/adapter-Cw0uSl8d.js.map +1 -0
  175. package/dist/unpkg/dev-deprecated/adapter.js +1 -1247
  176. package/dist/unpkg/dev-deprecated/compat/-private.js +3 -1
  177. package/dist/unpkg/dev-deprecated/compat/builders.js +204 -247
  178. package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -0
  179. package/dist/unpkg/dev-deprecated/compat/extensions.js +264 -303
  180. package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -0
  181. package/dist/unpkg/dev-deprecated/compat/utils.js +186 -205
  182. package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -0
  183. package/dist/unpkg/dev-deprecated/compat-DmAgB2NS.js +825 -0
  184. package/dist/unpkg/dev-deprecated/compat-DmAgB2NS.js.map +1 -0
  185. package/dist/unpkg/dev-deprecated/compat.js +1 -1178
  186. package/dist/unpkg/dev-deprecated/errors-C4_aOhY5.js +2128 -0
  187. package/dist/unpkg/dev-deprecated/errors-C4_aOhY5.js.map +1 -0
  188. package/dist/unpkg/dev-deprecated/index.js +266 -343
  189. package/dist/unpkg/dev-deprecated/index.js.map +1 -0
  190. package/dist/unpkg/dev-deprecated/json-DDJji3V3.js +1104 -0
  191. package/dist/unpkg/dev-deprecated/json-DDJji3V3.js.map +1 -0
  192. package/dist/unpkg/dev-deprecated/model/-private.js +3 -1
  193. package/dist/unpkg/dev-deprecated/model/migration-support.js +492 -566
  194. package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -0
  195. package/dist/unpkg/dev-deprecated/model-CvSMYkgs.js +660 -0
  196. package/dist/unpkg/dev-deprecated/model-CvSMYkgs.js.map +1 -0
  197. package/dist/unpkg/dev-deprecated/model-fragments-Dpn9285r.js +334 -0
  198. package/dist/unpkg/dev-deprecated/model-fragments-Dpn9285r.js.map +1 -0
  199. package/dist/unpkg/dev-deprecated/model-fragments.js +2 -94
  200. package/dist/unpkg/dev-deprecated/model.js +3 -685
  201. package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
  202. package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
  203. package/dist/unpkg/dev-deprecated/schema-provider-Cqttza94.js +1835 -0
  204. package/dist/unpkg/dev-deprecated/schema-provider-Cqttza94.js.map +1 -0
  205. package/dist/unpkg/dev-deprecated/serializer/json-api.js +514 -634
  206. package/dist/unpkg/dev-deprecated/serializer/json-api.js.map +1 -0
  207. package/dist/unpkg/dev-deprecated/serializer/json.js +3 -4
  208. package/dist/unpkg/dev-deprecated/serializer/rest.js +954 -1196
  209. package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -0
  210. package/dist/unpkg/dev-deprecated/serializer/transform.js +283 -308
  211. package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -0
  212. package/dist/unpkg/dev-deprecated/serializer.js +205 -205
  213. package/dist/unpkg/dev-deprecated/serializer.js.map +1 -0
  214. package/dist/unpkg/dev-deprecated/store-BX7GvXC_.js +472 -0
  215. package/dist/unpkg/dev-deprecated/store-BX7GvXC_.js.map +1 -0
  216. package/dist/unpkg/dev-deprecated/store.js +1 -649
  217. package/dist/unpkg/dev-deprecated/util-9mgEBJ3W.js +18 -0
  218. package/dist/unpkg/dev-deprecated/util-9mgEBJ3W.js.map +1 -0
  219. package/dist/unpkg/dev-deprecated/utils-Cl86-e7F.js +17 -0
  220. package/dist/unpkg/dev-deprecated/utils-Cl86-e7F.js.map +1 -0
  221. package/dist/unpkg/prod/-private-B4bxoTuK.js +160 -0
  222. package/dist/unpkg/prod/-private-B4bxoTuK.js.map +1 -0
  223. package/dist/unpkg/prod/-private-SfXkkHKd.js +745 -0
  224. package/dist/unpkg/prod/-private-SfXkkHKd.js.map +1 -0
  225. package/dist/unpkg/prod/adapter/-private.js +3 -1
  226. package/dist/unpkg/prod/adapter/error.js +418 -447
  227. package/dist/unpkg/prod/adapter/error.js.map +1 -0
  228. package/dist/unpkg/prod/adapter/json-api.js +236 -252
  229. package/dist/unpkg/prod/adapter/json-api.js.map +1 -0
  230. package/dist/unpkg/prod/adapter/rest.js +911 -1097
  231. package/dist/unpkg/prod/adapter/rest.js.map +1 -0
  232. package/dist/unpkg/prod/adapter-Wnk7jizX.js +1111 -0
  233. package/dist/unpkg/prod/adapter-Wnk7jizX.js.map +1 -0
  234. package/dist/unpkg/prod/adapter.js +1 -1214
  235. package/dist/unpkg/prod/compat/-private.js +3 -1
  236. package/dist/unpkg/prod/compat/builders.js +165 -182
  237. package/dist/unpkg/prod/compat/builders.js.map +1 -0
  238. package/dist/unpkg/prod/compat/extensions.js +252 -283
  239. package/dist/unpkg/prod/compat/extensions.js.map +1 -0
  240. package/dist/unpkg/prod/compat/utils.js +183 -200
  241. package/dist/unpkg/prod/compat/utils.js.map +1 -0
  242. package/dist/unpkg/prod/compat-CJ87MzDn.js +547 -0
  243. package/dist/unpkg/prod/compat-CJ87MzDn.js.map +1 -0
  244. package/dist/unpkg/prod/compat.js +1 -742
  245. package/dist/unpkg/prod/errors-Co7YWHoA.js +1977 -0
  246. package/dist/unpkg/prod/errors-Co7YWHoA.js.map +1 -0
  247. package/dist/unpkg/prod/index.js +245 -308
  248. package/dist/unpkg/prod/index.js.map +1 -0
  249. package/dist/unpkg/prod/json-BD1kRTfB.js +1080 -0
  250. package/dist/unpkg/prod/json-BD1kRTfB.js.map +1 -0
  251. package/dist/unpkg/prod/model/-private.js +3 -1
  252. package/dist/unpkg/prod/model/migration-support.js +477 -542
  253. package/dist/unpkg/prod/model/migration-support.js.map +1 -0
  254. package/dist/unpkg/prod/model-BzoOmtka.js +603 -0
  255. package/dist/unpkg/prod/model-BzoOmtka.js.map +1 -0
  256. package/dist/unpkg/prod/model-fragments-Dpn9285r.js +334 -0
  257. package/dist/unpkg/prod/model-fragments-Dpn9285r.js.map +1 -0
  258. package/dist/unpkg/prod/model-fragments.js +2 -94
  259. package/dist/unpkg/prod/model.js +3 -596
  260. package/dist/unpkg/prod/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
  261. package/dist/unpkg/prod/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
  262. package/dist/unpkg/prod/schema-provider-CKZcqWyP.js +1622 -0
  263. package/dist/unpkg/prod/schema-provider-CKZcqWyP.js.map +1 -0
  264. package/dist/unpkg/prod/serializer/json-api.js +497 -592
  265. package/dist/unpkg/prod/serializer/json-api.js.map +1 -0
  266. package/dist/unpkg/prod/serializer/json.js +3 -4
  267. package/dist/unpkg/prod/serializer/rest.js +938 -1166
  268. package/dist/unpkg/prod/serializer/rest.js.map +1 -0
  269. package/dist/unpkg/prod/serializer/transform.js +283 -308
  270. package/dist/unpkg/prod/serializer/transform.js.map +1 -0
  271. package/dist/unpkg/prod/serializer.js +205 -205
  272. package/dist/unpkg/prod/serializer.js.map +1 -0
  273. package/dist/unpkg/prod/store-RGGc1ilN.js +392 -0
  274. package/dist/unpkg/prod/store-RGGc1ilN.js.map +1 -0
  275. package/dist/unpkg/prod/store.js +1 -517
  276. package/dist/unpkg/prod/util-dSKEgQDp.js +12 -0
  277. package/dist/unpkg/prod/util-dSKEgQDp.js.map +1 -0
  278. package/dist/unpkg/prod/utils-DYC9utVJ.js +11 -0
  279. package/dist/unpkg/prod/utils-DYC9utVJ.js.map +1 -0
  280. package/dist/unpkg/prod-deprecated/-private-B4bxoTuK.js +160 -0
  281. package/dist/unpkg/prod-deprecated/-private-B4bxoTuK.js.map +1 -0
  282. package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js +745 -0
  283. package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js.map +1 -0
  284. package/dist/unpkg/prod-deprecated/adapter/-private.js +3 -1
  285. package/dist/unpkg/prod-deprecated/adapter/error.js +418 -447
  286. package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -0
  287. package/dist/unpkg/prod-deprecated/adapter/json-api.js +236 -252
  288. package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -0
  289. package/dist/unpkg/prod-deprecated/adapter/rest.js +911 -1097
  290. package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -0
  291. package/{declarations/adapter.d.ts → dist/unpkg/prod-deprecated/adapter-Wnk7jizX.js} +445 -110
  292. package/dist/unpkg/prod-deprecated/adapter-Wnk7jizX.js.map +1 -0
  293. package/dist/unpkg/prod-deprecated/adapter.js +1 -1214
  294. package/dist/unpkg/prod-deprecated/compat/-private.js +3 -1
  295. package/dist/unpkg/prod-deprecated/compat/builders.js +165 -182
  296. package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -0
  297. package/dist/unpkg/prod-deprecated/compat/extensions.js +252 -283
  298. package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -0
  299. package/dist/unpkg/prod-deprecated/compat/utils.js +183 -200
  300. package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -0
  301. package/dist/unpkg/prod-deprecated/compat-CJ87MzDn.js +547 -0
  302. package/dist/unpkg/prod-deprecated/compat-CJ87MzDn.js.map +1 -0
  303. package/dist/unpkg/prod-deprecated/compat.js +1 -742
  304. package/dist/unpkg/prod-deprecated/errors-C-opde61.js +1978 -0
  305. package/dist/unpkg/prod-deprecated/errors-C-opde61.js.map +1 -0
  306. package/dist/unpkg/prod-deprecated/index.js +245 -307
  307. package/dist/unpkg/prod-deprecated/index.js.map +1 -0
  308. package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js +1080 -0
  309. package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js.map +1 -0
  310. package/dist/unpkg/prod-deprecated/model/-private.js +3 -1
  311. package/dist/unpkg/prod-deprecated/model/migration-support.js +488 -559
  312. package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -0
  313. package/dist/unpkg/prod-deprecated/model-C0bTXzGn.js +604 -0
  314. package/dist/unpkg/prod-deprecated/model-C0bTXzGn.js.map +1 -0
  315. package/dist/unpkg/prod-deprecated/model-fragments-Dpn9285r.js +334 -0
  316. package/dist/unpkg/prod-deprecated/model-fragments-Dpn9285r.js.map +1 -0
  317. package/dist/unpkg/prod-deprecated/model-fragments.js +2 -94
  318. package/dist/unpkg/prod-deprecated/model.js +3 -599
  319. package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
  320. package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
  321. package/dist/unpkg/prod-deprecated/schema-provider-lH3qP5tw.js +1635 -0
  322. package/dist/unpkg/prod-deprecated/schema-provider-lH3qP5tw.js.map +1 -0
  323. package/dist/unpkg/prod-deprecated/serializer/json-api.js +497 -592
  324. package/dist/unpkg/prod-deprecated/serializer/json-api.js.map +1 -0
  325. package/dist/unpkg/prod-deprecated/serializer/json.js +3 -4
  326. package/dist/unpkg/prod-deprecated/serializer/rest.js +938 -1166
  327. package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -0
  328. package/dist/unpkg/prod-deprecated/serializer/transform.js +283 -308
  329. package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -0
  330. package/dist/unpkg/prod-deprecated/serializer.js +205 -205
  331. package/dist/unpkg/prod-deprecated/serializer.js.map +1 -0
  332. package/dist/unpkg/prod-deprecated/store-0L2CkYzh.js +392 -0
  333. package/dist/unpkg/prod-deprecated/store-0L2CkYzh.js.map +1 -0
  334. package/dist/unpkg/prod-deprecated/store.js +1 -517
  335. package/dist/unpkg/prod-deprecated/util-CQQdHX3n.js +14 -0
  336. package/dist/unpkg/prod-deprecated/util-CQQdHX3n.js.map +1 -0
  337. package/dist/unpkg/prod-deprecated/utils-BMI_JwFP.js +13 -0
  338. package/dist/unpkg/prod-deprecated/utils-BMI_JwFP.js.map +1 -0
  339. package/dist/util-Bnx8nm-D.js +29 -0
  340. package/dist/util-Bnx8nm-D.js.map +1 -0
  341. package/dist/utils-ZAytYep8.js +28 -0
  342. package/dist/utils-ZAytYep8.js.map +1 -0
  343. package/package.json +13 -13
  344. package/declarations/adapter/-private/build-url-mixin.d.ts +0 -189
  345. package/declarations/adapter/-private/fastboot-interface.d.ts +0 -8
  346. package/declarations/adapter/-private/utils/continue-on-reject.d.ts +0 -1
  347. package/declarations/adapter/-private/utils/determine-body-promise.d.ts +0 -4
  348. package/declarations/adapter/-private/utils/fetch.d.ts +0 -8
  349. package/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
  350. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +0 -6
  351. package/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -5
  352. package/declarations/adapter/-private.d.ts +0 -5
  353. package/declarations/adapter/error.d.ts +0 -431
  354. package/declarations/compat/-private.d.ts +0 -13
  355. package/declarations/compat/builders/find-all.d.ts +0 -34
  356. package/declarations/compat/builders/find-record.d.ts +0 -56
  357. package/declarations/compat/builders/query.d.ts +0 -66
  358. package/declarations/compat/builders/save-record.d.ts +0 -34
  359. package/declarations/compat/builders/utils.d.ts +0 -3
  360. package/declarations/compat/builders.d.ts +0 -14
  361. package/declarations/compat/extensions.d.ts +0 -99
  362. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -55
  363. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +0 -2
  364. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +0 -11
  365. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +0 -5
  366. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +0 -9
  367. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -528
  368. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -220
  369. package/declarations/compat/legacy-network-handler/serializer-response.d.ts +0 -6
  370. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +0 -110
  371. package/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -255
  372. package/declarations/compat/utils.d.ts +0 -148
  373. package/declarations/compat.d.ts +0 -189
  374. package/declarations/index.d.ts +0 -244
  375. package/declarations/model/-private/attr.d.ts +0 -191
  376. package/declarations/model/-private/belongs-to.d.ts +0 -195
  377. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -5
  378. package/declarations/model/-private/errors.d.ts +0 -289
  379. package/declarations/model/-private/has-many.d.ts +0 -162
  380. package/declarations/model/-private/hooks.d.ts +0 -36
  381. package/declarations/model/-private/legacy-relationships-support.d.ts +0 -47
  382. package/declarations/model/-private/model-for-mixin.d.ts +0 -3
  383. package/declarations/model/-private/model-methods.d.ts +0 -39
  384. package/declarations/model/-private/model.d.ts +0 -1279
  385. package/declarations/model/-private/notify-changes.d.ts +0 -4
  386. package/declarations/model/-private/promise-belongs-to.d.ts +0 -40
  387. package/declarations/model/-private/promise-many-array.d.ts +0 -130
  388. package/declarations/model/-private/record-state.d.ts +0 -58
  389. package/declarations/model/-private/references/belongs-to.d.ts +0 -488
  390. package/declarations/model/-private/references/has-many.d.ts +0 -498
  391. package/declarations/model/-private/schema-provider.d.ts +0 -66
  392. package/declarations/model/-private/type-utils.d.ts +0 -57
  393. package/declarations/model/-private/util.d.ts +0 -5
  394. package/declarations/model/-private.d.ts +0 -8
  395. package/declarations/model/migration-support.d.ts +0 -306
  396. package/declarations/model-fragments/extensions/fragment-array.d.ts +0 -54
  397. package/declarations/model-fragments/extensions/fragment.d.ts +0 -50
  398. package/declarations/model-fragments/hooks/model-for.d.ts +0 -27
  399. package/declarations/model-fragments/index.d.ts +0 -13
  400. package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -15
  401. package/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -56
  402. package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -38
  403. package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -34
  404. package/declarations/model-fragments/utilities/with-legacy.d.ts +0 -11
  405. package/declarations/model-fragments.d.ts +0 -9
  406. package/declarations/model.d.ts +0 -49
  407. package/declarations/serializer/-private/transforms/boolean.d.ts +0 -60
  408. package/declarations/serializer/-private/transforms/date.d.ts +0 -42
  409. package/declarations/serializer/-private/transforms/number.d.ts +0 -42
  410. package/declarations/serializer/-private/transforms/string.d.ts +0 -42
  411. package/declarations/serializer/-private/transforms/transform.d.ts +0 -118
  412. package/declarations/serializer/-private/utils.d.ts +0 -27
  413. package/declarations/serializer/rest.d.ts +0 -51
  414. package/declarations/serializer/transform.d.ts +0 -5
  415. package/declarations/serializer.d.ts +0 -252
  416. package/declarations/store/-private.d.ts +0 -223
  417. package/declarations/store.d.ts +0 -10
  418. package/dist/-private-BG3bMiKp.js +0 -1211
  419. package/dist/errors-DZKA206g.js +0 -2589
  420. package/dist/hooks-BvOqJBei.js +0 -105
  421. package/dist/json-DU8m1pGf.js +0 -1336
  422. package/dist/model-for-CXkJw59V.js +0 -297
  423. package/dist/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  424. package/dist/schema-provider-DtPOp0d7.js +0 -2382
  425. package/dist/serialize-into-hash-DPZYoF-i.js +0 -261
  426. package/dist/unpkg/dev/-private-DtjBbEgy.js +0 -1206
  427. package/dist/unpkg/dev/errors-DngRU-If.js +0 -2585
  428. package/dist/unpkg/dev/hooks-UuiLxWxS.js +0 -104
  429. package/dist/unpkg/dev/json-K2Y9z6MN.js +0 -1333
  430. package/dist/unpkg/dev/model-for-CXkJw59V.js +0 -297
  431. package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  432. package/dist/unpkg/dev/schema-provider-0D7f-QOn.js +0 -2272
  433. package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +0 -259
  434. package/dist/unpkg/dev/util-DvanW33H.js +0 -20
  435. package/dist/unpkg/dev/utils-BhvS1iTS.js +0 -8
  436. package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +0 -1206
  437. package/dist/unpkg/dev-deprecated/errors-Bzidntpi.js +0 -2588
  438. package/dist/unpkg/dev-deprecated/hooks-DVXhMW14.js +0 -104
  439. package/dist/unpkg/dev-deprecated/json-K2Y9z6MN.js +0 -1333
  440. package/dist/unpkg/dev-deprecated/model-for-CXkJw59V.js +0 -297
  441. package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  442. package/dist/unpkg/dev-deprecated/schema-provider-ZwO5_fZw.js +0 -2292
  443. package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +0 -259
  444. package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +0 -24
  445. package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +0 -12
  446. package/dist/unpkg/prod/-private-BdyZaGEh.js +0 -971
  447. package/dist/unpkg/prod/errors-B-PWeYlW.js +0 -2337
  448. package/dist/unpkg/prod/hooks-Bx-zBziU.js +0 -72
  449. package/dist/unpkg/prod/json-Qewu-UN9.js +0 -1300
  450. package/dist/unpkg/prod/model-for-CXkJw59V.js +0 -297
  451. package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  452. package/dist/unpkg/prod/schema-provider-BgRqk8i9.js +0 -1951
  453. package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +0 -215
  454. package/dist/unpkg/prod/util-DvanW33H.js +0 -20
  455. package/dist/unpkg/prod/utils-BhvS1iTS.js +0 -8
  456. package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +0 -971
  457. package/dist/unpkg/prod-deprecated/errors-Dl2J9d1D.js +0 -2340
  458. package/dist/unpkg/prod-deprecated/hooks-Cm60wWTf.js +0 -72
  459. package/dist/unpkg/prod-deprecated/json-Qewu-UN9.js +0 -1300
  460. package/dist/unpkg/prod-deprecated/model-for-CXkJw59V.js +0 -297
  461. package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  462. package/dist/unpkg/prod-deprecated/schema-provider-Dh6tRqVI.js +0 -1980
  463. package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +0 -215
  464. package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +0 -23
  465. package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +0 -11
  466. package/dist/util-Dul6TZts.js +0 -35
  467. package/dist/utils-Cqw9eRj5.js +0 -23
@@ -1,1279 +0,0 @@
1
- import EmberObject from "@ember/object";
2
- import type { Store } from "@warp-drive/core";
3
- import type { ModelSchema, ResourceKey } from "@warp-drive/core/types";
4
- import type { ChangedAttributesHash } from "@warp-drive/core/types/cache";
5
- import type { LegacyAttributeField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
6
- import type { Snapshot } from "../../compat/-private.js";
7
- import { Errors } from "./errors.js";
8
- import type { MinimalLegacyRecord } from "./model-methods.js";
9
- import RecordState from "./record-state.js";
10
- import type BelongsToReference from "./references/belongs-to.js";
11
- import type HasManyReference from "./references/has-many.js";
12
- import type { _MaybeBelongsToFields, isSubClass, MaybeAttrFields, MaybeHasManyFields, MaybeRelationshipFields } from "./type-utils.js";
13
- export type ModelCreateArgs = {
14
- _createProps: Record<string, unknown>;
15
- _secretInit: {
16
- identifier: ResourceKey;
17
- store: Store;
18
- cb: (record: Model, identifier: ResourceKey, store: Store) => void;
19
- };
20
- };
21
- export type StaticModel = typeof Model & {
22
- create(options: ModelCreateArgs): Model;
23
- };
24
- export type ModelFactory = {
25
- class: StaticModel;
26
- };
27
- export type FactoryCache = Record<string, ModelFactory>;
28
- export type ModelStore = Store & {
29
- _modelFactoryCache: FactoryCache;
30
- };
31
- interface Model {
32
- /**
33
- * The store service instance which created this record instance
34
- */
35
- store: Store;
36
- /**
37
- Create a JSON representation of the record, using the serialization
38
- strategy of the store's adapter.
39
-
40
- `serialize` takes an optional hash as a parameter, currently
41
- supported options are:
42
-
43
- - `includeId`: `true` if the record's ID should be included in the
44
- JSON representation.
45
-
46
- @public
47
- @param {Object} options
48
- @return {Object} an object whose values are primitive JSON values only
49
- */
50
- serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown;
51
- /**
52
- Same as `deleteRecord`, but saves the record immediately.
53
-
54
- Example
55
-
56
- ```js
57
- import Component from '@glimmer/component';
58
-
59
- export default class extends Component {
60
- delete = () => {
61
- this.args.model.destroyRecord().then(function() {
62
- this.transitionToRoute('model.index');
63
- });
64
- }
65
- }
66
- ```
67
-
68
- If you pass an object on the `adapterOptions` property of the options
69
- argument it will be passed to your adapter via the snapshot
70
-
71
- ```js
72
- record.destroyRecord({ adapterOptions: { subscribe: false } });
73
- ```
74
-
75
- ```js [app/adapters/post.js]
76
- import MyCustomAdapter from './custom-adapter';
77
-
78
- export default class PostAdapter extends MyCustomAdapter {
79
- deleteRecord(store, type, snapshot) {
80
- if (snapshot.adapterOptions.subscribe) {
81
- // ...
82
- }
83
- // ...
84
- }
85
- }
86
- ```
87
-
88
- @public
89
- @param options
90
- @return a promise that will be resolved when the adapter returns
91
- successfully or rejected if the adapter returns with an error.
92
- */
93
- destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;
94
- /**
95
- Unloads the record from the store. This will not send a delete request
96
- to your server, it just unloads the record from memory.
97
-
98
- @public
99
- */
100
- unloadRecord<T extends MinimalLegacyRecord>(this: T): void;
101
- /**
102
- Returns an object, whose keys are changed properties, and value is
103
- an [oldProp, newProp] array.
104
-
105
- The array represents the diff of the canonical state with the local state
106
- of the model. Note: if the model is created locally, the canonical state is
107
- empty since the adapter hasn't acknowledged the attributes yet:
108
-
109
- Example
110
-
111
- ```js [app/models/mascot.js]
112
- import { Model, attr } from '@warp-drive/legacy/model';
113
-
114
- export default class MascotModel extends Model {
115
- @attr('string') name;
116
- @attr('boolean', {
117
- defaultValue: false
118
- })
119
- isAdmin;
120
- }
121
- ```
122
-
123
- ```javascript
124
- let mascot = store.createRecord('mascot');
125
-
126
- mascot.changedAttributes(); // {}
127
-
128
- mascot.set('name', 'Tomster');
129
- mascot.changedAttributes(); // { name: [undefined, 'Tomster'] }
130
-
131
- mascot.set('isAdmin', true);
132
- mascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }
133
-
134
- mascot.save().then(function() {
135
- mascot.changedAttributes(); // {}
136
-
137
- mascot.set('isAdmin', false);
138
- mascot.changedAttributes(); // { isAdmin: [true, false] }
139
- });
140
- ```
141
-
142
- @public
143
- @return {Object} an object, whose keys are changed properties,
144
- and value is an [oldProp, newProp] array.
145
- */
146
- changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash;
147
- /**
148
- If the model `hasDirtyAttributes` this function will discard any unsaved
149
- changes. If the model `isNew` it will be removed from the store.
150
-
151
- Example
152
-
153
- ```javascript
154
- record.name; // 'Untitled Document'
155
- record.set('name', 'Doc 1');
156
- record.name; // 'Doc 1'
157
- record.rollbackAttributes();
158
- record.name; // 'Untitled Document'
159
- ```
160
-
161
- @since 1.13.0
162
- @public
163
- */
164
- rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void;
165
- /**
166
- @private
167
- */
168
- _createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T>;
169
- /**
170
- Save the record and persist any changes to the record to an
171
- external source via the adapter.
172
-
173
- Example
174
-
175
- ```javascript
176
- record.set('name', 'Tomster');
177
- record.save().then(function() {
178
- // Success callback
179
- }, function() {
180
- // Error callback
181
- });
182
- ```
183
-
184
- If you pass an object using the `adapterOptions` property of the options
185
- argument it will be passed to your adapter via the snapshot.
186
-
187
- ```js
188
- record.save({ adapterOptions: { subscribe: false } });
189
- ```
190
-
191
- ```js [app/adapters/post.js]
192
- import MyCustomAdapter from './custom-adapter';
193
-
194
- export default class PostAdapter extends MyCustomAdapter {
195
- updateRecord(store, type, snapshot) {
196
- if (snapshot.adapterOptions.subscribe) {
197
- // ...
198
- }
199
- // ...
200
- }
201
- }
202
- ```
203
-
204
- @deprecated use {@link Store.request} instead
205
- @public
206
- @return a promise that will be resolved when the adapter returns
207
- successfully or rejected if the adapter returns with an error.
208
- */
209
- save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;
210
- /**
211
- Reload the record from the adapter.
212
-
213
- This will only work if the record has already finished loading.
214
-
215
- Example
216
-
217
- ```js
218
- import Component from '@glimmer/component';
219
-
220
- export default class extends Component {
221
- async reload = () => {
222
- await this.args.model.reload();
223
- // do something with the reloaded model
224
- }
225
- }
226
- ```
227
-
228
- @public
229
- @param {Object} options optional, may include `adapterOptions` hash which will be passed to adapter request
230
-
231
- @return {Promise} a promise that will be resolved with the record when the
232
- adapter returns successfully or rejected if the adapter returns
233
- with an error.
234
- */
235
- reload<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
236
- /**
237
- Get the reference for the specified belongsTo relationship.
238
-
239
- For instance, given the following model
240
-
241
- ```js [app/models/blog-post.js]
242
- import { Model, belongsTo } from '@warp-drive/legacy/model';
243
-
244
- export default class BlogPost extends Model {
245
- @belongsTo('user', { async: true, inverse: null }) author;
246
- }
247
- ```
248
-
249
- Then the reference for the author relationship would be
250
- retrieved from a record instance like so:
251
-
252
- ```js
253
- blogPost.belongsTo('author');
254
- ```
255
-
256
- A `BelongsToReference` is a low-level API that allows access
257
- and manipulation of a belongsTo relationship.
258
-
259
- It is especially useful when you're dealing with `async` relationships
260
- as it allows synchronous access to the relationship data if loaded, as
261
- well as APIs for loading, reloading the data or accessing available
262
- information without triggering a load.
263
-
264
- It may also be useful when using `sync` relationships that need to be
265
- loaded/reloaded with more precise timing than marking the
266
- relationship as `async` and relying on autofetch would have allowed.
267
-
268
- However,keep in mind that marking a relationship as `async: false` will introduce
269
- bugs into your application if the data is not always guaranteed to be available
270
- by the time the relationship is accessed. Ergo, it is recommended when using this
271
- approach to utilize `links` for unloaded relationship state instead of identifiers.
272
-
273
- Reference APIs are entangled with the relationship's underlying state,
274
- thus any getters or cached properties that utilize these will properly
275
- invalidate if the relationship state changes.
276
-
277
- References are "stable", meaning that multiple calls to retrieve the reference
278
- for a given relationship will always return the same HasManyReference.
279
-
280
- @public
281
- @param prop - the name of the relationship
282
- @since 2.5.0
283
- @return reference for this relationship
284
- */
285
- belongsTo<
286
- T extends Model,
287
- K extends keyof T & string
288
- >(this: T, prop: K & (K extends _MaybeBelongsToFields<T> ? K : never)): BelongsToReference<T, K>;
289
- /**
290
- Get the reference for the specified hasMany relationship.
291
-
292
- For instance, given the following model
293
-
294
- ```js [app/models/blog-post.js]
295
- import { Model, hasMany } from '@warp-drive/legacy/model';
296
-
297
- export default class BlogPost extends Model {
298
- @hasMany('comment', { async: true, inverse: null }) comments;
299
- }
300
- ```
301
-
302
- Then the reference for the comments relationship would be
303
- retrieved from a record instance like so:
304
-
305
- ```js
306
- blogPost.hasMany('comments');
307
- ```
308
-
309
- A `HasManyReference` is a low-level API that allows access
310
- and manipulation of a hasMany relationship.
311
-
312
- It is especially useful when you are dealing with `async` relationships
313
- as it allows synchronous access to the relationship data if loaded, as
314
- well as APIs for loading, reloading the data or accessing available
315
- information without triggering a load.
316
-
317
- It may also be useful when using `sync` relationships with `@ember-data/model`
318
- that need to be loaded/reloaded with more precise timing than marking the
319
- relationship as `async` and relying on autofetch would have allowed.
320
-
321
- However,keep in mind that marking a relationship as `async: false` will introduce
322
- bugs into your application if the data is not always guaranteed to be available
323
- by the time the relationship is accessed. Ergo, it is recommended when using this
324
- approach to utilize `links` for unloaded relationship state instead of identifiers.
325
-
326
- Reference APIs are entangled with the relationship's underlying state,
327
- thus any getters or cached properties that utilize these will properly
328
- invalidate if the relationship state changes.
329
-
330
- References are "stable", meaning that multiple calls to retrieve the reference
331
- for a given relationship will always return the same HasManyReference.
332
-
333
- @public
334
- @param prop - the name of the relationship
335
- @since 2.5.0
336
- @return reference for this relationship
337
- */
338
- hasMany<
339
- T extends MinimalLegacyRecord,
340
- K extends MaybeHasManyFields<T>
341
- >(this: T, prop: K): HasManyReference<T, K>;
342
- /**
343
- Marks the record as deleted but does not save it. You must call
344
- `save` afterwards if you want to persist it. You might use this
345
- method if you want to allow the user to still `rollbackAttributes()`
346
- after a delete was made.
347
-
348
- Example
349
-
350
- ```js
351
- import Component from '@glimmer/component';
352
-
353
- export default class extends Component {
354
- softDelete = () => {
355
- this.args.model.deleteRecord();
356
- }
357
-
358
- confirm = () => {
359
- this.args.model.save();
360
- }
361
-
362
- undo = () => {
363
- this.args.model.rollbackAttributes();
364
- }
365
- }
366
- ```
367
-
368
- @public
369
- */
370
- deleteRecord<T extends MinimalLegacyRecord>(this: T): void;
371
- }
372
- /**
373
- * Base class from which Models can be defined.
374
- *
375
- * ::: code-group
376
- *
377
- * ```js [app/models/user.js]
378
- * import { Model, attr, belongsTo, hasMany } from '@warp-drive/legacy/model';
379
- *
380
- * export default class User extends Model {
381
- * @attr name;
382
- * @attr('number') age;
383
- * @hasMany('post', { async: true, inverse: null }) posts;
384
- * @belongsTo('group', { async: false, inverse: 'users' }) group;
385
- * }
386
- * ```
387
- *
388
- * ```ts [app/models/user.ts]
389
- * import { Model, attr, belongsTo, hasMany, type AsyncHasMany } from '@warp-drive/legacy/model';
390
- * import type { NumberTransform } from '@ember-data/serializer/transform';
391
- * import type Group from './group';
392
- * import type Post from './post';
393
- *
394
- * export default class User extends Model {
395
- * @attr declare name: string;
396
- *
397
- * @attr<NumberTransform>('number')
398
- * declare age: number;
399
- *
400
- * @hasMany('post', { async: true, inverse: null })
401
- * declare posts: AsyncHasMany<Post>;
402
- *
403
- * @belongsTo('group', { async: false, inverse: 'users' })
404
- * declare group: Group | null;
405
- * }
406
- * ```
407
- *
408
- * :::
409
- *
410
- * Models both define the schema for a resource type and provide
411
- * the class to use as the reactive object for data of resource
412
- * of that type.
413
- *
414
- * @public
415
- * @noInheritDoc
416
- * @hideconstructor
417
- * @legacy
418
- */
419
- declare class Model extends EmberObject implements MinimalLegacyRecord {
420
- /** @private */
421
- destroy(): this;
422
- /**
423
- If this property is `true` the record is in the `empty`
424
- state. Empty is the first state all records enter after they have
425
- been created. Most records created by the store will quickly
426
- transition to the `loading` state if data needs to be fetched from
427
- the server or the `created` state if the record is created on the
428
- client. A record can also enter the empty state if the adapter is
429
- unable to locate the record.
430
-
431
- @public
432
- */
433
- get isEmpty(): boolean;
434
- /**
435
- If this property is `true` the record is in the `loading` state. A
436
- record enters this state when the store asks the adapter for its
437
- data. It remains in this state until the adapter provides the
438
- requested data.
439
-
440
- @public
441
- */
442
- get isLoading(): boolean;
443
- /**
444
- If this property is `true` the record is in the `loaded` state. A
445
- record enters this state when its data is populated. Most of a
446
- record's lifecycle is spent inside substates of the `loaded`
447
- state.
448
-
449
- Example
450
-
451
- ```javascript
452
- let record = store.createRecord('model');
453
- record.isLoaded; // true
454
-
455
- const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
456
- model.isLoaded;
457
- ```
458
-
459
- @public
460
- */
461
- get isLoaded(): boolean;
462
- /**
463
- If this property is `true` the record is in the `dirty` state. The
464
- record has local changes that have not yet been saved by the
465
- adapter. This includes records that have been created (but not yet
466
- saved) or deleted.
467
-
468
- Example
469
-
470
- ```javascript
471
- let record = store.createRecord('model');
472
- record.hasDirtyAttributes; // true
473
-
474
- const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
475
-
476
- model.hasDirtyAttributes; // false
477
- model.foo = 'some value';
478
- model.hasDirtyAttributes; // true
479
- ```
480
-
481
- @since 1.13.0
482
- @public
483
- */
484
- get hasDirtyAttributes(): boolean;
485
- /**
486
- If this property is `true` the record is in the `saving` state. A
487
- record enters the saving state when `save` is called, but the
488
- adapter has not yet acknowledged that the changes have been
489
- persisted to the backend.
490
-
491
- Example
492
-
493
- ```javascript
494
- let record = store.createRecord('model');
495
- record.isSaving; // false
496
- let promise = record.save();
497
- record.isSaving; // true
498
- promise.then(function() {
499
- record.isSaving; // false
500
- });
501
- ```
502
-
503
- @public
504
- */
505
- get isSaving(): boolean;
506
- /**
507
- If this property is `true` the record is in the `deleted` state
508
- and has been marked for deletion. When `isDeleted` is true and
509
- `hasDirtyAttributes` is true, the record is deleted locally but the deletion
510
- was not yet persisted. When `isSaving` is true, the change is
511
- in-flight. When both `hasDirtyAttributes` and `isSaving` are false, the
512
- change has persisted.
513
-
514
- Example
515
-
516
- ```javascript
517
- let record = store.createRecord('model');
518
- record.isDeleted; // false
519
- record.deleteRecord();
520
-
521
- // Locally deleted
522
- record.isDeleted; // true
523
- record.hasDirtyAttributes; // true
524
- record.isSaving; // false
525
-
526
- // Persisting the deletion
527
- let promise = record.save();
528
- record.isDeleted; // true
529
- record.isSaving; // true
530
-
531
- // Deletion Persisted
532
- promise.then(function() {
533
- record.isDeleted; // true
534
- record.isSaving; // false
535
- record.hasDirtyAttributes; // false
536
- });
537
- ```
538
-
539
- @public
540
- */
541
- get isDeleted(): boolean;
542
- /**
543
- If this property is `true` the record is in the `new` state. A
544
- record will be in the `new` state when it has been created on the
545
- client and the adapter has not yet report that it was successfully
546
- saved.
547
-
548
- Example
549
-
550
- ```javascript
551
- let record = store.createRecord('model');
552
- record.isNew; // true
553
-
554
- record.save().then(function(model) {
555
- model.isNew; // false
556
- });
557
- ```
558
-
559
- @public
560
- */
561
- get isNew(): boolean;
562
- /**
563
- If this property is `true` the record is in the `valid` state.
564
-
565
- A record will be in the `valid` state when the adapter did not report any
566
- server-side validation failures.
567
-
568
- @public
569
- */
570
- get isValid(): boolean;
571
- /**
572
- If the record is in the dirty state this property will report what
573
- kind of change has caused it to move into the dirty
574
- state. Possible values are:
575
-
576
- - `created` The record has been created by the client and not yet saved to the adapter.
577
- - `updated` The record has been updated by the client and not yet saved to the adapter.
578
- - `deleted` The record has been deleted by the client and not yet saved to the adapter.
579
-
580
- Example
581
-
582
- ```javascript
583
- let record = store.createRecord('model');
584
- record.dirtyType; // 'created'
585
- ```
586
-
587
- @public
588
- */
589
- get dirtyType(): "created" | "updated" | "deleted" | "";
590
- /**
591
- If `true` the adapter reported that it was unable to save local
592
- changes to the backend for any reason other than a server-side
593
- validation error.
594
-
595
- Example
596
-
597
- ```javascript
598
- record.isError; // false
599
- record.set('foo', 'valid value');
600
- record.save().then(null, function() {
601
- record.isError; // true
602
- });
603
- ```
604
-
605
- @public
606
- */
607
- get isError(): boolean;
608
- /**
609
- * `isError` is read-only and cannot be set directly.
610
- */
611
- set isError(v: boolean);
612
- /**
613
- If `true` the store is attempting to reload the record from the adapter.
614
-
615
- Example
616
-
617
- ```javascript
618
- record.isReloading; // false
619
- record.reload();
620
- record.isReloading; // true
621
- ```
622
-
623
- @public
624
- */
625
- isReloading: boolean;
626
- /**
627
- All ember models have an id property. This is an identifier
628
- managed by an external source. These are always coerced to be
629
- strings before being used internally. Note when declaring the
630
- attributes for a model it is an error to declare an id
631
- attribute.
632
-
633
- ```javascript
634
- let record = store.createRecord('model');
635
- record.id; // null
636
-
637
- const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
638
- model.id; // '1'
639
- ```
640
-
641
- @public
642
- */
643
- get id(): string | null;
644
- /**
645
- * Assigns the resource's primary key. Typically only used internally
646
- * when a client-created record is assigned an id upon being saved.
647
- */
648
- set id(id: string | null);
649
- toString(): string;
650
- /**
651
- @private
652
- */
653
- get currentState(): RecordState;
654
- /**
655
- * `currentState` is read-only and cannot be set directly.
656
- */
657
- set currentState(_v: RecordState);
658
- /**
659
- The store service instance which created this record instance
660
-
661
- @public
662
- */
663
- store: Store;
664
- /**
665
- When the record is in the `invalid` state this object will contain
666
- any errors returned by the adapter. When present the errors hash
667
- contains keys corresponding to the invalid property names
668
- and values which are arrays of Javascript objects with two keys:
669
-
670
- - `message` A string containing the error message from the backend
671
- - `attribute` The name of the property associated with this error message
672
-
673
- ```javascript
674
- record.errors.length; // 0
675
- record.set('foo', 'invalid value');
676
- record.save().catch(function() {
677
- record.errors.foo;
678
- // [{message: 'foo should be a number.', attribute: 'foo'}]
679
- });
680
- ```
681
-
682
- The `errors` property is useful for displaying error messages to
683
- the user.
684
-
685
- ```handlebars
686
- <label>Username: <Input @value={{@model.username}} /> </label>
687
- {{#each @model.errors.username as |error|}}
688
- <div class="error">
689
- {{error.message}}
690
- </div>
691
- {{/each}}
692
- <label>Email: <Input @value={{@model.email}} /> </label>
693
- {{#each @model.errors.email as |error|}}
694
- <div class="error">
695
- {{error.message}}
696
- </div>
697
- {{/each}}
698
- ```
699
-
700
-
701
- You can also access the special `messages` property on the error
702
- object to get an array of all the error strings.
703
-
704
- ```handlebars
705
- {{#each @model.errors.messages as |message|}}
706
- <div class="error">
707
- {{message}}
708
- </div>
709
- {{/each}}
710
- ```
711
-
712
- @public
713
- */
714
- get errors(): Errors;
715
- /**
716
- This property holds the `AdapterError` object with which
717
- last adapter operation was rejected.
718
-
719
- @public
720
- */
721
- get adapterError(): unknown;
722
- /**
723
- * `adapterError` is read-only and cannot be set directly.
724
- */
725
- set adapterError(v: unknown);
726
- notifyPropertyChange(prop: string): this;
727
- /**
728
- Given a callback, iterates over each of the relationships in the model,
729
- invoking the callback with the name of each relationship and its relationship
730
- descriptor.
731
-
732
-
733
- The callback method you provide should have the following signature (all
734
- parameters are optional):
735
-
736
- ```javascript
737
- function(name, descriptor);
738
- ```
739
-
740
- - `name` the name of the current property in the iteration
741
- - `descriptor` the meta object that describes this relationship
742
-
743
- The relationship descriptor argument is an object with the following properties.
744
-
745
- - **name** <span class="type">String</span> the name of this relationship on the Model
746
- - **kind** <span class="type">String</span> "hasMany" or "belongsTo"
747
- - **options** <span class="type">Object</span> the original options hash passed when the relationship was declared
748
- - **parentType** <span class="type">Model</span> the type of the Model that owns this relationship
749
- - **type** <span class="type">String</span> the type name of the related Model
750
-
751
- Note that in addition to a callback, you can also pass an optional target
752
- object that will be set as `this` on the context.
753
-
754
- Example
755
-
756
- ```js [app/serializers/application.js]
757
- import JSONSerializer from '@ember-data/serializer/json';
758
-
759
- export default class ApplicationSerializer extends JSONSerializer {
760
- serialize(record, options) {
761
- let json = {};
762
-
763
- record.eachRelationship(function(name, descriptor) {
764
- if (descriptor.kind === 'hasMany') {
765
- let serializedHasManyName = name.toUpperCase() + '_IDS';
766
- json[serializedHasManyName] = record.get(name).map(r => r.id);
767
- }
768
- });
769
-
770
- return json;
771
- }
772
- }
773
- ```
774
-
775
- @public
776
- @param callback the callback to invoke
777
- @param binding the value to which the callback's `this` should be bound
778
- */
779
- eachRelationship<T>(callback: (this: NoInfer<T> | undefined, key: MaybeRelationshipFields<this>, meta: LegacyRelationshipField) => void, binding?: T): void;
780
- /**
781
- * Returns the relationship schema for the given relationship name, if any.
782
- */
783
- relationshipFor(name: string): LegacyRelationshipField | undefined;
784
- /**
785
- * Returns the inverse relationship schema for the given relationship
786
- * name, if one exists. See {@link Model.inverseFor | the static inverseFor}.
787
- */
788
- inverseFor(name: string): LegacyRelationshipField | null;
789
- /**
790
- * Iterates over the attributes defined on this record's class, calling
791
- * `callback` for each one. See {@link Model.eachAttribute | the static eachAttribute}.
792
- *
793
- * @param callback the callback to invoke
794
- * @param binding the value to which the callback's `this` should be bound
795
- */
796
- eachAttribute<T>(callback: (this: NoInfer<T> | undefined, key: isSubClass<this> extends true ? MaybeAttrFields<this> : string, meta: LegacyAttributeField) => void, binding?: T): void;
797
- /**
798
- Represents the model's class name as a string. This can be used to look up the model's class name through
799
- `Store`'s modelFor method.
800
-
801
- `modelName` is generated for you by WarpDrive. It will be a lowercased, dasherized string.
802
- For example:
803
-
804
- ```javascript
805
- store.modelFor('post').modelName; // 'post'
806
- store.modelFor('blog-post').modelName; // 'blog-post'
807
- ```
808
-
809
- The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
810
- keys to underscore (instead of dasherized), you might use the following code:
811
-
812
- ```javascript
813
- import RESTSerializer from '@ember-data/serializer/rest';
814
- import { underscore } from '<app-name>/utils/string-utils';
815
-
816
- export default const PostSerializer = RESTSerializer.extend({
817
- payloadKeyFromModelName(modelName) {
818
- return underscore(modelName);
819
- }
820
- });
821
- ```
822
-
823
- @public
824
- */
825
- static modelName: string;
826
- /**
827
- For a given relationship name, returns the model type of the relationship.
828
-
829
- For example, if you define a model like this:
830
-
831
- ```js [app/models/post.js]
832
- import { Model, hasMany } from '@warp-drive/legacy/model';
833
-
834
- export default class PostModel extends Model {
835
- @hasMany('comment') comments;
836
- }
837
- ```
838
-
839
- Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.
840
-
841
- @public
842
- @param name the name of the relationship
843
- @param store an instance of Store
844
- @return the type of the relationship, or undefined
845
- */
846
- static typeForRelationship(name: string, store: Store): ModelSchema | undefined;
847
- /**
848
- * A cache of resolved inverse relationships by name, populated lazily by
849
- * {@link Model.inverseFor | inverseFor}.
850
- */
851
- static get inverseMap(): Record<string, LegacyRelationshipField | null>;
852
- /**
853
- Find the relationship which is the inverse of the one asked for.
854
-
855
- For example, if you define models like this:
856
-
857
- ```js [app/models/post.js]
858
- import { Model, hasMany } from '@warp-drive/legacy/model';
859
-
860
- export default class PostModel extends Model {
861
- @hasMany('message') comments;
862
- }
863
- ```
864
-
865
- ```js [app/models/message.js]
866
- import { Model, belongsTo } from '@warp-drive/legacy/model';
867
-
868
- export default class MessageModel extends Model {
869
- @belongsTo('post') owner;
870
- }
871
- ```
872
-
873
- ``` js
874
- store.modelFor('post').inverseFor('comments', store) // { type: 'message', name: 'owner', kind: 'belongsTo' }
875
- store.modelFor('message').inverseFor('owner', store) // { type: 'post', name: 'comments', kind: 'hasMany' }
876
- ```
877
-
878
- @public
879
- @param name the name of the relationship
880
- @param store
881
- @return the inverse relationship, or null
882
- */
883
- static inverseFor(name: string, store: Store): LegacyRelationshipField | null;
884
- /**
885
- * @private
886
- */
887
- static _findInverseFor(name: string, store: Store): LegacyRelationshipField | null;
888
- /**
889
- The model's relationships as a map, keyed on the type of the
890
- relationship. The value of each entry is an array containing a descriptor
891
- for each relationship with that type, describing the name of the relationship
892
- as well as the type.
893
-
894
- For example, given the following model definition:
895
-
896
- ```js [app/models/blog.js]
897
- import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';
898
-
899
- export default class BlogModel extends Model {
900
- @hasMany('user') users;
901
- @belongsTo('user') owner;
902
- @hasMany('post') posts;
903
- }
904
- ```
905
-
906
- This computed property would return a map describing these
907
- relationships, like this:
908
-
909
- ```javascript
910
- import Blog from 'app/models/blog';
911
- import User from 'app/models/user';
912
- import Post from 'app/models/post';
913
-
914
- let relationships = Blog.relationships;
915
- relationships.user;
916
- //=> [ { name: 'users', kind: 'hasMany' },
917
- // { name: 'owner', kind: 'belongsTo' } ]
918
- relationships.post;
919
- //=> [ { name: 'posts', kind: 'hasMany' } ]
920
- ```
921
-
922
- @public
923
- */
924
- static get relationships(): Map<string, LegacyRelationshipField[]>;
925
- /**
926
- A hash containing lists of the model's relationships, grouped
927
- by the relationship kind. For example, given a model with this
928
- definition:
929
-
930
- ```js [app/models/blog.js]
931
- import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';
932
-
933
- export default class BlogModel extends Model {
934
- @hasMany('user') users;
935
- @belongsTo('user') owner;
936
-
937
- @hasMany('post') posts;
938
- }
939
- ```
940
-
941
- This property would contain the following:
942
-
943
- ```javascript
944
- import Blog from 'app/models/blog';
945
-
946
- let relationshipNames = Blog.relationshipNames;
947
- relationshipNames.hasMany;
948
- //=> ['users', 'posts']
949
- relationshipNames.belongsTo;
950
- //=> ['owner']
951
- ```
952
-
953
- @public
954
- */
955
- static get relationshipNames(): {
956
- /**
957
- * the names of the model's `hasMany` relationships
958
- */
959
- hasMany: string[];
960
- /**
961
- * the names of the model's `belongsTo` relationships
962
- */
963
- belongsTo: string[];
964
- };
965
- /**
966
- An array of types directly related to a model. Each type will be
967
- included once, regardless of the number of relationships it has with
968
- the model.
969
-
970
- For example, given a model with this definition:
971
-
972
- ```js [app/models/blog.js]
973
- import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';
974
-
975
- export default class BlogModel extends Model {
976
- @hasMany('user') users;
977
- @belongsTo('user') owner;
978
-
979
- @hasMany('post') posts;
980
- }
981
- ```
982
-
983
- This property would contain the following:
984
-
985
- ```javascript
986
- import Blog from 'app/models/blog';
987
-
988
- let relatedTypes = Blog.relatedTypes');
989
- //=> ['user', 'post']
990
- ```
991
-
992
- @public
993
- */
994
- static get relatedTypes(): string[];
995
- /**
996
- A map whose keys are the relationships of a model and whose values are
997
- relationship descriptors.
998
-
999
- For example, given a model with this
1000
- definition:
1001
-
1002
- ```js [app/models/blog.js]
1003
- import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';
1004
-
1005
- export default class BlogModel extends Model {
1006
- @hasMany('user') users;
1007
- @belongsTo('user') owner;
1008
-
1009
- @hasMany('post') posts;
1010
- }
1011
- ```
1012
-
1013
- This property would contain the following:
1014
-
1015
- ```javascript
1016
- import Blog from 'app/models/blog';
1017
-
1018
- let relationshipsByName = Blog.relationshipsByName;
1019
- relationshipsByName.users;
1020
- //=> { name: 'users', kind: 'hasMany', type: 'user', options: Object }
1021
- relationshipsByName.owner;
1022
- //=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }
1023
- ```
1024
-
1025
- @public
1026
- */
1027
- static get relationshipsByName(): Map<string, LegacyRelationshipField>;
1028
- /**
1029
- * A hash of the model's relationship schemas keyed by relationship name.
1030
- * See also {@link Model.relationshipsByName | relationshipsByName}, which
1031
- * provides the same information as a `Map`.
1032
- */
1033
- static get relationshipsObject(): Record<string, LegacyRelationshipField>;
1034
- /**
1035
- A map whose keys are the fields of the model and whose values are strings
1036
- describing the kind of the field. A model's fields are the union of all of its
1037
- attributes and relationships.
1038
-
1039
- For example:
1040
-
1041
- ```js [app/models/blog.js]
1042
- import { Model, attr, belongsTo, hasMany } from '@warp-drive/legacy/model';
1043
-
1044
- export default class BlogModel extends Model {
1045
- @hasMany('user') users;
1046
- @belongsTo('user') owner;
1047
-
1048
- @hasMany('post') posts;
1049
-
1050
- @attr('string') title;
1051
- }
1052
- ```
1053
-
1054
- ```js
1055
- import Blog from 'app/models/blog'
1056
-
1057
- let fields = Blog.fields;
1058
- fields.forEach(function(kind, field) {
1059
- // do thing
1060
- });
1061
-
1062
- // prints:
1063
- // users, hasMany
1064
- // owner, belongsTo
1065
- // posts, hasMany
1066
- // title, attribute
1067
- ```
1068
-
1069
- @public
1070
- */
1071
- static get fields(): Map<string, "attribute" | "belongsTo" | "hasMany">;
1072
- /**
1073
- Given a callback, iterates over each of the relationships in the model,
1074
- invoking the callback with the name of each relationship and its relationship
1075
- descriptor.
1076
-
1077
- @public
1078
- @param callback the callback to invoke
1079
- @param binding the value to which the callback's `this` should be bound
1080
- */
1081
- static eachRelationship<
1082
- T,
1083
- Schema extends Model
1084
- >(callback: (this: T | undefined, key: MaybeRelationshipFields<Schema>, relationship: LegacyRelationshipField) => void, binding?: T): void;
1085
- /**
1086
- Given a callback, iterates over each of the types related to a model,
1087
- invoking the callback with the related type's class. Each type will be
1088
- returned just once, regardless of how many different relationships it has
1089
- with a model.
1090
-
1091
- @public
1092
- @param callback the callback to invoke
1093
- @param binding the value to which the callback's `this` should be bound
1094
- */
1095
- static eachRelatedType<T>(callback: (this: T | undefined, type: string) => void, binding?: T): void;
1096
- /**
1097
- *
1098
- * @private
1099
- * @deprecated
1100
- */
1101
- static determineRelationshipType(knownSide: LegacyRelationshipField, store: Store): "oneToOne" | "oneToMany" | "manyToOne" | "manyToMany" | "oneToNone" | "manyToNone";
1102
- /**
1103
- A map whose keys are the attributes of the model (properties
1104
- described by attr) and whose values are the meta object for the
1105
- property.
1106
-
1107
- Example
1108
-
1109
- ```js [app/models/person.js]
1110
- import { Model, attr } from '@warp-drive/legacy/model';
1111
-
1112
- export default class PersonModel extends Model {
1113
- @attr('string') firstName;
1114
- @attr('string') lastName;
1115
- @attr('date') birthday;
1116
- }
1117
- ```
1118
-
1119
- ```javascript
1120
- import Person from 'app/models/person'
1121
-
1122
- let attributes = Person.attributes
1123
-
1124
- attributes.forEach(function(meta, name) {
1125
- // do thing
1126
- });
1127
-
1128
- // prints:
1129
- // firstName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "firstName"}
1130
- // lastName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "lastName"}
1131
- // birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
1132
- ```
1133
-
1134
- @public
1135
- */
1136
- static get attributes(): Map<string, LegacyAttributeField>;
1137
- /**
1138
- A map whose keys are the attributes of the model (properties
1139
- described by attr) and whose values are type of transformation
1140
- applied to each attribute. This map does not include any
1141
- attributes that do not have an transformation type.
1142
-
1143
- Example
1144
-
1145
- ```js [app/models/person.js]
1146
- import { Model, attr } from '@warp-drive/legacy/model';
1147
-
1148
- export default class PersonModel extends Model {
1149
- @attr firstName;
1150
- @attr('string') lastName;
1151
- @attr('date') birthday;
1152
- }
1153
- ```
1154
-
1155
- ```javascript
1156
- import Person from 'app/models/person';
1157
-
1158
- let transformedAttributes = Person.transformedAttributes
1159
-
1160
- transformedAttributes.forEach(function(field, type) {
1161
- // do thing
1162
- });
1163
-
1164
- // prints:
1165
- // lastName string
1166
- // birthday date
1167
- ```
1168
-
1169
- @public
1170
- */
1171
- static get transformedAttributes(): Map<string, string>;
1172
- /**
1173
- Iterates through the attributes of the model, calling the passed function on each
1174
- attribute.
1175
-
1176
- The callback method you provide should have the following signature (all
1177
- parameters are optional):
1178
-
1179
- ```javascript
1180
- function(name, meta);
1181
- ```
1182
-
1183
- - `name` the name of the current property in the iteration
1184
- - `meta` the meta object for the attribute property in the iteration
1185
-
1186
- Note that in addition to a callback, you can also pass an optional target
1187
- object that will be set as `this` on the context.
1188
-
1189
- Example
1190
-
1191
- ```javascript
1192
- import { Model, attr } from '@warp-drive/legacy/model';
1193
-
1194
- class PersonModel extends Model {
1195
- @attr('string') firstName;
1196
- @attr('string') lastName;
1197
- @attr('date') birthday;
1198
- }
1199
-
1200
- PersonModel.eachAttribute(function(name, meta) {
1201
- // do thing
1202
- });
1203
-
1204
- // prints:
1205
- // firstName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "firstName"}
1206
- // lastName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "lastName"}
1207
- // birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
1208
- ```
1209
-
1210
- @public
1211
- @param callback The callback to execute
1212
- @param binding [optional] the value to which the callback's `this` should be bound
1213
- */
1214
- static eachAttribute<
1215
- T,
1216
- Schema extends Model
1217
- >(callback: (this: T | undefined, key: MaybeAttrFields<Schema>, attribute: LegacyAttributeField) => void, binding?: T): void;
1218
- /**
1219
- Iterates through the transformedAttributes of the model, calling
1220
- the passed function on each attribute. Note the callback will not be
1221
- called for any attributes that do not have an transformation type.
1222
-
1223
- The callback method you provide should have the following signature (all
1224
- parameters are optional):
1225
-
1226
- ```javascript
1227
- function(name, type);
1228
- ```
1229
-
1230
- - `name` the name of the current property in the iteration
1231
- - `type` a string containing the name of the type of transformed
1232
- applied to the attribute
1233
-
1234
- Note that in addition to a callback, you can also pass an optional target
1235
- object that will be set as `this` on the context.
1236
-
1237
- Example
1238
-
1239
- ```javascript
1240
- import { Model, attr } from '@warp-drive/legacy/model';
1241
-
1242
- let Person = Model.extend({
1243
- firstName: attr(),
1244
- lastName: attr('string'),
1245
- birthday: attr('date')
1246
- });
1247
-
1248
- Person.eachTransformedAttribute(function(name, type) {
1249
- // do thing
1250
- });
1251
-
1252
- // prints:
1253
- // lastName string
1254
- // birthday date
1255
- ```
1256
-
1257
- @public
1258
- @param callback The callback to execute
1259
- @param binding [optional] the value to which the callback's `this` should be bound
1260
- */
1261
- static eachTransformedAttribute<
1262
- T,
1263
- Schema extends Model
1264
- >(callback: (this: T | undefined, key: Exclude<keyof Schema & string, keyof Model & string>, type: string) => void, binding?: T): void;
1265
- /**
1266
- Returns the name of the model class.
1267
-
1268
- @public
1269
- */
1270
- static toString(): string;
1271
- }
1272
- /**
1273
- * Restores the pre-`RequestManager` implementations of `save`,
1274
- * `destroyRecord`, and `reload` onto the given `Model` subclass, for
1275
- * apps that have not yet migrated off of the deprecated
1276
- * `ENABLE_LEGACY_REQUEST_METHODS` behaviors.
1277
- */
1278
- export declare function restoreDeprecatedModelRequestBehaviors(ModelKlass: typeof Model): void;
1279
- export { Model };