@warp-drive/legacy 5.9.0-beta.0 → 5.9.0-beta.2

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 (468) hide show
  1. package/README.md +6 -0
  2. package/dist/-private-DQ6Iap2t.js +193 -0
  3. package/dist/-private-DQ6Iap2t.js.map +1 -0
  4. package/dist/-private-DccRZQsm.js +904 -0
  5. package/dist/-private-DccRZQsm.js.map +1 -0
  6. package/dist/adapter/-private.d.ts +33 -0
  7. package/dist/adapter/-private.d.ts.map +1 -0
  8. package/dist/adapter/-private.js +3 -1
  9. package/dist/adapter/error.d.ts +2 -0
  10. package/dist/adapter/error.js +425 -311
  11. package/dist/adapter/error.js.map +1 -0
  12. package/{declarations → dist}/adapter/json-api.d.ts +31 -19
  13. package/dist/adapter/json-api.d.ts.map +1 -0
  14. package/dist/adapter/json-api.js +265 -131
  15. package/dist/adapter/json-api.js.map +1 -0
  16. package/dist/adapter/rest.d.ts +2 -0
  17. package/dist/adapter/rest.js +937 -1100
  18. package/dist/adapter/rest.js.map +1 -0
  19. package/dist/adapter-CARrK3-8.d.ts +784 -0
  20. package/dist/adapter-CARrK3-8.d.ts.map +1 -0
  21. package/dist/adapter-eYo2pIuM.js +1130 -0
  22. package/dist/adapter-eYo2pIuM.js.map +1 -0
  23. package/dist/adapter.d.ts +2 -0
  24. package/dist/adapter.js +1 -1251
  25. package/dist/compat/-private.d.ts +2 -0
  26. package/dist/compat/-private.js +3 -1
  27. package/dist/compat/builders.d.ts +169 -0
  28. package/dist/compat/builders.d.ts.map +1 -0
  29. package/dist/compat/builders.js +205 -246
  30. package/dist/compat/builders.js.map +1 -0
  31. package/dist/compat/extensions.d.ts +2 -0
  32. package/dist/compat/extensions.js +271 -233
  33. package/dist/compat/extensions.js.map +1 -0
  34. package/dist/compat/utils.d.ts +151 -0
  35. package/dist/compat/utils.d.ts.map +1 -0
  36. package/dist/compat/utils.js +189 -194
  37. package/dist/compat/utils.js.map +1 -0
  38. package/dist/compat-BbNNmTM-.d.ts +1386 -0
  39. package/dist/compat-BbNNmTM-.d.ts.map +1 -0
  40. package/dist/compat-DcHVxuuZ.js +734 -0
  41. package/dist/compat-DcHVxuuZ.js.map +1 -0
  42. package/dist/compat.d.ts +2 -0
  43. package/dist/compat.js +1 -1019
  44. package/dist/error-CzkyXr1Q.d.ts +435 -0
  45. package/dist/error-CzkyXr1Q.d.ts.map +1 -0
  46. package/dist/errors-BEEsrHbl.js +2134 -0
  47. package/dist/errors-BEEsrHbl.js.map +1 -0
  48. package/dist/extensions-DumNm4dA.d.ts +102 -0
  49. package/dist/extensions-DumNm4dA.d.ts.map +1 -0
  50. package/dist/index.d.ts +243 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +271 -188
  53. package/dist/index.js.map +1 -0
  54. package/dist/json-BXNPTlcH.js +1106 -0
  55. package/dist/json-BXNPTlcH.js.map +1 -0
  56. package/dist/model/-private.d.ts +3 -0
  57. package/dist/model/-private.js +3 -1
  58. package/dist/model/migration-support.d.ts +335 -0
  59. package/dist/model/migration-support.d.ts.map +1 -0
  60. package/dist/model/migration-support.js +506 -564
  61. package/dist/model/migration-support.js.map +1 -0
  62. package/dist/model-62hn5_PD.d.ts +3107 -0
  63. package/dist/model-62hn5_PD.d.ts.map +1 -0
  64. package/dist/model-DcXZdNMu.js +683 -0
  65. package/dist/model-DcXZdNMu.js.map +1 -0
  66. package/dist/model-fragments-DSqu0ptR.js +334 -0
  67. package/dist/model-fragments-DSqu0ptR.js.map +1 -0
  68. package/dist/model-fragments.d.ts +294 -0
  69. package/dist/model-fragments.d.ts.map +1 -0
  70. package/dist/model-fragments.js +2 -75
  71. package/dist/model.d.ts +404 -0
  72. package/dist/model.d.ts.map +1 -0
  73. package/dist/model.js +3 -666
  74. package/{declarations/adapter/rest.d.ts → dist/rest-0NhtexIq.d.ts} +187 -103
  75. package/dist/rest-0NhtexIq.d.ts.map +1 -0
  76. package/dist/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
  77. package/dist/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
  78. package/dist/schema-provider-H4zNXtry.js +1929 -0
  79. package/dist/schema-provider-H4zNXtry.js.map +1 -0
  80. package/{declarations → dist}/serializer/json-api.d.ts +4 -1
  81. package/dist/serializer/json-api.d.ts.map +1 -0
  82. package/dist/serializer/json-api.js +527 -514
  83. package/dist/serializer/json-api.js.map +1 -0
  84. package/{declarations → dist}/serializer/json.d.ts +3 -0
  85. package/dist/serializer/json.d.ts.map +1 -0
  86. package/dist/serializer/json.js +3 -6
  87. package/{declarations/serializer/-private/embedded-records-mixin.d.ts → dist/serializer/rest.d.ts} +56 -1
  88. package/dist/serializer/rest.d.ts.map +1 -0
  89. package/dist/serializer/rest.js +958 -1200
  90. package/dist/serializer/rest.js.map +1 -0
  91. package/dist/serializer/transform.d.ts +313 -0
  92. package/dist/serializer/transform.d.ts.map +1 -0
  93. package/dist/serializer/transform.js +283 -260
  94. package/dist/serializer/transform.js.map +1 -0
  95. package/dist/serializer.d.ts +151 -0
  96. package/dist/serializer.d.ts.map +1 -0
  97. package/dist/serializer.js +205 -208
  98. package/dist/serializer.js.map +1 -0
  99. package/dist/store-C4qYzXei.js +473 -0
  100. package/dist/store-C4qYzXei.js.map +1 -0
  101. package/dist/store.d.ts +13 -0
  102. package/dist/store.d.ts.map +1 -0
  103. package/dist/store.js +1 -635
  104. package/dist/unpkg/dev/-private-CrEyBE-B.js +189 -0
  105. package/dist/unpkg/dev/-private-CrEyBE-B.js.map +1 -0
  106. package/dist/unpkg/dev/-private-vOhxVExH.js +896 -0
  107. package/dist/unpkg/dev/-private-vOhxVExH.js.map +1 -0
  108. package/dist/unpkg/dev/adapter/-private.js +3 -1
  109. package/dist/unpkg/dev/adapter/error.js +424 -310
  110. package/dist/unpkg/dev/adapter/error.js.map +1 -0
  111. package/dist/unpkg/dev/adapter/json-api.js +239 -245
  112. package/dist/unpkg/dev/adapter/json-api.js.map +1 -0
  113. package/dist/unpkg/dev/adapter/rest.js +935 -1098
  114. package/dist/unpkg/dev/adapter/rest.js.map +1 -0
  115. package/dist/unpkg/dev/adapter-oLwyr47q.js +1129 -0
  116. package/dist/unpkg/dev/adapter-oLwyr47q.js.map +1 -0
  117. package/dist/unpkg/dev/adapter.js +1 -1250
  118. package/dist/unpkg/dev/compat/-private.js +3 -1
  119. package/dist/unpkg/dev/compat/builders.js +204 -248
  120. package/dist/unpkg/dev/compat/builders.js.map +1 -0
  121. package/dist/unpkg/dev/compat/extensions.js +270 -232
  122. package/dist/unpkg/dev/compat/extensions.js.map +1 -0
  123. package/dist/unpkg/dev/compat/utils.js +188 -193
  124. package/dist/unpkg/dev/compat/utils.js.map +1 -0
  125. package/dist/unpkg/dev/compat-D48B8sXv.js +825 -0
  126. package/dist/unpkg/dev/compat-D48B8sXv.js.map +1 -0
  127. package/dist/unpkg/dev/compat.js +1 -1145
  128. package/dist/unpkg/dev/errors-8GnRWcxo.js +2127 -0
  129. package/dist/unpkg/dev/errors-8GnRWcxo.js.map +1 -0
  130. package/dist/unpkg/dev/index.js +270 -190
  131. package/dist/unpkg/dev/index.js.map +1 -0
  132. package/dist/unpkg/dev/json-DDJji3V3.js +1104 -0
  133. package/dist/unpkg/dev/json-DDJji3V3.js.map +1 -0
  134. package/dist/unpkg/dev/model/-private.js +3 -1
  135. package/dist/unpkg/dev/model/migration-support.js +483 -537
  136. package/dist/unpkg/dev/model/migration-support.js.map +1 -0
  137. package/dist/unpkg/dev/model-LK7ethC5.js +655 -0
  138. package/dist/unpkg/dev/model-LK7ethC5.js.map +1 -0
  139. package/dist/unpkg/dev/model-fragments-DSqu0ptR.js +334 -0
  140. package/dist/unpkg/dev/model-fragments-DSqu0ptR.js.map +1 -0
  141. package/dist/unpkg/dev/model-fragments.js +2 -75
  142. package/dist/unpkg/dev/model.js +3 -677
  143. package/dist/unpkg/dev/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
  144. package/dist/unpkg/dev/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
  145. package/dist/unpkg/dev/schema-provider-CRzoMoTO.js +1834 -0
  146. package/dist/unpkg/dev/schema-provider-CRzoMoTO.js.map +1 -0
  147. package/dist/unpkg/dev/serializer/json-api.js +514 -629
  148. package/dist/unpkg/dev/serializer/json-api.js.map +1 -0
  149. package/dist/unpkg/dev/serializer/json.js +3 -4
  150. package/dist/unpkg/dev/serializer/rest.js +954 -1197
  151. package/dist/unpkg/dev/serializer/rest.js.map +1 -0
  152. package/dist/unpkg/dev/serializer/transform.js +283 -260
  153. package/dist/unpkg/dev/serializer/transform.js.map +1 -0
  154. package/dist/unpkg/dev/serializer.js +205 -208
  155. package/dist/unpkg/dev/serializer.js.map +1 -0
  156. package/dist/unpkg/dev/store-D_V8-HQl.js +472 -0
  157. package/dist/unpkg/dev/store-D_V8-HQl.js.map +1 -0
  158. package/dist/unpkg/dev/store.js +1 -635
  159. package/dist/unpkg/dev/util-dSKEgQDp.js +12 -0
  160. package/dist/unpkg/dev/util-dSKEgQDp.js.map +1 -0
  161. package/dist/unpkg/dev/utils-DYC9utVJ.js +11 -0
  162. package/dist/unpkg/dev/utils-DYC9utVJ.js.map +1 -0
  163. package/dist/unpkg/dev-deprecated/-private-CrEyBE-B.js +189 -0
  164. package/dist/unpkg/dev-deprecated/-private-CrEyBE-B.js.map +1 -0
  165. package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js +896 -0
  166. package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js.map +1 -0
  167. package/dist/unpkg/dev-deprecated/adapter/-private.js +3 -1
  168. package/dist/unpkg/dev-deprecated/adapter/error.js +424 -310
  169. package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -0
  170. package/dist/unpkg/dev-deprecated/adapter/json-api.js +239 -245
  171. package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -0
  172. package/dist/unpkg/dev-deprecated/adapter/rest.js +935 -1098
  173. package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -0
  174. package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js +1129 -0
  175. package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js.map +1 -0
  176. package/dist/unpkg/dev-deprecated/adapter.js +1 -1250
  177. package/dist/unpkg/dev-deprecated/compat/-private.js +3 -1
  178. package/dist/unpkg/dev-deprecated/compat/builders.js +204 -248
  179. package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -0
  180. package/dist/unpkg/dev-deprecated/compat/extensions.js +270 -232
  181. package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -0
  182. package/dist/unpkg/dev-deprecated/compat/utils.js +188 -193
  183. package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -0
  184. package/dist/unpkg/dev-deprecated/compat-DGSurLh7.js +825 -0
  185. package/dist/unpkg/dev-deprecated/compat-DGSurLh7.js.map +1 -0
  186. package/dist/unpkg/dev-deprecated/compat.js +1 -1145
  187. package/dist/unpkg/dev-deprecated/errors-0ydn94s0.js +2128 -0
  188. package/dist/unpkg/dev-deprecated/errors-0ydn94s0.js.map +1 -0
  189. package/dist/unpkg/dev-deprecated/index.js +270 -189
  190. package/dist/unpkg/dev-deprecated/index.js.map +1 -0
  191. package/dist/unpkg/dev-deprecated/json-DDJji3V3.js +1104 -0
  192. package/dist/unpkg/dev-deprecated/json-DDJji3V3.js.map +1 -0
  193. package/dist/unpkg/dev-deprecated/model/-private.js +3 -1
  194. package/dist/unpkg/dev-deprecated/model/migration-support.js +494 -554
  195. package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -0
  196. package/dist/unpkg/dev-deprecated/model-C1ts6Mod.js +660 -0
  197. package/dist/unpkg/dev-deprecated/model-C1ts6Mod.js.map +1 -0
  198. package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js +334 -0
  199. package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js.map +1 -0
  200. package/dist/unpkg/dev-deprecated/model-fragments.js +2 -75
  201. package/dist/unpkg/dev-deprecated/model.js +3 -681
  202. package/dist/unpkg/dev-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
  203. package/dist/unpkg/dev-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
  204. package/dist/unpkg/dev-deprecated/schema-provider-D2ESMsA8.js +1835 -0
  205. package/dist/unpkg/dev-deprecated/schema-provider-D2ESMsA8.js.map +1 -0
  206. package/dist/unpkg/dev-deprecated/serializer/json-api.js +514 -629
  207. package/dist/unpkg/dev-deprecated/serializer/json-api.js.map +1 -0
  208. package/dist/unpkg/dev-deprecated/serializer/json.js +3 -4
  209. package/dist/unpkg/dev-deprecated/serializer/rest.js +954 -1197
  210. package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -0
  211. package/dist/unpkg/dev-deprecated/serializer/transform.js +283 -260
  212. package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -0
  213. package/dist/unpkg/dev-deprecated/serializer.js +205 -208
  214. package/dist/unpkg/dev-deprecated/serializer.js.map +1 -0
  215. package/dist/unpkg/dev-deprecated/store-BX7GvXC_.js +472 -0
  216. package/dist/unpkg/dev-deprecated/store-BX7GvXC_.js.map +1 -0
  217. package/dist/unpkg/dev-deprecated/store.js +1 -635
  218. package/dist/unpkg/dev-deprecated/util-9mgEBJ3W.js +18 -0
  219. package/dist/unpkg/dev-deprecated/util-9mgEBJ3W.js.map +1 -0
  220. package/dist/unpkg/dev-deprecated/utils-Cl86-e7F.js +17 -0
  221. package/dist/unpkg/dev-deprecated/utils-Cl86-e7F.js.map +1 -0
  222. package/dist/unpkg/prod/-private-B4bxoTuK.js +160 -0
  223. package/dist/unpkg/prod/-private-B4bxoTuK.js.map +1 -0
  224. package/dist/unpkg/prod/-private-SfXkkHKd.js +745 -0
  225. package/dist/unpkg/prod/-private-SfXkkHKd.js.map +1 -0
  226. package/dist/unpkg/prod/adapter/-private.js +3 -1
  227. package/dist/unpkg/prod/adapter/error.js +421 -305
  228. package/dist/unpkg/prod/adapter/error.js.map +1 -0
  229. package/dist/unpkg/prod/adapter/json-api.js +236 -240
  230. package/dist/unpkg/prod/adapter/json-api.js.map +1 -0
  231. package/dist/unpkg/prod/adapter/rest.js +911 -1061
  232. package/dist/unpkg/prod/adapter/rest.js.map +1 -0
  233. package/dist/unpkg/prod/adapter-DQ9UA7FC.js +1111 -0
  234. package/dist/unpkg/prod/adapter-DQ9UA7FC.js.map +1 -0
  235. package/dist/unpkg/prod/adapter.js +1 -1217
  236. package/dist/unpkg/prod/compat/-private.js +3 -1
  237. package/dist/unpkg/prod/compat/builders.js +165 -183
  238. package/dist/unpkg/prod/compat/builders.js.map +1 -0
  239. package/dist/unpkg/prod/compat/extensions.js +258 -222
  240. package/dist/unpkg/prod/compat/extensions.js.map +1 -0
  241. package/dist/unpkg/prod/compat/utils.js +185 -188
  242. package/dist/unpkg/prod/compat/utils.js.map +1 -0
  243. package/dist/unpkg/prod/compat-DxiVkCUb.js +547 -0
  244. package/dist/unpkg/prod/compat-DxiVkCUb.js.map +1 -0
  245. package/dist/unpkg/prod/compat.js +1 -725
  246. package/dist/unpkg/prod/errors-CVXWrUjP.js +1977 -0
  247. package/dist/unpkg/prod/errors-CVXWrUjP.js.map +1 -0
  248. package/dist/unpkg/prod/index.js +249 -146
  249. package/dist/unpkg/prod/index.js.map +1 -0
  250. package/dist/unpkg/prod/json-BD1kRTfB.js +1080 -0
  251. package/dist/unpkg/prod/json-BD1kRTfB.js.map +1 -0
  252. package/dist/unpkg/prod/model/-private.js +3 -1
  253. package/dist/unpkg/prod/model/migration-support.js +479 -530
  254. package/dist/unpkg/prod/model/migration-support.js.map +1 -0
  255. package/dist/unpkg/prod/model-D3WMsNNE.js +603 -0
  256. package/dist/unpkg/prod/model-D3WMsNNE.js.map +1 -0
  257. package/dist/unpkg/prod/model-fragments-DSqu0ptR.js +334 -0
  258. package/dist/unpkg/prod/model-fragments-DSqu0ptR.js.map +1 -0
  259. package/dist/unpkg/prod/model-fragments.js +2 -75
  260. package/dist/unpkg/prod/model.js +3 -592
  261. package/dist/unpkg/prod/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
  262. package/dist/unpkg/prod/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
  263. package/dist/unpkg/prod/schema-provider-_pimTZ3P.js +1622 -0
  264. package/dist/unpkg/prod/schema-provider-_pimTZ3P.js.map +1 -0
  265. package/dist/unpkg/prod/serializer/json-api.js +497 -587
  266. package/dist/unpkg/prod/serializer/json-api.js.map +1 -0
  267. package/dist/unpkg/prod/serializer/json.js +3 -4
  268. package/dist/unpkg/prod/serializer/rest.js +938 -1167
  269. package/dist/unpkg/prod/serializer/rest.js.map +1 -0
  270. package/dist/unpkg/prod/serializer/transform.js +283 -260
  271. package/dist/unpkg/prod/serializer/transform.js.map +1 -0
  272. package/dist/unpkg/prod/serializer.js +205 -208
  273. package/dist/unpkg/prod/serializer.js.map +1 -0
  274. package/dist/unpkg/prod/store-RGGc1ilN.js +392 -0
  275. package/dist/unpkg/prod/store-RGGc1ilN.js.map +1 -0
  276. package/dist/unpkg/prod/store.js +1 -503
  277. package/dist/unpkg/prod/util-dSKEgQDp.js +12 -0
  278. package/dist/unpkg/prod/util-dSKEgQDp.js.map +1 -0
  279. package/dist/unpkg/prod/utils-DYC9utVJ.js +11 -0
  280. package/dist/unpkg/prod/utils-DYC9utVJ.js.map +1 -0
  281. package/dist/unpkg/prod-deprecated/-private-B4bxoTuK.js +160 -0
  282. package/dist/unpkg/prod-deprecated/-private-B4bxoTuK.js.map +1 -0
  283. package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js +745 -0
  284. package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js.map +1 -0
  285. package/dist/unpkg/prod-deprecated/adapter/-private.js +3 -1
  286. package/dist/unpkg/prod-deprecated/adapter/error.js +421 -305
  287. package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -0
  288. package/dist/unpkg/prod-deprecated/adapter/json-api.js +236 -240
  289. package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -0
  290. package/dist/unpkg/prod-deprecated/adapter/rest.js +911 -1061
  291. package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -0
  292. package/{declarations/adapter.d.ts → dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js} +451 -110
  293. package/dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js.map +1 -0
  294. package/dist/unpkg/prod-deprecated/adapter.js +1 -1217
  295. package/dist/unpkg/prod-deprecated/compat/-private.js +3 -1
  296. package/dist/unpkg/prod-deprecated/compat/builders.js +165 -183
  297. package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -0
  298. package/dist/unpkg/prod-deprecated/compat/extensions.js +258 -222
  299. package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -0
  300. package/dist/unpkg/prod-deprecated/compat/utils.js +185 -188
  301. package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -0
  302. package/dist/unpkg/prod-deprecated/compat-DxiVkCUb.js +547 -0
  303. package/dist/unpkg/prod-deprecated/compat-DxiVkCUb.js.map +1 -0
  304. package/dist/unpkg/prod-deprecated/compat.js +1 -725
  305. package/dist/unpkg/prod-deprecated/errors-9LXqpfRd.js +1978 -0
  306. package/dist/unpkg/prod-deprecated/errors-9LXqpfRd.js.map +1 -0
  307. package/dist/unpkg/prod-deprecated/index.js +249 -145
  308. package/dist/unpkg/prod-deprecated/index.js.map +1 -0
  309. package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js +1080 -0
  310. package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js.map +1 -0
  311. package/dist/unpkg/prod-deprecated/model/-private.js +3 -1
  312. package/dist/unpkg/prod-deprecated/model/migration-support.js +490 -547
  313. package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -0
  314. package/dist/unpkg/prod-deprecated/model-aiVrr1fz.js +604 -0
  315. package/dist/unpkg/prod-deprecated/model-aiVrr1fz.js.map +1 -0
  316. package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js +334 -0
  317. package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js.map +1 -0
  318. package/dist/unpkg/prod-deprecated/model-fragments.js +2 -75
  319. package/dist/unpkg/prod-deprecated/model.js +3 -595
  320. package/dist/unpkg/prod-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
  321. package/dist/unpkg/prod-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
  322. package/dist/unpkg/prod-deprecated/schema-provider-DyfSd9Cv.js +1635 -0
  323. package/dist/unpkg/prod-deprecated/schema-provider-DyfSd9Cv.js.map +1 -0
  324. package/dist/unpkg/prod-deprecated/serializer/json-api.js +497 -587
  325. package/dist/unpkg/prod-deprecated/serializer/json-api.js.map +1 -0
  326. package/dist/unpkg/prod-deprecated/serializer/json.js +3 -4
  327. package/dist/unpkg/prod-deprecated/serializer/rest.js +938 -1167
  328. package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -0
  329. package/dist/unpkg/prod-deprecated/serializer/transform.js +283 -260
  330. package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -0
  331. package/dist/unpkg/prod-deprecated/serializer.js +205 -208
  332. package/dist/unpkg/prod-deprecated/serializer.js.map +1 -0
  333. package/dist/unpkg/prod-deprecated/store-0L2CkYzh.js +392 -0
  334. package/dist/unpkg/prod-deprecated/store-0L2CkYzh.js.map +1 -0
  335. package/dist/unpkg/prod-deprecated/store.js +1 -503
  336. package/dist/unpkg/prod-deprecated/util-CQQdHX3n.js +14 -0
  337. package/dist/unpkg/prod-deprecated/util-CQQdHX3n.js.map +1 -0
  338. package/dist/unpkg/prod-deprecated/utils-BMI_JwFP.js +13 -0
  339. package/dist/unpkg/prod-deprecated/utils-BMI_JwFP.js.map +1 -0
  340. package/dist/util-Bnx8nm-D.js +29 -0
  341. package/dist/util-Bnx8nm-D.js.map +1 -0
  342. package/dist/utils-ZAytYep8.js +28 -0
  343. package/dist/utils-ZAytYep8.js.map +1 -0
  344. package/package.json +21 -25
  345. package/declarations/adapter/-private/build-url-mixin.d.ts +0 -33
  346. package/declarations/adapter/-private/fastboot-interface.d.ts +0 -8
  347. package/declarations/adapter/-private/utils/continue-on-reject.d.ts +0 -1
  348. package/declarations/adapter/-private/utils/determine-body-promise.d.ts +0 -4
  349. package/declarations/adapter/-private/utils/fetch.d.ts +0 -8
  350. package/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
  351. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +0 -6
  352. package/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -5
  353. package/declarations/adapter/-private.d.ts +0 -5
  354. package/declarations/adapter/error.d.ts +0 -215
  355. package/declarations/compat/-private.d.ts +0 -13
  356. package/declarations/compat/builders/find-all.d.ts +0 -35
  357. package/declarations/compat/builders/find-record.d.ts +0 -56
  358. package/declarations/compat/builders/query.d.ts +0 -66
  359. package/declarations/compat/builders/save-record.d.ts +0 -34
  360. package/declarations/compat/builders/utils.d.ts +0 -3
  361. package/declarations/compat/builders.d.ts +0 -14
  362. package/declarations/compat/extensions.d.ts +0 -59
  363. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -55
  364. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +0 -2
  365. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +0 -11
  366. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +0 -5
  367. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +0 -2
  368. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -524
  369. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -213
  370. package/declarations/compat/legacy-network-handler/serializer-response.d.ts +0 -6
  371. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +0 -110
  372. package/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -255
  373. package/declarations/compat/utils.d.ts +0 -137
  374. package/declarations/compat.d.ts +0 -157
  375. package/declarations/index.d.ts +0 -102
  376. package/declarations/model/-private/attr.d.ts +0 -170
  377. package/declarations/model/-private/belongs-to.d.ts +0 -174
  378. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -5
  379. package/declarations/model/-private/errors.d.ts +0 -289
  380. package/declarations/model/-private/has-many.d.ts +0 -162
  381. package/declarations/model/-private/hooks.d.ts +0 -10
  382. package/declarations/model/-private/legacy-relationships-support.d.ts +0 -47
  383. package/declarations/model/-private/model-for-mixin.d.ts +0 -3
  384. package/declarations/model/-private/model-methods.d.ts +0 -39
  385. package/declarations/model/-private/model.d.ts +0 -1228
  386. package/declarations/model/-private/notify-changes.d.ts +0 -4
  387. package/declarations/model/-private/promise-belongs-to.d.ts +0 -40
  388. package/declarations/model/-private/promise-many-array.d.ts +0 -106
  389. package/declarations/model/-private/record-state.d.ts +0 -58
  390. package/declarations/model/-private/references/belongs-to.d.ts +0 -488
  391. package/declarations/model/-private/references/has-many.d.ts +0 -498
  392. package/declarations/model/-private/schema-provider.d.ts +0 -56
  393. package/declarations/model/-private/type-utils.d.ts +0 -57
  394. package/declarations/model/-private/util.d.ts +0 -5
  395. package/declarations/model/-private.d.ts +0 -8
  396. package/declarations/model/migration-support.d.ts +0 -280
  397. package/declarations/model-fragments/extensions/fragment-array.d.ts +0 -16
  398. package/declarations/model-fragments/extensions/fragment.d.ts +0 -15
  399. package/declarations/model-fragments/hooks/model-for.d.ts +0 -20
  400. package/declarations/model-fragments/index.d.ts +0 -5
  401. package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -9
  402. package/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -15
  403. package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -20
  404. package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -19
  405. package/declarations/model-fragments/utilities/with-legacy.d.ts +0 -3
  406. package/declarations/model-fragments.d.ts +0 -9
  407. package/declarations/model.d.ts +0 -49
  408. package/declarations/serializer/-private/transforms/boolean.d.ts +0 -47
  409. package/declarations/serializer/-private/transforms/date.d.ts +0 -28
  410. package/declarations/serializer/-private/transforms/number.d.ts +0 -29
  411. package/declarations/serializer/-private/transforms/string.d.ts +0 -29
  412. package/declarations/serializer/-private/transforms/transform.d.ts +0 -118
  413. package/declarations/serializer/-private/utils.d.ts +0 -3
  414. package/declarations/serializer/rest.d.ts +0 -51
  415. package/declarations/serializer/transform.d.ts +0 -5
  416. package/declarations/serializer.d.ts +0 -254
  417. package/declarations/store/-private.d.ts +0 -223
  418. package/declarations/store.d.ts +0 -3
  419. package/dist/-private-BG3bMiKp.js +0 -1211
  420. package/dist/errors-Cz5KrzBk.js +0 -2566
  421. package/dist/hooks-D6diaM34.js +0 -74
  422. package/dist/json-ChdEfB0X.js +0 -1259
  423. package/dist/model-for-CqXsIKws.js +0 -221
  424. package/dist/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  425. package/dist/schema-provider-DJCV_6AF.js +0 -2295
  426. package/dist/serialize-into-hash-DPZYoF-i.js +0 -261
  427. package/dist/unpkg/dev/-private-DtjBbEgy.js +0 -1206
  428. package/dist/unpkg/dev/errors-DmGGJr3T.js +0 -2562
  429. package/dist/unpkg/dev/hooks-CkYiE6Ud.js +0 -73
  430. package/dist/unpkg/dev/json-Cu1LNgmQ.js +0 -1256
  431. package/dist/unpkg/dev/model-for-CqXsIKws.js +0 -221
  432. package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  433. package/dist/unpkg/dev/schema-provider-DDVYxmUV.js +0 -2186
  434. package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +0 -259
  435. package/dist/unpkg/dev/util-DvanW33H.js +0 -20
  436. package/dist/unpkg/dev/utils-BhvS1iTS.js +0 -8
  437. package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +0 -1206
  438. package/dist/unpkg/dev-deprecated/errors-Spt6ubMd.js +0 -2565
  439. package/dist/unpkg/dev-deprecated/hooks-DOXegvhL.js +0 -73
  440. package/dist/unpkg/dev-deprecated/json-Cu1LNgmQ.js +0 -1256
  441. package/dist/unpkg/dev-deprecated/model-for-CqXsIKws.js +0 -221
  442. package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  443. package/dist/unpkg/dev-deprecated/schema-provider-BP6_8N-V.js +0 -2211
  444. package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +0 -259
  445. package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +0 -24
  446. package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +0 -12
  447. package/dist/unpkg/prod/-private-BdyZaGEh.js +0 -971
  448. package/dist/unpkg/prod/errors-BGVFCBmi.js +0 -2314
  449. package/dist/unpkg/prod/hooks-BztVA_x0.js +0 -41
  450. package/dist/unpkg/prod/json-BWrZ5546.js +0 -1243
  451. package/dist/unpkg/prod/model-for-CqXsIKws.js +0 -221
  452. package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  453. package/dist/unpkg/prod/schema-provider-DJtD_8jZ.js +0 -1861
  454. package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +0 -215
  455. package/dist/unpkg/prod/util-DvanW33H.js +0 -20
  456. package/dist/unpkg/prod/utils-BhvS1iTS.js +0 -8
  457. package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +0 -971
  458. package/dist/unpkg/prod-deprecated/errors-CdDaK81x.js +0 -2317
  459. package/dist/unpkg/prod-deprecated/hooks-yId87yyG.js +0 -41
  460. package/dist/unpkg/prod-deprecated/json-BWrZ5546.js +0 -1243
  461. package/dist/unpkg/prod-deprecated/model-for-CqXsIKws.js +0 -221
  462. package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
  463. package/dist/unpkg/prod-deprecated/schema-provider-CjX55uSY.js +0 -1904
  464. package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +0 -215
  465. package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +0 -23
  466. package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +0 -11
  467. package/dist/util-Dul6TZts.js +0 -35
  468. package/dist/utils-Cqw9eRj5.js +0 -23
