@warp-drive/legacy 5.8.0-alpha.30 → 5.8.0-alpha.32

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