@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
@@ -21,7 +21,6 @@ application might expect these methods to be called.
21
21
 
22
22
  Methods that are not required are marked as **optional**.
23
23
 
24
- @class (Interface) Serializer
25
24
  @public
26
25
  */
27
26
  export interface MinimumSerializerInterface {
@@ -41,23 +40,22 @@ export interface MinimumSerializerInterface {
41
40
  * and [Resource Identifier Objects](https://jsonapi.org/format/#document-resource-identifier-objects)
42
41
  *
43
42
  * @public
44
- * @param {Store} store The store service that initiated the request being normalized
45
- * @param {ModelSchema} schema An object with methods for accessing information about
43
+ * @param store The store service that initiated the request being normalized
44
+ * @param schema An object with methods for accessing information about
46
45
  * the type, attributes and relationships of the primary type associated with the request.
47
- * @param {JSONObject} rawPayload The raw JSON response data returned from an API request.
46
+ * @param rawPayload The raw JSON response data returned from an API request.
48
47
  * This correlates to the value the promise returned by the adapter method that performed
49
48
  * the request resolved to.
50
- * @param {string|null} id For a findRecord request, this is the id initially provided
49
+ * @param id For a findRecord request, this is the id initially provided
51
50
  * in the call to store.findRecord. Else this value is null.
52
- * @param {'findRecord' | 'queryRecord' | 'findAll' | 'findBelongsTo' | 'findHasMany' | 'findMany' | 'query' | 'createRecord' | 'deleteRecord' | 'updateRecord'} requestType The
53
- * type of request the Adapter had been asked to perform.
51
+ * @param requestType The type of request the Adapter had been asked to perform.
54
52
  *
55
- * @return {JsonApiDocument} a document following the structure of a JSON:API Document.
53
+ * @return a document following the structure of a [{json:api} Document](https://jsonapi.org/format/#document-structure).
56
54
  */
57
55
  normalizeResponse(store: Store, schema: ModelSchema, rawPayload: AdapterPayload, id: string | null, requestType: "findRecord" | "queryRecord" | "findAll" | "findBelongsTo" | "findHasMany" | "findMany" | "query" | "createRecord" | "deleteRecord" | "updateRecord"): JsonApiDocument;
58
56
  /**
59
57
  * This method is responsible for serializing an individual record
60
- * via a [Snapshot](Snapshot) into the format expected by the API.
58
+ * via a {@link Snapshot} into the format expected by the API.
61
59
  *
62
60
  * This method is called by `snapshot.serialize()`.
63
61
  *
@@ -68,8 +66,7 @@ export interface MinimumSerializerInterface {
68
66
  * is not implemented.
69
67
  *
70
68
  * @public
71
- * @param {Snapshot} snapshot A Snapshot for the record to serialize
72
- * @param {Object} [options]
69
+ * @param snapshot A Snapshot for the record to serialize
73
70
  */
74
71
  serialize(snapshot: Snapshot, options?: SerializerOptions): ObjectValue;
75
72
  /**
@@ -116,14 +113,12 @@ export interface MinimumSerializerInterface {
116
113
  *
117
114
  * @public
118
115
  * @optional
119
- * @param {ModelSchema} schema An object with methods for accessing information about
116
+ * @param schema An object with methods for accessing information about
120
117
  * the type, attributes and relationships of the primary type associated with the request.
121
- * @param {JSONObject} rawPayload Some raw JSON data to be normalized into a JSON:API Resource.
122
- * @param {String} [prop] When called by the EmbeddedRecordsMixin this param will be the
118
+ * @param rawPayload Some raw JSON data to be normalized into a JSON:API Resource.
119
+ * @param prop When called by the EmbeddedRecordsMixin this param will be the
123
120
  * property at which the object provided as rawPayload was found.
124
- * @return {SingleResourceDocument} A JSON:API Document
125
- * containing a single JSON:API Resource
126
- * as its primary data.
121
+ * @return A JSON:API Document containing a single JSON:API Resource as its primary data.
127
122
  */
128
123
  normalize?(schema: ModelSchema, rawPayload: ObjectValue, prop?: string): SingleResourceDocument;
129
124
  /**
@@ -159,11 +154,9 @@ export interface MinimumSerializerInterface {
159
154
  * @optional
160
155
  * @param hash A top most object of the request payload onto
161
156
  * which to append the serialized record
162
- * @param {ModelSchema} schema An object with methods for accessing information about
157
+ * @param schema An object with methods for accessing information about
163
158
  * the type, attributes and relationships of the primary type associated with the request.
164
- * @param {Snapshot} snapshot A Snapshot for the record to serialize
165
- * @param [options]
166
- * @return {void}
159
+ * @param snapshot A Snapshot for the record to serialize
167
160
  */
168
161
  serializeIntoHash?(hash: object, schema: ModelSchema, snapshot: Snapshot, options?: SerializerOptions): void;
169
162
  /**
@@ -202,10 +195,9 @@ export interface MinimumSerializerInterface {
202
195
  *
203
196
  * @public
204
197
  * @optional
205
- * @param {Store} store The store service that initiated the request being normalized
206
- * @param {Object} rawPayload The raw JSON response data returned from an API request.
198
+ * @param store The store service that initiated the request being normalized
199
+ * @param rawPayload The raw JSON response data returned from an API request.
207
200
  * This JSON should be in the API format expected by the serializer.
208
- * @return {void}
209
201
  */
210
202
  pushPayload?(store: Store, rawPayload: ObjectValue): void;
211
203
  /**
@@ -4,7 +4,7 @@ type Reporter = (type: "formatted-id" | "formatted-type", actual: unknown, expec
4
4
  * changes during normalization. This is useful for instrumenting
5
5
  * to discover places where usage in the app is not consistent.
6
6
  *
7
- * @param method a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
7
+ * @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
8
8
  * @public
9
9
  */
10
10
  export declare function configureMismatchReporter(fn: Reporter): void;
@@ -13,7 +13,7 @@ export declare function configureMismatchReporter(fn: Reporter): void;
13
13
  * fails validation. This is useful for instrumenting
14
14
  * to discover places where usage in the app is not consistent.
15
15
  *
16
- * @param method a function which takes a message and a condition
16
+ * @param fn - a function which takes a message and a condition
17
17
  * @public
18
18
  */
19
19
  export declare function configureAssertFn(fn: (message: string, condition: unknown) => void): void;
@@ -27,7 +27,7 @@ export declare function configureAssertFn(fn: (message: string, condition: unkno
27
27
  * the configured mismatch reporter and assert functions will
28
28
  * be called.
29
29
  *
30
- * @param method a function which takes a string and returns a string
30
+ * @param fn - a function which takes a string and returns a string
31
31
  * @public
32
32
  */
33
33
  export declare function configureTypeNormalization(fn: (type: string) => string): void;
@@ -56,8 +56,8 @@ export declare function configureTypeNormalization(fn: (type: string) => string)
56
56
  * formattedType('PostComment'); // => 'post-comment'
57
57
  * ```
58
58
  *
59
- * @param {String} type the potentially un-normalized type
60
- * @return {String} the normalized type
59
+ * @param type the potentially un-normalized type
60
+ * @return the normalized type
61
61
  * @public
62
62
  */
63
63
  export declare function formattedType<T extends string>(type: T | string): T;
@@ -77,8 +77,8 @@ export declare function formattedType<T extends string>(type: T | string): T;
77
77
  * formattedId(null); // => null
78
78
  * ```
79
79
  *
80
- * @param {String | Number | null} id the potentially un-normalized id
81
- * @return {String | null} the normalized id
80
+ * @param id the potentially un-normalized id
81
+ * @return the normalized id
82
82
  * @public
83
83
  */
84
84
  export declare function formattedId(id: string | number): string;
@@ -106,9 +106,9 @@ export declare function expectId(id: null): never;
106
106
  * isEquivType('posts', null); // false
107
107
  * ```
108
108
  *
109
- * @param {String} expected a potentially unnormalized type to match against
110
- * @param {String} actual a potentially unnormalized type to match against
111
- * @return {Boolean} true if the types are equivalent
109
+ * @param expected a potentially unnormalized type to match against
110
+ * @param actual a potentially unnormalized type to match against
111
+ * @return true if the types are equivalent
112
112
  * @public
113
113
  */
114
114
  export declare function isEquivType(expected: string, actual: string): boolean;
@@ -128,9 +128,9 @@ export declare function isEquivType(expected: string, actual: string): boolean;
128
128
  * isEquivId(1, null); // false
129
129
  * ```
130
130
  *
131
- * @param {string | number} expected a potentially un-normalized id to match against
132
- * @param {string | number} actual a potentially un-normalized id to match against
133
- * @return {Boolean} true if the ids are equivalent
131
+ * @param expected a potentially un-normalized id to match against
132
+ * @param actual a potentially un-normalized id to match against
133
+ * @return true if the ids are equivalent
134
134
  * @public
135
135
  */
136
136
  export declare function isEquivId(expected: string | number, actual: string | number | null): boolean;
@@ -6,7 +6,18 @@ import type { AdapterPayload, MinimumAdapterInterface } from "./compat/legacy-ne
6
6
  import type { MinimumSerializerInterface, SerializerOptions } from "./compat/legacy-network-handler/minimum-serializer-interface.js";
7
7
  export { LegacyNetworkHandler } from "./compat/legacy-network-handler/legacy-network-handler.js";
8
8
  export type { MinimumAdapterInterface, MinimumSerializerInterface, SerializerOptions, AdapterPayload };
9
+ /**
10
+ * Extends the signature of {@link Store} with additional
11
+ * methods available when using the legacy network layer.
12
+ *
13
+ * @public
14
+ * @noInheritDoc
15
+ * @legacy
16
+ */
9
17
  export interface LegacyStoreCompat extends Store {
18
+ /**
19
+ * @private
20
+ */
10
21
  _fetchManager: FetchManager;
11
22
  adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
12
23
  adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
@@ -14,13 +25,22 @@ export interface LegacyStoreCompat extends Store {
14
25
  normalize(modelName: string, payload: ObjectValue): ObjectValue;
15
26
  pushPayload(modelName: string, payload: ObjectValue): void;
16
27
  serializeRecord(record: unknown, options?: SerializerOptions): unknown;
28
+ /**
29
+ * @private
30
+ */
17
31
  _adapterCache: Record<string, MinimumAdapterInterface & {
18
32
  store: Store;
19
33
  }>;
34
+ /**
35
+ * @private
36
+ */
20
37
  _serializerCache: Record<string, MinimumSerializerInterface & {
21
38
  store: Store;
22
39
  }>;
23
40
  }
41
+ /**
42
+ * @deprecated - use {@link LegacyStoreCompat} instead
43
+ */
24
44
  export type CompatStore = LegacyStoreCompat;
25
45
  /**
26
46
  Returns an instance of the adapter for a given type. For
@@ -53,8 +73,13 @@ to an instance of `JSONSerializer`.
53
73
  */
54
74
  export declare function serializerFor(this: Store, modelName: string): MinimumSerializerInterface | null;
55
75
  /**
56
- `normalize` converts a json payload into the normalized form that
57
- [push](../methods/push?anchor=push) expects.
76
+ `normalize` converts a json payload into the normalized form expected by
77
+ {@link Store.push | push} using the serializer specified by `modelName`
78
+
79
+ :::warning
80
+ Generally it would be better to invoke the serializer yourself directly,
81
+ or write a more specialized normalization utility.
82
+ :::
58
83
 
59
84
  Example
60
85
 
@@ -66,6 +91,7 @@ store.push(store.normalize(modelName, data));
66
91
  });
67
92
  ```
68
93
 
94
+ @legacy
69
95
  @public
70
96
  @param modelName The name of the model type for this payload
71
97
  @return The normalized payload
@@ -81,7 +107,7 @@ All objects should be in the format expected by the
81
107
  serializer.
82
108
 
83
109
  ```js [app/serializers/application.js]
84
- import RESTSerializer from '@ember-data/serializer/rest';
110
+ import RESTSerializer from '@warp-drive/legacy/serializer/rest';
85
111
 
86
112
  export default class ApplicationSerializer extends RESTSerializer;
87
113
  ```
@@ -106,13 +132,13 @@ Alternatively, `pushPayload` will accept a model type which
106
132
  will determine which serializer will process the payload.
107
133
 
108
134
  ```js [app/serializers/application.js]
109
- import RESTSerializer from '@ember-data/serializer/rest';
135
+ import RESTSerializer from '@warp-drive/legacy/serializer/rest';
110
136
 
111
137
  export default class ApplicationSerializer extends RESTSerializer;
112
138
  ```
113
139
 
114
140
  ```js [app/serializers/post.js]
115
- import JSONSerializer from '@ember-data/serializer/json';
141
+ import JSONSerializer from '@warp-drive/legacy/serializer/json';
116
142
 
117
143
  export default JSONSerializer;
118
144
  ```
@@ -3,11 +3,17 @@
3
3
  * @mergeModuleWith <project>
4
4
  */
5
5
  import { Store, type StoreSetupOptions } from "@warp-drive/core";
6
+ import type { CacheCapabilitiesManager } from "@warp-drive/core/types";
7
+ import type { Cache } from "@warp-drive/core/types/cache";
6
8
  import type { ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
7
- interface _LegacyStoreSetupOptions extends Omit<StoreSetupOptions, "schemas"> {
9
+ interface _LegacyStoreSetupOptions<T extends Cache> extends Omit<StoreSetupOptions<T>, "schemas"> {
8
10
  schemas?: Array<ResourceSchema | ObjectSchema>;
11
+ /**
12
+ * Whether to include support for ModelFragments migrations.
13
+ */
14
+ modelFragments?: boolean;
9
15
  }
10
- interface LegacyModelStoreSetupOptions extends _LegacyStoreSetupOptions {
16
+ export interface LegacyModelStoreSetupOptions<T extends Cache> extends _LegacyStoreSetupOptions<T> {
11
17
  /**
12
18
  * If true, it is presumed that no requests require use of the LegacyNetworkHandler
13
19
  * and associated adapters/serializer methods.
@@ -19,7 +25,7 @@ interface LegacyModelStoreSetupOptions extends _LegacyStoreSetupOptions {
19
25
  */
20
26
  legacyRequests?: false;
21
27
  }
22
- interface LegacyModelAndNetworkStoreSetupOptions extends _LegacyStoreSetupOptions {
28
+ export interface LegacyModelAndNetworkStoreSetupOptions<T extends Cache> extends _LegacyStoreSetupOptions<T> {
23
29
  /**
24
30
  * If true, it is presumed that no requests require use of the LegacyNetworkHandler
25
31
  * and associated adapters/serializer methods.
@@ -31,7 +37,7 @@ interface LegacyModelAndNetworkStoreSetupOptions extends _LegacyStoreSetupOption
31
37
  */
32
38
  legacyRequests?: false;
33
39
  }
34
- interface LegacyModelAndNetworkAndRequestStoreSetupOptions extends _LegacyStoreSetupOptions {
40
+ export interface LegacyModelAndNetworkAndRequestStoreSetupOptions<T extends Cache> extends _LegacyStoreSetupOptions<T> {
35
41
  /**
36
42
  * If true, it is presumed that no requests require use of the LegacyNetworkHandler
37
43
  * and associated adapters/serializer methods.
@@ -43,11 +49,22 @@ interface LegacyModelAndNetworkAndRequestStoreSetupOptions extends _LegacyStoreS
43
49
  */
44
50
  legacyRequests: true;
45
51
  }
46
- export type LegacyStoreSetupOptions = LegacyModelStoreSetupOptions | LegacyModelAndNetworkStoreSetupOptions | LegacyModelAndNetworkAndRequestStoreSetupOptions;
52
+ export type LegacyStoreSetupOptions<T extends Cache = Cache> = LegacyModelStoreSetupOptions<T> | LegacyModelAndNetworkStoreSetupOptions<T> | LegacyModelAndNetworkAndRequestStoreSetupOptions<T>;
53
+ export declare class ConfiguredStore<T extends {
54
+ cache: Cache;
55
+ }> extends Store {
56
+ createCache(capabilities: CacheCapabilitiesManager): T["cache"];
57
+ }
47
58
  /**
48
59
  * Use the legacy store with the given options.
49
60
  */
50
- export declare function useLegacyStore(options: LegacyModelStoreSetupOptions, StoreKlass?: typeof Store): typeof Store;
51
- export declare function useLegacyStore(options: LegacyModelAndNetworkStoreSetupOptions, StoreKlass?: typeof Store): typeof Store;
52
- export declare function useLegacyStore(options: LegacyModelAndNetworkAndRequestStoreSetupOptions, StoreKlass?: typeof Store): typeof Store;
61
+ export declare function useLegacyStore<T extends Cache>(options: LegacyModelStoreSetupOptions<T>, StoreKlass?: typeof Store): typeof ConfiguredStore<{
62
+ cache: T;
63
+ }>;
64
+ export declare function useLegacyStore<T extends Cache>(options: LegacyModelAndNetworkStoreSetupOptions<T>, StoreKlass?: typeof Store): typeof ConfiguredStore<{
65
+ cache: T;
66
+ }>;
67
+ export declare function useLegacyStore<T extends Cache>(options: LegacyModelAndNetworkAndRequestStoreSetupOptions<T>, StoreKlass?: typeof Store): typeof ConfiguredStore<{
68
+ cache: T;
69
+ }>;
53
70
  export {};
@@ -38,8 +38,8 @@ export declare class LegacySupport {
38
38
  _updatePromiseProxyFor(kind: "belongsTo", key: string, args: {
39
39
  promise: Promise<OpaqueRecordInstance | null>;
40
40
  }): PromiseBelongsTo;
41
- referenceFor(kind: "belongsTo", name: string): BelongsToReference;
42
- referenceFor(kind: "hasMany", name: string): HasManyReference;
41
+ referenceFor(kind: "belongsTo", key: string): BelongsToReference;
42
+ referenceFor(kind: "hasMany", key: string): HasManyReference;
43
43
  _findHasManyByJsonApiResource(resource: CollectionResourceRelationship, parentIdentifier: ResourceKey, relationship: CollectionEdge, options?: BaseFinderOptions): Promise<void | unknown[]> | void;
44
44
  _findBelongsToByJsonApiResource(resource: SingleResourceRelationship, parentIdentifier: ResourceKey, relationship: ResourceEdge, options?: BaseFinderOptions): Promise<ResourceKey | null>;
45
45
  destroy(): void;
@@ -428,9 +428,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
428
428
  client. A record can also enter the empty state if the adapter is
429
429
  unable to locate the record.
430
430
 
431
- @property isEmpty
432
431
  @public
433
- @readonly
434
432
  */
435
433
  get isEmpty(): boolean;
436
434
  /**
@@ -439,9 +437,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
439
437
  data. It remains in this state until the adapter provides the
440
438
  requested data.
441
439
 
442
- @property isLoading
443
440
  @public
444
- @readonly
445
441
  */
446
442
  get isLoading(): boolean;
447
443
  /**
@@ -460,9 +456,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
460
456
  model.isLoaded;
461
457
  ```
462
458
 
463
- @property isLoaded
464
459
  @public
465
- @readonly
466
460
  */
467
461
  get isLoaded(): boolean;
468
462
  /**
@@ -485,9 +479,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
485
479
  ```
486
480
 
487
481
  @since 1.13.0
488
- @property hasDirtyAttributes
489
482
  @public
490
- @readonly
491
483
  */
492
484
  get hasDirtyAttributes(): boolean;
493
485
  /**
@@ -508,9 +500,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
508
500
  });
509
501
  ```
510
502
 
511
- @property isSaving
512
503
  @public
513
- @readonly
514
504
  */
515
505
  get isSaving(): boolean;
516
506
  /**
@@ -546,9 +536,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
546
536
  });
547
537
  ```
548
538
 
549
- @property isDeleted
550
539
  @public
551
- @readonly
552
540
  */
553
541
  get isDeleted(): boolean;
554
542
  /**
@@ -568,9 +556,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
568
556
  });
569
557
  ```
570
558
 
571
- @property isNew
572
559
  @public
573
- @readonly
574
560
  */
575
561
  get isNew(): boolean;
576
562
  /**
@@ -579,9 +565,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
579
565
  A record will be in the `valid` state when the adapter did not report any
580
566
  server-side validation failures.
581
567
 
582
- @property isValid
583
568
  @public
584
- @readonly
585
569
  */
586
570
  get isValid(): boolean;
587
571
  /**
@@ -600,9 +584,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
600
584
  record.dirtyType; // 'created'
601
585
  ```
602
586
 
603
- @property dirtyType
604
587
  @public
605
- @readonly
606
588
  */
607
589
  get dirtyType(): "created" | "updated" | "deleted" | "";
608
590
  /**
@@ -620,9 +602,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
620
602
  });
621
603
  ```
622
604
 
623
- @property isError
624
605
  @public
625
- @readonly
626
606
  */
627
607
  get isError(): boolean;
628
608
  set isError(v: boolean);
@@ -637,9 +617,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
637
617
  record.isReloading; // true
638
618
  ```
639
619
 
640
- @property isReloading
641
620
  @public
642
- @readonly
643
621
  */
644
622
  isReloading: boolean;
645
623
  /**
@@ -657,14 +635,12 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
657
635
  model.id; // '1'
658
636
  ```
659
637
 
660
- @property id
661
638
  @public
662
639
  */
663
640
  get id(): string | null;
664
641
  set id(id: string | null);
665
642
  toString(): string;
666
643
  /**
667
- @property currentState
668
644
  @private
669
645
  */
670
646
  get currentState(): RecordState;
@@ -672,9 +648,9 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
672
648
  /**
673
649
  The store service instance which created this record instance
674
650
 
675
- @property store
676
651
  @public
677
652
  */
653
+ store: Store;
678
654
  /**
679
655
  When the record is in the `invalid` state this object will contain
680
656
  any errors returned by the adapter. When present the errors hash
@@ -723,7 +699,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
723
699
  {{/each}}
724
700
  ```
725
701
 
726
- @property errors
727
702
  @public
728
703
  */
729
704
  get errors(): Errors;
@@ -731,7 +706,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
731
706
  This property holds the `AdapterError` object with which
732
707
  last adapter operation was rejected.
733
708
 
734
- @property adapterError
735
709
  @public
736
710
  */
737
711
  get adapterError(): unknown;
@@ -818,9 +792,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
818
792
  }
819
793
  });
820
794
  ```
821
- @property modelName
795
+
822
796
  @public
823
- @readonly
824
797
  */
825
798
  static modelName: string;
826
799
  /**
@@ -912,9 +885,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
912
885
  //=> [ { name: 'posts', kind: 'hasMany' } ]
913
886
  ```
914
887
 
915
- @property relationships
916
888
  @public
917
- @readonly
918
889
  */
919
890
  static get relationships(): Map<string, LegacyRelationshipField[]>;
920
891
  /**
@@ -945,9 +916,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
945
916
  //=> ['owner']
946
917
  ```
947
918
 
948
- @property relationshipNames
949
919
  @public
950
- @readonly
951
920
  */
952
921
  static get relationshipNames(): {
953
922
  hasMany: string[];
@@ -980,9 +949,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
980
949
  //=> ['user', 'post']
981
950
  ```
982
951
 
983
- @property relatedTypes
984
952
  @public
985
- @readonly
986
953
  */
987
954
  static get relatedTypes(): string[];
988
955
  /**
@@ -1015,9 +982,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1015
982
  //=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }
1016
983
  ```
1017
984
 
1018
- @property relationshipsByName
1019
985
  @public
1020
- @readonly
1021
986
  */
1022
987
  static get relationshipsByName(): Map<string, LegacyRelationshipField>;
1023
988
  static get relationshipsObject(): Record<string, LegacyRelationshipField>;
@@ -1056,9 +1021,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1056
1021
  // title, attribute
1057
1022
  ```
1058
1023
 
1059
- @property fields
1060
1024
  @public
1061
- @readonly
1062
1025
  */
1063
1026
  static get fields(): Map<string, "attribute" | "belongsTo" | "hasMany">;
1064
1027
  /**
@@ -1067,8 +1030,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1067
1030
  descriptor.
1068
1031
 
1069
1032
  @public
1070
- @param {Function} callback the callback to invoke
1071
- @param {any} binding the value to which the callback's `this` should be bound
1033
+ @param callback the callback to invoke
1034
+ @param binding the value to which the callback's `this` should be bound
1072
1035
  */
1073
1036
  static eachRelationship<
1074
1037
  T,
@@ -1081,8 +1044,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1081
1044
  with a model.
1082
1045
 
1083
1046
  @public
1084
- @param {Function} callback the callback to invoke
1085
- @param {any} binding the value to which the callback's `this` should be bound
1047
+ @param callback the callback to invoke
1048
+ @param binding the value to which the callback's `this` should be bound
1086
1049
  */
1087
1050
  static eachRelatedType<T>(callback: (this: T | undefined, type: string) => void, binding?: T): void;
1088
1051
  /**
@@ -1123,9 +1086,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1123
1086
  // birthday {type: "date", kind: 'attribute', options: Object, parentType: function, name: "birthday"}
1124
1087
  ```
1125
1088
 
1126
- @property attributes
1127
1089
  @public
1128
- @readonly
1129
1090
  */
1130
1091
  static get attributes(): Map<string, LegacyAttributeField>;
1131
1092
  /**
@@ -1160,9 +1121,7 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1160
1121
  // birthday date
1161
1122
  ```
1162
1123
 
1163
- @property transformedAttributes
1164
1124
  @public
1165
- @readonly
1166
1125
  */
1167
1126
  static get transformedAttributes(): Map<string, string>;
1168
1127
  /**
@@ -1204,8 +1163,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1204
1163
  ```
1205
1164
 
1206
1165
  @public
1207
- @param {Function} callback The callback to execute
1208
- @param {Object} [binding] the value to which the callback's `this` should be bound
1166
+ @param callback The callback to execute
1167
+ @param binding [optional] the value to which the callback's `this` should be bound
1209
1168
  */
1210
1169
  static eachAttribute<
1211
1170
  T,
@@ -1251,8 +1210,8 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
1251
1210
  ```
1252
1211
 
1253
1212
  @public
1254
- @param {Function} callback The callback to execute
1255
- @param {Object} [binding] the value to which the callback's `this` should be bound
1213
+ @param callback The callback to execute
1214
+ @param binding [optional] the value to which the callback's `this` should be bound
1256
1215
  */
1257
1216
  static eachTransformedAttribute<
1258
1217
  T,
@@ -22,7 +22,6 @@ In your JS code you should resolve the promise first.
22
22
  const comments = await post.comments;
23
23
  ```
24
24
 
25
- @class PromiseManyArray
26
25
  @public
27
26
  */
28
27
  export declare class PromiseManyArray<T = unknown> {
@@ -32,7 +31,6 @@ export declare class PromiseManyArray<T = unknown> {
32
31
  constructor(promise: Promise<ManyArray<T>>, content?: ManyArray<T>);
33
32
  /**
34
33
  * Retrieve the length of the content
35
- * @property length
36
34
  * @public
37
35
  */
38
36
  get length(): number;
@@ -50,39 +48,29 @@ export declare class PromiseManyArray<T = unknown> {
50
48
  /**
51
49
  * Reload the relationship
52
50
  * @public
53
- * @param options
54
- * @return
55
51
  */
56
52
  reload(options: Omit<BaseFinderOptions, "">): this;
57
53
  /**
58
54
  * Whether the loading promise is still pending
59
55
  *
60
- * @property isPending
61
- * @type {Boolean}
62
56
  * @public
63
57
  */
64
58
  isPending: boolean;
65
59
  /**
66
60
  * Whether the loading promise rejected
67
61
  *
68
- * @property isRejected
69
- * @type {Boolean}
70
62
  * @public
71
63
  */
72
64
  isRejected: boolean;
73
65
  /**
74
66
  * Whether the loading promise succeeded
75
67
  *
76
- * @property isFulfilled
77
- * @type {Boolean}
78
68
  * @public
79
69
  */
80
70
  isFulfilled: boolean;
81
71
  /**
82
72
  * Whether the loading promise completed (resolved or rejected)
83
73
  *
84
- * @property isSettled
85
- * @type {Boolean}
86
74
  * @public
87
75
  */
88
76
  isSettled: boolean;
@@ -95,28 +83,22 @@ export declare class PromiseManyArray<T = unknown> {
95
83
  /**
96
84
  * catch errors thrown by this promise
97
85
  * @public
98
- * @param callback
99
- * @return {Promise}
100
86
  */
101
87
  catch(cb: Parameters<Promise<ManyArray<T>>["catch"]>[0]): Promise<unknown>;
102
88
  /**
103
89
  * run cleanup after this promise completes
104
90
  *
105
91
  * @public
106
- * @param callback
107
- * @return {Promise}
108
92
  */
109
93
  finally(cb: Parameters<Promise<ManyArray<T>>["finally"]>[0]): Promise<unknown>;
110
94
  destroy(): void;
111
95
  /**
112
96
  * Retrieve the links for this relationship
113
- * @property links
114
97
  * @public
115
98
  */
116
99
  get links(): Links | null | undefined;
117
100
  /**
118
101
  * Retrieve the meta for this relationship
119
- * @property meta
120
102
  * @public
121
103
  */
122
104
  get meta(): Record<string, unknown> | null | undefined;