@@ -1,1228 +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 {String} name of the relationship
282
- @since 2.5.0
283
- @return {BelongsToReference} 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 {String} name of the relationship
335
- @since 2.5.0
336
- @return {HasManyReference} 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
- set isError(v: boolean);
609
- /**
610
- If `true` the store is attempting to reload the record from the adapter.
611
-
612
- Example
613
-
614
- ```javascript
615
- record.isReloading; // false
616
- record.reload();
617
- record.isReloading; // true
618
- ```
619
-
620
- @public
621
- */
622
- isReloading: boolean;
623
- /**
624
- All ember models have an id property. This is an identifier
625
- managed by an external source. These are always coerced to be
626
- strings before being used internally. Note when declaring the
627
- attributes for a model it is an error to declare an id
628
- attribute.
629
-
630
- ```javascript
631
- let record = store.createRecord('model');
632
- record.id; // null
633
-
634
- const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
635
- model.id; // '1'
636
- ```
637
-
638
- @public
639
- */
640
- get id(): string | null;
641
- set id(id: string | null);
642
- toString(): string;
643
- /**
644
- @private
645
- */
646
- get currentState(): RecordState;
647
- set currentState(_v: RecordState);
648
- /**
649
- The store service instance which created this record instance
650
-
651
- @public
652
- */
653
- store: Store;
654
- /**
655
- When the record is in the `invalid` state this object will contain
656
- any errors returned by the adapter. When present the errors hash
657
- contains keys corresponding to the invalid property names
658
- and values which are arrays of Javascript objects with two keys:
659
-
660
- - `message` A string containing the error message from the backend
661
- - `attribute` The name of the property associated with this error message
662
-
663
- ```javascript
664
- record.errors.length; // 0
665
- record.set('foo', 'invalid value');
666
- record.save().catch(function() {
667
- record.errors.foo;
668
- // [{message: 'foo should be a number.', attribute: 'foo'}]
669
- });
670
- ```
671
-
672
- The `errors` property is useful for displaying error messages to
673
- the user.
674
-
675
- ```handlebars
676
- <label>Username: <Input @value={{@model.username}} /> </label>
677
- {{#each @model.errors.username as |error|}}
678
- <div class="error">
679
- {{error.message}}
680
- </div>
681
- {{/each}}
682
- <label>Email: <Input @value={{@model.email}} /> </label>
683
- {{#each @model.errors.email as |error|}}
684
- <div class="error">
685
- {{error.message}}
686
- </div>
687
- {{/each}}
688
- ```
689
-
690
-
691
- You can also access the special `messages` property on the error
692
- object to get an array of all the error strings.
693
-
694
- ```handlebars
695
- {{#each @model.errors.messages as |message|}}
696
- <div class="error">
697
- {{message}}
698
- </div>
699
- {{/each}}
700
- ```
701
-
702
- @public
703
- */
704
- get errors(): Errors;
705
- /**
706
- This property holds the `AdapterError` object with which
707
- last adapter operation was rejected.
708
-
709
- @public
710
- */
711
- get adapterError(): unknown;
712
- set adapterError(v: unknown);
713
- notifyPropertyChange(prop: string): this;
714
- /**
715
- Given a callback, iterates over each of the relationships in the model,
716
- invoking the callback with the name of each relationship and its relationship
717
- descriptor.
718
-
719
-
720
- The callback method you provide should have the following signature (all
721
- parameters are optional):
722
-
723
- ```javascript
724
- function(name, descriptor);
725
- ```
726
-
727
- - `name` the name of the current property in the iteration
728
- - `descriptor` the meta object that describes this relationship
729
-
730
- The relationship descriptor argument is an object with the following properties.
731
-
732
- - **name** <span class="type">String</span> the name of this relationship on the Model
733
- - **kind** <span class="type">String</span> "hasMany" or "belongsTo"
734
- - **options** <span class="type">Object</span> the original options hash passed when the relationship was declared
735
- - **parentType** <span class="type">Model</span> the type of the Model that owns this relationship
736
- - **type** <span class="type">String</span> the type name of the related Model
737
-
738
- Note that in addition to a callback, you can also pass an optional target
739
- object that will be set as `this` on the context.
740
-
741
- Example
742
-
743
- ```js [app/serializers/application.js]
744
- import JSONSerializer from '@ember-data/serializer/json';
745
-
746
- export default class ApplicationSerializer extends JSONSerializer {
747
- serialize(record, options) {
748
- let json = {};
749
-
750
- record.eachRelationship(function(name, descriptor) {
751
- if (descriptor.kind === 'hasMany') {
752
- let serializedHasManyName = name.toUpperCase() + '_IDS';
753
- json[serializedHasManyName] = record.get(name).map(r => r.id);
754
- }
755
- });
756
-
757
- return json;
758
- }
759
- }
760
- ```
761
-
762
- @public
763
- @param callback the callback to invoke
764
- @param binding the value to which the callback's `this` should be bound
765
- */
766
- eachRelationship<T>(callback: (this: NoInfer<T> | undefined, key: MaybeRelationshipFields<this>, meta: LegacyRelationshipField) => void, binding?: T): void;
767
- relationshipFor(name: string): LegacyRelationshipField | undefined;
768
- inverseFor(name: string): LegacyRelationshipField | null;
769
- eachAttribute<T>(callback: (this: NoInfer<T> | undefined, key: isSubClass<this> extends true ? MaybeAttrFields<this> : string, meta: LegacyAttributeField) => void, binding?: T): void;
770
- /**
771
- Represents the model's class name as a string. This can be used to look up the model's class name through
772
- `Store`'s modelFor method.
773
-
774
- `modelName` is generated for you by WarpDrive. It will be a lowercased, dasherized string.
775
- For example:
776
-
777
- ```javascript
778
- store.modelFor('post').modelName; // 'post'
779
- store.modelFor('blog-post').modelName; // 'blog-post'
780
- ```
781
-
782
- The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
783
- keys to underscore (instead of dasherized), you might use the following code:
784
-
785
- ```javascript
786
- import RESTSerializer from '@ember-data/serializer/rest';
787
- import { underscore } from '<app-name>/utils/string-utils';
788
-
789
- export default const PostSerializer = RESTSerializer.extend({
790
- payloadKeyFromModelName(modelName) {
791
- return underscore(modelName);
792
- }
793
- });
794
- ```
795
-
796
- @public
797
- */
798
- static modelName: string;
799
- /**
800
- For a given relationship name, returns the model type of the relationship.
801
-
802
- For example, if you define a model like this:
803
-
804
- ```js [app/models/post.js]
805
- import { Model, hasMany } from '@warp-drive/legacy/model';
806
-
807
- export default class PostModel extends Model {
808
- @hasMany('comment') comments;
809
- }
810
- ```
811
-
812
- Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.
813
-
814
- @public
815
- @param name the name of the relationship
816
- @param store an instance of Store
817
- @return the type of the relationship, or undefined
818
- */
819
- static typeForRelationship(name: string, store: Store): ModelSchema | undefined;
820
- static get inverseMap(): Record<string, LegacyRelationshipField | null>;
821
- /**
822
- Find the relationship which is the inverse of the one asked for.
823
-
824
- For example, if you define models like this:
825
-
826
- ```js [app/models/post.js]
827
- import { Model, hasMany } from '@warp-drive/legacy/model';
828
-
829
- export default class PostModel extends Model {
830
- @hasMany('message') comments;
831
- }
832
- ```
833
-
834
- ```js [app/models/message.js]
835
- import { Model, belongsTo } from '@warp-drive/legacy/model';
836
-
837
- export default class MessageModel extends Model {
838
- @belongsTo('post') owner;
839
- }
840
- ```
841
-
842
- ``` js
843
- store.modelFor('post').inverseFor('comments', store) // { type: 'message', name: 'owner', kind: 'belongsTo' }
844
- store.modelFor('message').inverseFor('owner', store) // { type: 'post', name: 'comments', kind: 'hasMany' }
845
- ```
846
-
847
- @public
848
- @param name the name of the relationship
849
- @param store
850
- @return the inverse relationship, or null
851
- */
852
- static inverseFor(name: string, store: Store): LegacyRelationshipField | null;
853
- static _findInverseFor(name: string, store: Store): LegacyRelationshipField | null;
854
- /**
855
- The model's relationships as a map, keyed on the type of the
856
- relationship. The value of each entry is an array containing a descriptor
857
- for each relationship with that type, describing the name of the relationship
858
- as well as the type.
859
-
860
- For example, given the following model definition:
861
-
862
- ```js [app/models/blog.js]
863
- import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';
864
-
865
- export default class BlogModel extends Model {
866
- @hasMany('user') users;
867
- @belongsTo('user') owner;
868
- @hasMany('post') posts;
869
- }
870
- ```
871
-
872
- This computed property would return a map describing these
873
- relationships, like this:
874
-
875
- ```javascript
876
- import Blog from 'app/models/blog';
877
- import User from 'app/models/user';
878
- import Post from 'app/models/post';
879
-
880
- let relationships = Blog.relationships;
881
- relationships.user;
882
- //=> [ { name: 'users', kind: 'hasMany' },
883
- // { name: 'owner', kind: 'belongsTo' } ]
884
- relationships.post;
885
- //=> [ { name: 'posts', kind: 'hasMany' } ]
886
- ```
887
-
888
- @public
889
- */
890
- static get relationships(): Map<string, LegacyRelationshipField[]>;
891
- /**
892
- A hash containing lists of the model's relationships, grouped
893
- by the relationship kind. For example, given a model with this
894
- 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
-
903
- @hasMany('post') posts;
904
- }
905
- ```
906
-
907
- This property would contain the following:
908
-
909
- ```javascript
910
- import Blog from 'app/models/blog';
911
-
912
- let relationshipNames = Blog.relationshipNames;
913
- relationshipNames.hasMany;
914
- //=> ['users', 'posts']
915
- relationshipNames.belongsTo;
916
- //=> ['owner']
917
- ```
918
-
919
- @public
920
- */
921
- static get relationshipNames(): {
922
- hasMany: string[];
923
- belongsTo: string[];
924
- };
925
- /**
926
- An array of types directly related to a model. Each type will be
927
- included once, regardless of the number of relationships it has with
928
- the model.
929
-
930
- For example, given a model with this definition:
931
-
932
- ```js [app/models/blog.js]
933
- import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';
934
-
935
- export default class BlogModel extends Model {
936
- @hasMany('user') users;
937
- @belongsTo('user') owner;
938
-
939
- @hasMany('post') posts;
940
- }
941
- ```
942
-
943
- This property would contain the following:
944
-
945
- ```javascript
946
- import Blog from 'app/models/blog';
947
-
948
- let relatedTypes = Blog.relatedTypes');
949
- //=> ['user', 'post']
950
- ```
951
-
952
- @public
953
- */
954
- static get relatedTypes(): string[];
955
- /**
956
- A map whose keys are the relationships of a model and whose values are
957
- relationship descriptors.
958
-
959
- For example, given a model with this
960
- definition:
961
-
962
- ```js [app/models/blog.js]
963
- import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';
964
-
965
- export default class BlogModel extends Model {
966
- @hasMany('user') users;
967
- @belongsTo('user') owner;
968
-
969
- @hasMany('post') posts;
970
- }
971
- ```
972
-
973
- This property would contain the following:
974
-
975
- ```javascript
976
- import Blog from 'app/models/blog';
977
-
978
- let relationshipsByName = Blog.relationshipsByName;
979
- relationshipsByName.users;
980
- //=> { name: 'users', kind: 'hasMany', type: 'user', options: Object }
981
- relationshipsByName.owner;
982
- //=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }
983
- ```
984
-
985
- @public
986
- */
987
- static get relationshipsByName(): Map<string, LegacyRelationshipField>;
988
- static get relationshipsObject(): Record<string, LegacyRelationshipField>;
989
- /**
990
- A map whose keys are the fields of the model and whose values are strings
991
- describing the kind of the field. A model's fields are the union of all of its
992
- attributes and relationships.
993
-
994
- For example:
995
-
996
- ```js [app/models/blog.js]
997
- import { Model, attr, belongsTo, hasMany } from '@warp-drive/legacy/model';
998
-
999
- export default class BlogModel extends Model {
1000
- @hasMany('user') users;
1001
- @belongsTo('user') owner;
1002
-
1003
- @hasMany('post') posts;
1004
-
1005
- @attr('string') title;
1006
- }
1007
- ```
1008
-
1009
- ```js
1010
- import Blog from 'app/models/blog'
1011
-
1012
- let fields = Blog.fields;
1013
- fields.forEach(function(kind, field) {
1014
- // do thing
1015
- });
1016
-
1017
- // prints:
1018
- // users, hasMany
1019
- // owner, belongsTo
1020
- // posts, hasMany
1021
- // title, attribute
1022
- ```
1023
-
1024
- @public
1025
- */
1026
- static get fields(): Map<string, "attribute" | "belongsTo" | "hasMany">;
1027
- /**
1028
- Given a callback, iterates over each of the relationships in the model,
1029
- invoking the callback with the name of each relationship and its relationship
1030
- descriptor.
1031
-
1032
- @public
1033
- @param callback the callback to invoke
1034
- @param binding the value to which the callback's `this` should be bound
1035
- */
1036
- static eachRelationship<
1037
- T,
1038
- Schema extends Model
1039
- >(callback: (this: T | undefined, key: MaybeRelationshipFields<Schema>, relationship: LegacyRelationshipField) => void, binding?: T): void;
1040
- /**
1041
- Given a callback, iterates over each of the types related to a model,
1042
- invoking the callback with the related type's class. Each type will be
1043
- returned just once, regardless of how many different relationships it has
1044
- with a model.
1045
-
1046
- @public
1047
- @param callback the callback to invoke
1048
- @param binding the value to which the callback's `this` should be bound
1049
- */
1050
- static eachRelatedType<T>(callback: (this: T | undefined, type: string) => void, binding?: T): void;
1051
- /**
1052
- *
1053
- * @private
1054
- * @deprecated
1055
- */
1056
- static determineRelationshipType(knownSide: LegacyRelationshipField, store: Store): "oneToOne" | "oneToMany" | "manyToOne" | "manyToMany" | "oneToNone" | "manyToNone";
1057
- /**
1058
- A map whose keys are the attributes of the model (properties
1059
- described by attr) and whose values are the meta object for the
1060
- property.
1061
-
1062
- Example
1063
-
1064
- ```js [app/models/person.js]
1065
- import { Model, attr } from '@warp-drive/legacy/model';
1066
-
1067
- export default class PersonModel extends Model {
1068
- @attr('string') firstName;
1069
- @attr('string') lastName;
1070
- @attr('date') birthday;
1071
- }
1072
- ```
1073
-
1074
- ```javascript
1075
- import Person from 'app/models/person'
1076
-
1077
- let attributes = Person.attributes
1078
-
1079
- attributes.forEach(function(meta, name) {
1080
- // do thing
1081
- });
1082
-
1083
- // prints:
1084
- // firstName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "firstName"}
1085
- // lastName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "lastName"}
1086
- // birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
1087
- ```
1088
-
1089
- @public
1090
- */
1091
- static get attributes(): Map<string, LegacyAttributeField>;
1092
- /**
1093
- A map whose keys are the attributes of the model (properties
1094
- described by attr) and whose values are type of transformation
1095
- applied to each attribute. This map does not include any
1096
- attributes that do not have an transformation type.
1097
-
1098
- Example
1099
-
1100
- ```js [app/models/person.js]
1101
- import { Model, attr } from '@warp-drive/legacy/model';
1102
-
1103
- export default class PersonModel extends Model {
1104
- @attr firstName;
1105
- @attr('string') lastName;
1106
- @attr('date') birthday;
1107
- }
1108
- ```
1109
-
1110
- ```javascript
1111
- import Person from 'app/models/person';
1112
-
1113
- let transformedAttributes = Person.transformedAttributes
1114
-
1115
- transformedAttributes.forEach(function(field, type) {
1116
- // do thing
1117
- });
1118
-
1119
- // prints:
1120
- // lastName string
1121
- // birthday date
1122
- ```
1123
-
1124
- @public
1125
- */
1126
- static get transformedAttributes(): Map<string, string>;
1127
- /**
1128
- Iterates through the attributes of the model, calling the passed function on each
1129
- attribute.
1130
-
1131
- The callback method you provide should have the following signature (all
1132
- parameters are optional):
1133
-
1134
- ```javascript
1135
- function(name, meta);
1136
- ```
1137
-
1138
- - `name` the name of the current property in the iteration
1139
- - `meta` the meta object for the attribute property in the iteration
1140
-
1141
- Note that in addition to a callback, you can also pass an optional target
1142
- object that will be set as `this` on the context.
1143
-
1144
- Example
1145
-
1146
- ```javascript
1147
- import { Model, attr } from '@warp-drive/legacy/model';
1148
-
1149
- class PersonModel extends Model {
1150
- @attr('string') firstName;
1151
- @attr('string') lastName;
1152
- @attr('date') birthday;
1153
- }
1154
-
1155
- PersonModel.eachAttribute(function(name, meta) {
1156
- // do thing
1157
- });
1158
-
1159
- // prints:
1160
- // firstName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "firstName"}
1161
- // lastName {type: "string", kind: 'attribute', options: Object, parentType: function, name: "lastName"}
1162
- // birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
1163
- ```
1164
-
1165
- @public
1166
- @param callback The callback to execute
1167
- @param binding [optional] the value to which the callback's `this` should be bound
1168
- */
1169
- static eachAttribute<
1170
- T,
1171
- Schema extends Model
1172
- >(callback: (this: T | undefined, key: MaybeAttrFields<Schema>, attribute: LegacyAttributeField) => void, binding?: T): void;
1173
- /**
1174
- Iterates through the transformedAttributes of the model, calling
1175
- the passed function on each attribute. Note the callback will not be
1176
- called for any attributes that do not have an transformation type.
1177
-
1178
- The callback method you provide should have the following signature (all
1179
- parameters are optional):
1180
-
1181
- ```javascript
1182
- function(name, type);
1183
- ```
1184
-
1185
- - `name` the name of the current property in the iteration
1186
- - `type` a string containing the name of the type of transformed
1187
- applied to the attribute
1188
-
1189
- Note that in addition to a callback, you can also pass an optional target
1190
- object that will be set as `this` on the context.
1191
-
1192
- Example
1193
-
1194
- ```javascript
1195
- import { Model, attr } from '@warp-drive/legacy/model';
1196
-
1197
- let Person = Model.extend({
1198
- firstName: attr(),
1199
- lastName: attr('string'),
1200
- birthday: attr('date')
1201
- });
1202
-
1203
- Person.eachTransformedAttribute(function(name, type) {
1204
- // do thing
1205
- });
1206
-
1207
- // prints:
1208
- // lastName string
1209
- // birthday date
1210
- ```
1211
-
1212
- @public
1213
- @param callback The callback to execute
1214
- @param binding [optional] the value to which the callback's `this` should be bound
1215
- */
1216
- static eachTransformedAttribute<
1217
- T,
1218
- Schema extends Model
1219
- >(callback: (this: T | undefined, key: Exclude<keyof Schema & string, keyof Model & string>, type: string) => void, binding?: T): void;
1220
- /**
1221
- Returns the name of the model class.
1222
-
1223
- @public
1224
- */
1225
- static toString(): string;
1226
- }
1227
- export declare function restoreDeprecatedModelRequestBehaviors(ModelKlass: typeof Model): void;
1228
- export { Model };