@warp-drive/legacy 5.8.0-alpha.9 → 5.8.0-beta.1

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 (200) hide show
  1. package/README.md +14 -27
  2. package/declarations/adapter/error.d.ts +7 -7
  3. package/declarations/adapter/json-api.d.ts +2 -2
  4. package/declarations/adapter/rest.d.ts +21 -104
  5. package/declarations/adapter.d.ts +2 -2
  6. package/declarations/compat/builders/find-all.d.ts +6 -6
  7. package/declarations/compat/builders/find-record.d.ts +8 -8
  8. package/declarations/compat/builders/query.d.ts +12 -12
  9. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +16 -24
  10. package/declarations/compat/utils.d.ts +13 -13
  11. package/declarations/compat.d.ts +31 -5
  12. package/declarations/index.d.ts +25 -8
  13. package/declarations/model/-private/legacy-relationships-support.d.ts +2 -2
  14. package/declarations/model/-private/model.d.ts +10 -51
  15. package/declarations/model/-private/promise-many-array.d.ts +0 -18
  16. package/declarations/model/-private/references/belongs-to.d.ts +18 -28
  17. package/declarations/model/-private/references/has-many.d.ts +13 -15
  18. package/declarations/model/migration-support.d.ts +42 -19
  19. package/declarations/model-fragments/extensions/fragment-array.d.ts +16 -0
  20. package/declarations/model-fragments/extensions/fragment.d.ts +15 -0
  21. package/declarations/model-fragments/hooks/model-for.d.ts +20 -0
  22. package/declarations/model-fragments/index.d.ts +5 -0
  23. package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +9 -0
  24. package/declarations/model-fragments/utilities/with-array-defaults.d.ts +15 -0
  25. package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +20 -0
  26. package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +19 -0
  27. package/declarations/model-fragments/utilities/with-legacy.d.ts +3 -0
  28. package/declarations/model-fragments.d.ts +9 -0
  29. package/declarations/model.d.ts +2 -2
  30. package/declarations/serializer/-private/embedded-records-mixin.d.ts +1 -1
  31. package/declarations/serializer/json-api.d.ts +7 -6
  32. package/declarations/serializer/json.d.ts +3 -3
  33. package/declarations/serializer.d.ts +5 -6
  34. package/dist/{-private-B1pSSN52.js → -private-BG3bMiKp.js} +2 -1
  35. package/dist/adapter/-private.js +1 -1
  36. package/dist/adapter/error.js +9 -9
  37. package/dist/adapter/json-api.js +1 -1
  38. package/dist/adapter/rest.js +33 -117
  39. package/dist/adapter.js +2 -2
  40. package/dist/compat/-private.js +1 -1
  41. package/dist/compat/builders.js +26 -26
  42. package/dist/compat/utils.js +13 -14
  43. package/dist/compat.js +28 -8
  44. package/dist/{errors-COviC59J.js → errors-Cz5KrzBk.js} +113 -120
  45. package/dist/{hooks-Bp8SIQBU.js → hooks-D6diaM34.js} +1 -1
  46. package/dist/index.js +25 -8
  47. package/dist/{json-ksWOHRfq.js → json-ChdEfB0X.js} +12 -27
  48. package/dist/model/-private.js +1 -1
  49. package/dist/model/migration-support.js +55 -25
  50. package/dist/model-for-CqXsIKws.js +221 -0
  51. package/dist/model-fragments.js +76 -0
  52. package/dist/model.js +3 -3
  53. package/dist/{schema-provider-JlCneqZH.js → schema-provider-DJCV_6AF.js} +44 -87
  54. package/dist/{serialize-into-hash-BnYvPex3.js → serialize-into-hash-DPZYoF-i.js} +1 -1
  55. package/dist/serializer/json-api.js +18 -45
  56. package/dist/serializer/json.js +1 -1
  57. package/dist/serializer/rest.js +10 -10
  58. package/dist/serializer.js +5 -6
  59. package/dist/store.js +2 -1
  60. package/dist/unpkg/dev/-private-DtjBbEgy.js +1206 -0
  61. package/dist/unpkg/dev/adapter/-private.js +1 -0
  62. package/dist/unpkg/dev/adapter/error.js +335 -0
  63. package/dist/unpkg/dev/adapter/json-api.js +271 -0
  64. package/dist/unpkg/dev/adapter/rest.js +1171 -0
  65. package/dist/unpkg/dev/adapter.js +1252 -0
  66. package/dist/unpkg/dev/compat/-private.js +1 -0
  67. package/dist/unpkg/dev/compat/builders.js +275 -0
  68. package/dist/unpkg/dev/compat/extensions.js +242 -0
  69. package/dist/unpkg/dev/compat/utils.js +223 -0
  70. package/dist/unpkg/dev/compat.js +1147 -0
  71. package/dist/unpkg/dev/errors-DmGGJr3T.js +2562 -0
  72. package/dist/unpkg/dev/hooks-CkYiE6Ud.js +73 -0
  73. package/dist/unpkg/dev/index.js +197 -0
  74. package/dist/unpkg/dev/json-Cu1LNgmQ.js +1256 -0
  75. package/dist/unpkg/dev/model/-private.js +1 -0
  76. package/dist/unpkg/dev/model/migration-support.js +553 -0
  77. package/dist/unpkg/dev/model-for-CqXsIKws.js +221 -0
  78. package/dist/unpkg/dev/model-fragments.js +76 -0
  79. package/dist/unpkg/dev/model.js +678 -0
  80. package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  81. package/dist/unpkg/dev/schema-provider-DDVYxmUV.js +2186 -0
  82. package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +259 -0
  83. package/dist/unpkg/dev/serializer/json-api.js +649 -0
  84. package/dist/unpkg/dev/serializer/json.js +4 -0
  85. package/dist/unpkg/dev/serializer/rest.js +1242 -0
  86. package/dist/unpkg/dev/serializer/transform.js +278 -0
  87. package/dist/unpkg/dev/serializer.js +248 -0
  88. package/dist/unpkg/dev/store.js +637 -0
  89. package/dist/unpkg/dev/util-DvanW33H.js +20 -0
  90. package/dist/unpkg/dev/utils-BhvS1iTS.js +8 -0
  91. package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +1206 -0
  92. package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -0
  93. package/dist/unpkg/dev-deprecated/adapter/error.js +335 -0
  94. package/dist/unpkg/dev-deprecated/adapter/json-api.js +271 -0
  95. package/dist/unpkg/dev-deprecated/adapter/rest.js +1171 -0
  96. package/dist/unpkg/dev-deprecated/adapter.js +1252 -0
  97. package/dist/unpkg/dev-deprecated/compat/-private.js +1 -0
  98. package/dist/unpkg/dev-deprecated/compat/builders.js +275 -0
  99. package/dist/unpkg/dev-deprecated/compat/extensions.js +242 -0
  100. package/dist/unpkg/dev-deprecated/compat/utils.js +223 -0
  101. package/dist/unpkg/dev-deprecated/compat.js +1147 -0
  102. package/dist/unpkg/dev-deprecated/errors-Spt6ubMd.js +2565 -0
  103. package/dist/unpkg/dev-deprecated/hooks-DOXegvhL.js +73 -0
  104. package/dist/unpkg/dev-deprecated/index.js +196 -0
  105. package/dist/unpkg/dev-deprecated/json-Cu1LNgmQ.js +1256 -0
  106. package/dist/unpkg/dev-deprecated/model/-private.js +1 -0
  107. package/dist/unpkg/dev-deprecated/model/migration-support.js +570 -0
  108. package/dist/unpkg/dev-deprecated/model-for-CqXsIKws.js +221 -0
  109. package/dist/unpkg/dev-deprecated/model-fragments.js +76 -0
  110. package/dist/unpkg/dev-deprecated/model.js +682 -0
  111. package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  112. package/dist/unpkg/dev-deprecated/schema-provider-BP6_8N-V.js +2211 -0
  113. package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +259 -0
  114. package/dist/unpkg/dev-deprecated/serializer/json-api.js +649 -0
  115. package/dist/unpkg/dev-deprecated/serializer/json.js +4 -0
  116. package/dist/unpkg/dev-deprecated/serializer/rest.js +1242 -0
  117. package/dist/unpkg/dev-deprecated/serializer/transform.js +278 -0
  118. package/dist/unpkg/dev-deprecated/serializer.js +248 -0
  119. package/dist/unpkg/dev-deprecated/store.js +637 -0
  120. package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +24 -0
  121. package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +12 -0
  122. package/dist/unpkg/prod/-private-BdyZaGEh.js +971 -0
  123. package/dist/unpkg/prod/adapter/-private.js +1 -0
  124. package/dist/unpkg/prod/adapter/error.js +330 -0
  125. package/dist/unpkg/prod/adapter/json-api.js +266 -0
  126. package/dist/unpkg/prod/adapter/rest.js +1134 -0
  127. package/dist/unpkg/prod/adapter.js +1219 -0
  128. package/dist/unpkg/prod/compat/-private.js +1 -0
  129. package/dist/unpkg/prod/compat/builders.js +210 -0
  130. package/dist/unpkg/prod/compat/extensions.js +232 -0
  131. package/dist/unpkg/prod/compat/utils.js +218 -0
  132. package/dist/unpkg/prod/compat.js +727 -0
  133. package/dist/unpkg/prod/errors-BGVFCBmi.js +2314 -0
  134. package/dist/unpkg/prod/hooks-BztVA_x0.js +41 -0
  135. package/dist/unpkg/prod/index.js +151 -0
  136. package/dist/unpkg/prod/json-BWrZ5546.js +1243 -0
  137. package/dist/unpkg/prod/model/-private.js +1 -0
  138. package/dist/unpkg/prod/model/migration-support.js +546 -0
  139. package/dist/unpkg/prod/model-for-CqXsIKws.js +221 -0
  140. package/dist/unpkg/prod/model-fragments.js +76 -0
  141. package/dist/unpkg/prod/model.js +593 -0
  142. package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  143. package/dist/unpkg/prod/schema-provider-DJtD_8jZ.js +1861 -0
  144. package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +215 -0
  145. package/dist/unpkg/prod/serializer/json-api.js +592 -0
  146. package/dist/unpkg/prod/serializer/json.js +4 -0
  147. package/dist/unpkg/prod/serializer/rest.js +1210 -0
  148. package/dist/unpkg/prod/serializer/transform.js +278 -0
  149. package/dist/unpkg/prod/serializer.js +248 -0
  150. package/dist/unpkg/prod/store.js +505 -0
  151. package/dist/unpkg/prod/util-DvanW33H.js +20 -0
  152. package/dist/unpkg/prod/utils-BhvS1iTS.js +8 -0
  153. package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +971 -0
  154. package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -0
  155. package/dist/unpkg/prod-deprecated/adapter/error.js +330 -0
  156. package/dist/unpkg/prod-deprecated/adapter/json-api.js +266 -0
  157. package/dist/unpkg/prod-deprecated/adapter/rest.js +1134 -0
  158. package/dist/unpkg/prod-deprecated/adapter.js +1219 -0
  159. package/dist/unpkg/prod-deprecated/compat/-private.js +1 -0
  160. package/dist/unpkg/prod-deprecated/compat/builders.js +210 -0
  161. package/dist/unpkg/prod-deprecated/compat/extensions.js +232 -0
  162. package/dist/unpkg/prod-deprecated/compat/utils.js +218 -0
  163. package/dist/unpkg/prod-deprecated/compat.js +727 -0
  164. package/dist/unpkg/prod-deprecated/errors-CdDaK81x.js +2317 -0
  165. package/dist/unpkg/prod-deprecated/hooks-yId87yyG.js +41 -0
  166. package/dist/unpkg/prod-deprecated/index.js +150 -0
  167. package/dist/unpkg/prod-deprecated/json-BWrZ5546.js +1243 -0
  168. package/dist/unpkg/prod-deprecated/model/-private.js +1 -0
  169. package/dist/unpkg/prod-deprecated/model/migration-support.js +563 -0
  170. package/dist/unpkg/prod-deprecated/model-for-CqXsIKws.js +221 -0
  171. package/dist/unpkg/prod-deprecated/model-fragments.js +76 -0
  172. package/dist/unpkg/prod-deprecated/model.js +596 -0
  173. package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  174. package/dist/unpkg/prod-deprecated/schema-provider-CjX55uSY.js +1904 -0
  175. package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +215 -0
  176. package/dist/unpkg/prod-deprecated/serializer/json-api.js +592 -0
  177. package/dist/unpkg/prod-deprecated/serializer/json.js +4 -0
  178. package/dist/unpkg/prod-deprecated/serializer/rest.js +1210 -0
  179. package/dist/unpkg/prod-deprecated/serializer/transform.js +278 -0
  180. package/dist/unpkg/prod-deprecated/serializer.js +248 -0
  181. package/dist/unpkg/prod-deprecated/store.js +505 -0
  182. package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +23 -0
  183. package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +11 -0
  184. package/logos/README.md +2 -2
  185. package/logos/logo-yellow-slab.svg +1 -0
  186. package/logos/word-mark-black.svg +1 -0
  187. package/logos/word-mark-white.svg +1 -0
  188. package/package.json +14 -6
  189. package/logos/NCC-1701-a-blue.svg +0 -4
  190. package/logos/NCC-1701-a-gold.svg +0 -4
  191. package/logos/NCC-1701-a-gold_100.svg +0 -1
  192. package/logos/NCC-1701-a-gold_base-64.txt +0 -1
  193. package/logos/NCC-1701-a.svg +0 -4
  194. package/logos/docs-badge.svg +0 -2
  195. package/logos/ember-data-logo-dark.svg +0 -12
  196. package/logos/ember-data-logo-light.svg +0 -12
  197. package/logos/social1.png +0 -0
  198. package/logos/social2.png +0 -0
  199. package/logos/warp-drive-logo-dark.svg +0 -4
  200. package/logos/warp-drive-logo-gold.svg +0 -4
@@ -10,11 +10,11 @@ A `BelongsToReference` is a low-level API that allows access
10
10
  and manipulation of a belongsTo relationship.
11
11
 
12
12
  It is especially useful when you're dealing with `async` relationships
13
- from `@ember-data/model` as it allows synchronous access to
13
+ from `@warp-drive/legacy/model` as it allows synchronous access to
14
14
  the relationship data if loaded, as well as APIs for loading, reloading
15
15
  the data or accessing available information without triggering a load.
16
16
 
17
- It may also be useful when using `sync` relationships with `@ember-data/model`
17
+ It may also be useful when using `sync` relationships with `@warp-drive/legacy/model`
18
18
  that need to be loaded/reloaded with more precise timing than marking the
19
19
  relationship as `async` and relying on autofetch would have allowed.
20
20
 
@@ -30,7 +30,6 @@ invalidate if the relationship state changes.
30
30
  References are "stable", meaning that multiple calls to retrieve the reference
31
31
  for a given relationship will always return the same HasManyReference.
32
32
 
33
- @class BelongsToReference
34
33
  @public
35
34
  */
36
35
  export default class BelongsToReference<
@@ -44,17 +43,11 @@ export default class BelongsToReference<
44
43
  /**
45
44
  * The field name on the parent record for this has-many relationship.
46
45
  *
47
- * @property key
48
- * @type {String}
49
- * @public
50
46
  */
51
47
  key: K;
52
48
  /**
53
49
  * The type of resource this relationship will contain.
54
50
  *
55
- * @property type
56
- * @type {String}
57
- * @public
58
51
  */
59
52
  type: TypeFromInstanceOrString<Related>;
60
53
  ___token: object;
@@ -67,9 +60,6 @@ export default class BelongsToReference<
67
60
  * The identifier of the record that this reference refers to.
68
61
  * `null` if no related record is known.
69
62
  *
70
- * @property identifier
71
- * @type {ResourceKey | null}
72
- * @public
73
63
  */
74
64
  get identifier(): ResourceKey<TypeFromInstanceOrString<Related>> | null;
75
65
  /**
@@ -109,11 +99,11 @@ export default class BelongsToReference<
109
99
  ```
110
100
 
111
101
  @public
112
- @return {String} The id of the record in this belongsTo relationship.
102
+ @return The id of the record in this belongsTo relationship.
113
103
  */
114
104
  id(): string | null;
115
105
  /**
116
- The link Ember Data will use to fetch or reload this belongs-to
106
+ The link WarpDrive will use to fetch or reload this belongs-to
117
107
  relationship. By default it uses only the "related" resource linkage.
118
108
 
119
109
  Example
@@ -147,7 +137,7 @@ export default class BelongsToReference<
147
137
  ```
148
138
 
149
139
  @public
150
- @return {String} The link Ember Data will use to fetch or reload this belongs-to relationship.
140
+ @return The link WarpDrive will use to fetch or reload this belongs-to relationship.
151
141
  */
152
142
  link(): string | null;
153
143
  /**
@@ -194,7 +184,7 @@ export default class BelongsToReference<
194
184
  ```
195
185
 
196
186
  @public
197
- @return {Object} The meta information for the belongs-to relationship.
187
+ @return The meta information for the belongs-to relationship.
198
188
  */
199
189
  meta(): Meta | null;
200
190
  _resource(): SingleResourceRelationship<ResourceKey<TypeFromInstance<Related>>>;
@@ -206,7 +196,7 @@ export default class BelongsToReference<
206
196
  Example
207
197
 
208
198
  ```js [app/models/post.js]
209
- import Model, { hasMany } from '@ember-data/model';
199
+ import Model, { hasMany } from '@warp-drive/legacy/model';
210
200
 
211
201
  export default class PostModel extends Model {
212
202
  @hasMany('comment', { async: true, inverse: null }) comments;
@@ -237,7 +227,7 @@ export default class BelongsToReference<
237
227
  ```
238
228
 
239
229
  @public
240
- @return {String} The name of the remote type. This should either be `link` or `id`
230
+ @return The name of the remote type. This should either be `link` or `id`
241
231
  */
242
232
  remoteType(): "link" | "id";
243
233
  /**
@@ -328,9 +318,9 @@ export default class BelongsToReference<
328
318
  forcing the load of all of the associated record.
329
319
 
330
320
  @public
331
- @param {Object} doc a JSONAPI document object describing the new value of this relationship.
332
- @param {Boolean} [skipFetch] if `true`, do not attempt to fetch unloaded records
333
- @return {Promise<OpaqueRecordInstance | null | void>}
321
+ @param doc a JSONAPI document object describing the new value of this relationship.
322
+ @param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
323
+ @return a promise that resolves with the record in this belongs-to relationship after the push has completed.
334
324
  */
335
325
  push(doc: SingleResourceDocument, skipFetch?: boolean): Promise<Related | null | void>;
336
326
  /**
@@ -380,7 +370,7 @@ export default class BelongsToReference<
380
370
  ```
381
371
 
382
372
  @public
383
- @return {Model} the record in this relationship
373
+ @return the record in this relationship
384
374
  */
385
375
  value(): Related | null;
386
376
  /**
@@ -430,7 +420,7 @@ export default class BelongsToReference<
430
420
  });
431
421
  ```
432
422
  ```js [app/adapters/user.js]
433
- import Adapter from '@ember-data/adapter';
423
+ import Adapter from '@warp-drive/legacy/adapter';
434
424
 
435
425
  export default class UserAdapter extends Adapter {
436
426
  findRecord(store, type, id, snapshot) {
@@ -441,13 +431,13 @@ export default class BelongsToReference<
441
431
  ```
442
432
 
443
433
  @public
444
- @param {Object} options the options to pass in.
445
- @return {Promise} a promise that resolves with the record in this belongs-to relationship.
434
+ @param options the options to pass in.
435
+ @return a promise that resolves with the record in this belongs-to relationship.
446
436
  */
447
437
  load(options?: Record<string, unknown>): Promise<Related | null>;
448
438
  /**
449
439
  Triggers a reload of the value in this relationship. If the
450
- remoteType is `"link"` Ember Data will use the relationship link to
440
+ remoteType is `"link"` WarpDrive will use the relationship link to
451
441
  reload the relationship. Otherwise it will reload the record by its
452
442
  id.
453
443
 
@@ -491,8 +481,8 @@ export default class BelongsToReference<
491
481
  ```
492
482
 
493
483
  @public
494
- @param {Object} options the options to pass in.
495
- @return {Promise} a promise that resolves with the record in this belongs-to relationship after the reload has completed.
484
+ @param options the options to pass in.
485
+ @return a promise that resolves with the record in this belongs-to relationship after the reload has completed.
496
486
  */
497
487
  reload(options?: Record<string, unknown>): Promise<Related | null>;
498
488
  }
@@ -19,11 +19,11 @@ A `HasManyReference` is a low-level API that allows access
19
19
  and manipulation of a hasMany relationship.
20
20
 
21
21
  It is especially useful when you're dealing with `async` relationships
22
- from `@ember-data/model` as it allows synchronous access to
22
+ from `@warp-drive/legacy/model` as it allows synchronous access to
23
23
  the relationship data if loaded, as well as APIs for loading, reloading
24
24
  the data or accessing available information without triggering a load.
25
25
 
26
- It may also be useful when using `sync` relationships with `@ember-data/model`
26
+ It may also be useful when using `sync` relationships with `@warp-drive/legacy/model`
27
27
  that need to be loaded/reloaded with more precise timing than marking the
28
28
  relationship as `async` and relying on autofetch would have allowed.
29
29
 
@@ -119,7 +119,7 @@ export default class HasManyReference<
119
119
  ```
120
120
 
121
121
  @public
122
- @return {String} The name of the remote type. This should either be `link` or `ids`
122
+ @return The name of the remote type. This should either be `link` or `ids`
123
123
  */
124
124
  remoteType(): "link" | "ids";
125
125
  /**
@@ -154,11 +154,11 @@ export default class HasManyReference<
154
154
  ```
155
155
 
156
156
  @public
157
- @return {Array} The ids in this has-many relationship
157
+ @return The ids in this has-many relationship
158
158
  */
159
159
  ids(): Array<string | null>;
160
160
  /**
161
- The link Ember Data will use to fetch or reload this belongs-to
161
+ The link WarpDrive will use to fetch or reload this belongs-to
162
162
  relationship. By default it uses only the "related" resource linkage.
163
163
 
164
164
  Example
@@ -192,7 +192,7 @@ export default class HasManyReference<
192
192
  ```
193
193
 
194
194
  @public
195
- @return {String} The link Ember Data will use to fetch or reload this belongs-to relationship.
195
+ @return The link WarpDrive will use to fetch or reload this belongs-to relationship.
196
196
  */
197
197
  link(): string | null;
198
198
  /**
@@ -239,7 +239,7 @@ export default class HasManyReference<
239
239
  ```
240
240
 
241
241
  @public
242
- @return {Object|null} The meta information for the belongs-to relationship.
242
+ @return The meta information for the belongs-to relationship.
243
243
  */
244
244
  meta(): Meta | null;
245
245
  /**
@@ -335,9 +335,8 @@ export default class HasManyReference<
335
335
  forcing the load of all of the associated records.
336
336
 
337
337
  @public
338
- @param {Array|Object} doc a JSONAPI document object describing the new value of this relationship.
339
- @param {Boolean} [skipFetch] if `true`, do not attempt to fetch unloaded records
340
- @return {Promise<ManyArray | void>}
338
+ @param doc a JSONAPI document object describing the new value of this relationship.
339
+ @param skipFetch [optional] if `true`, do not attempt to fetch unloaded records
341
340
  */
342
341
  push(doc: ExistingResourceObject[] | CollectionResourceDocument, skipFetch?: boolean): Promise<ManyArray<Related> | void>;
343
342
  _isLoaded(): boolean;
@@ -379,7 +378,6 @@ export default class HasManyReference<
379
378
  ```
380
379
 
381
380
  @public
382
- @return {ManyArray}
383
381
  */
384
382
  value(): ManyArray<Related> | null;
385
383
  /**
@@ -441,8 +439,8 @@ export default class HasManyReference<
441
439
  ```
442
440
 
443
441
  @public
444
- @param {Object} options the options to pass in.
445
- @return {Promise} a promise that resolves with the ManyArray in
442
+ @param options the options to pass in.
443
+ @return a promise that resolves with the ManyArray in
446
444
  this has-many relationship.
447
445
  */
448
446
  load(options?: BaseFinderOptions): Promise<ManyArray<Related>>;
@@ -492,8 +490,8 @@ export default class HasManyReference<
492
490
  ```
493
491
 
494
492
  @public
495
- @param {Object} options the options to pass in.
496
- @return {Promise} a promise that resolves with the ManyArray in this has-many relationship.
493
+ @param options the options to pass in.
494
+ @return a promise that resolves with the ManyArray in this has-many relationship.
497
495
  */
498
496
  reload(options?: BaseFinderOptions): Promise<ManyArray<Related>>;
499
497
  }
@@ -7,7 +7,7 @@ import type { ResourceKey } from "@warp-drive/core/types/identifier";
7
7
  import type { ObjectValue } from "@warp-drive/core/types/json/raw";
8
8
  import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
9
9
  import type { Derivation, HashFn, Transformation } from "@warp-drive/core/types/schema/concepts";
10
- import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyResourceSchema, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
10
+ import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyResourceSchema, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
11
11
  import type { WithPartial } from "@warp-drive/core/types/utils";
12
12
  import type { Snapshot } from "../compat/-private.js";
13
13
  import type { MinimalLegacyRecord } from "./-private/model-methods.js";
@@ -56,14 +56,14 @@ interface LegacyModeRecord<T extends TypedRecordInstance> {
56
56
  }
57
57
  /**
58
58
  * A Type utility that enables quickly adding type information for the fields
59
- * defined by `import { withDefaults } from '@ember-data/model/migration-support'`.
59
+ * defined by `import { withDefaults } from '@warp-drive/legacy/model/migration-support'`.
60
60
  *
61
61
  * Example:
62
62
  *
63
63
  * ```ts
64
- * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
65
- * import { Type } from '@warp-drive/core-types/symbols';
66
- * import type { HasMany } from '@ember-data/model';
64
+ * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';
65
+ * import { Type } from '@warp-drive/core/types/symbols';
66
+ * import type { HasMany } from '@@warp-drive/legacy/model';
67
67
  *
68
68
  * export const UserSchema = withDefaults({
69
69
  * type: 'user',
@@ -99,14 +99,14 @@ export type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;
99
99
  /**
100
100
  * A function which adds the necessary fields to a schema and marks it as
101
101
  * being in LegacyMode. This is used to support the legacy features of
102
- * @ember-data/model while migrating to WarpDrive.
102
+ * @warp-drive/legacy/model while migrating to WarpDrive.
103
103
  *
104
104
  * Example:
105
105
  *
106
106
  * ```ts
107
- * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
108
- * import { Type } from '@warp-drive/core-types/symbols';
109
- * import type { HasMany } from '@ember-data/model';
107
+ * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';
108
+ * import { Type } from '@warp-drive/core/types/symbols';
109
+ * import type { HasMany } from '@warp-drive/legacy/model';
110
110
  *
111
111
  * export const UserSchema = withDefaults({
112
112
  * type: 'user',
@@ -141,26 +141,42 @@ export type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;
141
141
  * it requires with the schema service.
142
142
  *
143
143
  * ```ts
144
- * import { registerDerivations } from '@ember-data/model/migration-support';
144
+ * import { registerDerivations } from '@warp-drive/legacy/model/migration-support';
145
145
  *
146
146
  * registerDerivations(schema);
147
147
  * ```
148
148
  *
149
- * @param {LegacyResourceSchema} schema The schema to add legacy support to.
150
- * @return {LegacyResourceSchema} The schema with legacy support added.
149
+ * @param schema The schema to add legacy support to.
150
+ * @return The schema with legacy support added.
151
151
  * @public
152
152
  */
153
153
  export declare function withDefaults(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): LegacyResourceSchema;
154
- export declare function withRestoredDeprecatedModelRequestBehaviors(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): LegacyResourceSchema;
155
154
  /**
156
- * A function which registers the necessary derivations to support
157
- * the LegacyMode features of @ember-data/model while migrating to WarpDrive.
155
+ * Adds the necessasary fields to the schema for supporting
156
+ * the deprecated request methods on LegacyMode schemas.
158
157
  *
159
- * This must be called in order to use the fields added by:
158
+ * Use this instead of `withDefaults` to add the fields
159
+ * and behaviors necessary to support Model-Like capabilities.
160
160
  *
161
161
  * ```ts
162
- * import { withDefaults } from '@ember-data/model/migration-support';
162
+ * import { withRestoredDeprecatedModelRequestBehaviors } from '@warp-drive/legacy/model/migration-support';
163
+ *
164
+ * export const UserSchema = withRestoredDeprecatedModelRequestBehaviors({
165
+ * type: 'user',
166
+ * fields: [
167
+ * { name: 'firstName', kind: 'attribute' },
168
+ * { name: 'lastName', kind: 'attribute' },
169
+ * ]
170
+ * });
163
171
  * ```
172
+ */
173
+ export declare function withRestoredDeprecatedModelRequestBehaviors(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): LegacyResourceSchema;
174
+ /**
175
+ * A function which registers the necessary derivations to support
176
+ * the LegacyMode features of @warp-drive/legacy/model while migrating to WarpDrive.
177
+ *
178
+ * This must be called in order to use the fields added by {@link withDefaults} or
179
+ * {@link withRestoredDeprecatedModelRequestBehaviors}.
164
180
  *
165
181
  * @param schema The schema service to register the derivations with.
166
182
  * @public
@@ -180,8 +196,8 @@ export declare function registerDerivations(schema: SchemaService): void;
180
196
  * provide their own schema information to the application.
181
197
  *
182
198
  * ```ts
183
- * import { DelegatingSchemaService } from '@ember-data/model/migration-support';
184
- * import { SchemaService } from '@warp-drive/schema-record';
199
+ * import { DelegatingSchemaService } from '@warp-drive/legacy/model/migration-support';
200
+ * import { SchemaService } from '@warp-drive/core/reactive';
185
201
  *
186
202
  * class AppStore extends Store {
187
203
  * createSchemaService() {
@@ -222,6 +238,9 @@ export declare class DelegatingSchemaService implements SchemaService {
222
238
  fields(resource: ResourceKey | {
223
239
  type: string;
224
240
  }): Map<string, FieldSchema>;
241
+ cacheFields?(resource: {
242
+ type: string;
243
+ }): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
225
244
  transformation(field: GenericField | ObjectField | ArrayField | {
226
245
  type: string;
227
246
  }): Transformation;
@@ -243,6 +262,10 @@ export declare class DelegatingSchemaService implements SchemaService {
243
262
  FM extends ObjectValue | null
244
263
  >(derivation: Derivation<R, T, FM>): void;
245
264
  registerHashFn(hashFn: HashFn): void;
265
+ CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: {
266
+ kind: "object" | "array";
267
+ name: string;
268
+ }): boolean;
246
269
  CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
247
270
  CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: ResourceKey | {
248
271
  type: string;
@@ -0,0 +1,16 @@
1
+ import type { Fragment } from "./fragment.js";
2
+ export declare class FragmentArray<T extends Fragment> {
3
+ isDestroying: boolean;
4
+ isDestroyed: boolean;
5
+ get hasDirtyAttributes(): boolean;
6
+ addFragment(fragment?: T): Fragment[] | undefined;
7
+ createFragment(fragment?: T): Fragment | undefined;
8
+ removeFragment(fragment?: T): void;
9
+ rollbackAttributes(): void;
10
+ }
11
+ export declare const FragmentArrayExtension: {
12
+ kind: "array";
13
+ name: "fragment-array";
14
+ features: typeof FragmentArray;
15
+ };
16
+ export default FragmentArrayExtension;
@@ -0,0 +1,15 @@
1
+ import type { PrivateReactiveResource } from "@warp-drive/core/reactive/-private";
2
+ export declare class Fragment {
3
+ isDestroying: boolean;
4
+ isDestroyed: boolean;
5
+ get hasDirtyAttributes(): boolean;
6
+ get isFragment(): boolean;
7
+ get $type(): string | null | undefined;
8
+ rollbackAttributes(this: PrivateReactiveResource): void;
9
+ }
10
+ export declare const FragmentExtension: {
11
+ kind: "object";
12
+ name: "fragment";
13
+ features: typeof Fragment;
14
+ };
15
+ export default FragmentExtension;
@@ -0,0 +1,20 @@
1
+ import type { Store } from "@warp-drive/core";
2
+ import type { ModelSchema } from "@warp-drive/core/types";
3
+ import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
4
+ import type { LegacyAttributeField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
5
+ type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
6
+ export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
7
+ export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
8
+ __store: Store;
9
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
10
+ constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string);
11
+ get fields(): Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
12
+ get attributes(): Map<KeyOrString<T>, LegacyAttributeField>;
13
+ get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField>;
14
+ eachAttribute<K extends KeyOrString<T>>(callback: (key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
15
+ eachRelationship<K extends KeyOrString<T>>(callback: (key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
16
+ eachTransformedAttribute<K extends KeyOrString<T>>(callback: (key: K, type: string | null) => void, binding?: T): void;
17
+ }
18
+ export declare function fragmentsModelFor<T extends TypedRecordInstance>(this: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
19
+ export declare const modelFor: typeof fragmentsModelFor;
20
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { WithArrayLike, WithEmberObject } from "../compat/extensions.js";
2
+ import type { Fragment } from "./extensions/fragment.js";
3
+ import type { FragmentArray } from "./extensions/fragment-array.js";
4
+ export type WithFragment<T> = T & WithEmberObject<T> & Fragment;
5
+ export type WithFragmentArray<T extends Fragment> = T & WithArrayLike<T> & FragmentArray<T>;
@@ -0,0 +1,9 @@
1
+ import type ApplicationInstance from "@ember/application/instance";
2
+ import type { SchemaService } from "@warp-drive/core/types";
3
+ export declare function registerFragmentExtensions(schema: SchemaService): void;
4
+ export declare function initialize(application: ApplicationInstance): void;
5
+ declare const _default: {
6
+ name: string;
7
+ initialize: (application: ApplicationInstance) => void;
8
+ };
9
+ export default _default;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Used as a helper to setup the relevant parts of an array
3
+ * schema and add extensions etc.
4
+ *
5
+ * @param arrayName The name of the array
6
+ * @returns The schema for an array
7
+ */
8
+ export declare function withArrayDefaults<ArrayName extends string>(arrayName: ArrayName): {
9
+ kind: "array";
10
+ name: ArrayName;
11
+ type: `array:${string}`;
12
+ options: {
13
+ arrayExtensions: string[];
14
+ };
15
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Used as a helper to setup the relevant parts of a fragment-array
3
+ * schema and add extensions etc.
4
+ *
5
+ * @param fragmentArrayType The type of the fragment-array
6
+ * @param fragmentArrayName The name of the fragment-array
7
+ * @returns The schema for a fragment-array
8
+ */
9
+ export declare function withFragmentArrayDefaults<
10
+ FragmentArrayType extends string,
11
+ FragmentArrayName extends string
12
+ >(fragmentArrayType: FragmentArrayType, fragmentArrayName?: FragmentArrayName): {
13
+ kind: "schema-array";
14
+ type: `fragment:${string}`;
15
+ name: string;
16
+ options: {
17
+ arrayExtensions: string[];
18
+ defaultValue: boolean;
19
+ };
20
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Used as a helper to setup the relevant parts of a fragment schema
3
+ * and add extensions etc.
4
+ *
5
+ * @param fragmentType The type of the fragment
6
+ * @param fragmentName The optional name of the fragment. If not provided, it will default to the fragmentType.
7
+ * @returns The schema for a fragment
8
+ */
9
+ export declare function withFragmentDefaults<
10
+ FragmentType extends string,
11
+ FragmentName extends string
12
+ >(fragmentType: FragmentType, fragmentName?: FragmentName): {
13
+ kind: "schema-object";
14
+ type: `fragment:${FragmentType}`;
15
+ name: FragmentType | FragmentName;
16
+ options: {
17
+ objectExtensions: string[];
18
+ };
19
+ };
@@ -0,0 +1,3 @@
1
+ import type { LegacyResourceSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
2
+ import type { WithPartial } from "@warp-drive/core/types/utils";
3
+ export declare function withLegacy(schema: WithPartial<LegacyResourceSchema, "legacy" | "identity">): ResourceSchema;
@@ -0,0 +1,9 @@
1
+ export { withArrayDefaults } from "./model-fragments/utilities/with-array-defaults.js";
2
+ export { withFragmentDefaults } from "./model-fragments/utilities/with-fragment-defaults.js";
3
+ export { withFragmentArrayDefaults } from "./model-fragments/utilities/with-fragment-array-defaults.js";
4
+ export { withLegacy } from "./model-fragments/utilities/with-legacy.js";
5
+ export { registerFragmentExtensions } from "./model-fragments/instance-initializers/fragment-extensions.js";
6
+ export { modelFor } from "./model-fragments/hooks/model-for.js";
7
+ export { FragmentArray, FragmentArrayExtension } from "./model-fragments/extensions/fragment-array.js";
8
+ export { Fragment, FragmentExtension } from "./model-fragments/extensions/fragment.js";
9
+ export type { WithFragment, WithFragmentArray } from "./model-fragments/index.js";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This package provides a Presentation Model for resource data in an WarpDrive Cache.
3
3
  *
4
- * Models are defined as classes extending from `import Model from '@ember-data/model';` and the
4
+ * Models are defined as classes extending from `import Model from '@warp-drive/legacy/model';` and the
5
5
  * attributes and relationships on these classes are parsed at runtime to supply static "schema"
6
6
  * to WarpDrive's SchemaService.
7
7
  *
@@ -17,7 +17,7 @@ the resource data for a given `type` and `id`.
17
17
  ### Defining a Model
18
18
 
19
19
  ```js [app/models/person.js]
20
- import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
20
+ import Model, { attr, belongsTo, hasMany } from '@warp-drive/legacy/model';
21
21
 
22
22
  export default class PersonModel extends Model {
23
23
  @attr name;
@@ -14,7 +14,7 @@ Note also that this mixin does not work with JSONAPISerializer because the JSON:
14
14
  Below is an example of a per-type serializer (`post` type).
15
15
 
16
16
  ```js [app/serializers/post.js]
17
- import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
17
+ import RESTSerializer, { EmbeddedRecordsMixin } from '@warp-drive/legacy/serializer/rest';
18
18
 
19
19
  export default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {
20
20
  attrs = {
@@ -10,13 +10,14 @@ records when they are transferred in and out of an external source.
10
10
  This process involves normalizing property names, transforming
11
11
  attribute values and serializing relationships.
12
12
 
13
- `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the
14
- serializer recommended by Ember Data.
13
+ `JSONAPISerializer` supports the http://jsonapi.org/ spec, though
14
+ even compliant {json:api} servers may find writing an application
15
+ specific serializer better suited to their needs and more performant.
15
16
 
16
17
  This serializer normalizes a JSON API payload that looks like:
17
18
 
18
19
  ```js [app/models/player.js]
19
- import Model, { attr, belongsTo } from '@ember-data/model';
20
+ import Model, { attr, belongsTo } from '@warp-drive/legacy/model';
20
21
 
21
22
  export default class Player extends Model {
22
23
  @attr('string') name;
@@ -27,7 +28,7 @@ export default class Player extends Model {
27
28
  ```
28
29
 
29
30
  ```js [app/models/club.js]
30
- import Model, { attr, hasMany } from '@ember-data/model';
31
+ import Model, { attr, hasMany } from '@warp-drive/legacy/model';
31
32
 
32
33
  export default class Club extends Model {
33
34
  @attr('string') name;
@@ -80,7 +81,7 @@ export default class Club extends Model {
80
81
  }
81
82
  ```
82
83
 
83
- to the format that the Ember Data store expects.
84
+ to the format that the JSONAPICache expects.
84
85
 
85
86
  ### Customizing meta
86
87
 
@@ -92,7 +93,7 @@ below shows how this could be done using `normalizeArrayResponse` and
92
93
  `extractRelationship`.
93
94
 
94
95
  ```js [app/serializers/application.js]
95
- import JSONAPISerializer from '@ember-data/serializer/json-api';
96
+ import JSONAPISerializer from '@warp-drive/legacy/serializer/json-api';
96
97
 
97
98
  export default class ApplicationSerializer extends JSONAPISerializer {
98
99
  normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
@@ -18,7 +18,7 @@ not support the http://jsonapi.org/ spec.
18
18
  For example, given the following `User` model and JSON payload:
19
19
 
20
20
  ```js [app/models/user.js]
21
- import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
21
+ import Model, { attr, belongsTo, hasMany } from '@warp-drive/legacy/model';
22
22
 
23
23
  export default class UserModel extends Model {
24
24
  @hasMany('user') friends;
@@ -39,8 +39,8 @@ house: '/houses/lefkada'
39
39
  }
40
40
  ```
41
41
 
42
- `JSONSerializer` will normalize the JSON payload to the JSON API format that the
43
- Ember Data store expects.
42
+ `JSONSerializer` will normalize the JSON payload to the {json:api} format that the
43
+ JSONAPICache uses to cache data in the Store.
44
44
 
45
45
  You can customize how JSONSerializer processes its payload by passing options in
46
46
  the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks: