@warp-drive/legacy 5.6.0-alpha.15 → 5.6.0-alpha.17

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 (193) hide show
  1. package/declarations/adapter/-private/build-url-mixin.d.ts +41 -29
  2. package/declarations/adapter/-private/fastboot-interface.d.ts +4 -5
  3. package/declarations/adapter/-private/utils/continue-on-reject.d.ts +5 -6
  4. package/declarations/adapter/-private/utils/determine-body-promise.d.ts +1 -2
  5. package/declarations/adapter/-private/utils/fetch.d.ts +2 -3
  6. package/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
  7. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +5 -6
  8. package/declarations/adapter/-private/utils/serialize-query-params.d.ts +5 -2
  9. package/declarations/adapter/-private.d.ts +5 -6
  10. package/declarations/adapter/error.d.ts +206 -178
  11. package/declarations/adapter/json-api.d.ts +206 -207
  12. package/declarations/adapter/rest.d.ts +805 -808
  13. package/declarations/adapter.d.ts +742 -766
  14. package/declarations/compat/-private.d.ts +10 -11
  15. package/declarations/compat/builders/find-all.d.ts +26 -24
  16. package/declarations/compat/builders/find-record.d.ts +41 -39
  17. package/declarations/compat/builders/query.d.ts +50 -45
  18. package/declarations/compat/builders/save-record.d.ts +26 -24
  19. package/declarations/compat/builders/utils.d.ts +1 -2
  20. package/declarations/compat/builders.d.ts +10 -11
  21. package/declarations/compat/extensions.d.ts +52 -106
  22. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +39 -38
  23. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +1 -2
  24. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +9 -10
  25. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +1 -2
  26. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +1 -2
  27. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +521 -517
  28. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +214 -215
  29. package/declarations/compat/legacy-network-handler/serializer-response.d.ts +5 -6
  30. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +83 -84
  31. package/declarations/compat/legacy-network-handler/snapshot.d.ts +228 -229
  32. package/declarations/compat/utils.d.ts +118 -119
  33. package/declarations/compat.d.ts +106 -104
  34. package/declarations/model/-private/attr.d.ts +164 -145
  35. package/declarations/model/-private/belongs-to.d.ts +135 -122
  36. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +15 -4
  37. package/declarations/model/-private/errors.d.ts +272 -267
  38. package/declarations/model/-private/has-many.d.ts +119 -116
  39. package/declarations/model/-private/hooks.d.ts +5 -6
  40. package/declarations/model/-private/legacy-relationships-support.d.ts +51 -52
  41. package/declarations/model/-private/model-for-mixin.d.ts +18 -3
  42. package/declarations/model/-private/model-methods.d.ts +29 -24
  43. package/declarations/model/-private/model.d.ts +1306 -1254
  44. package/declarations/model/-private/notify-changes.d.ts +3 -4
  45. package/declarations/model/-private/promise-belongs-to.d.ts +33 -27
  46. package/declarations/model/-private/promise-many-array.d.ts +125 -116
  47. package/declarations/model/-private/record-state.d.ts +63 -60
  48. package/declarations/model/-private/references/belongs-to.d.ts +491 -487
  49. package/declarations/model/-private/references/has-many.d.ts +495 -492
  50. package/declarations/model/-private/schema-provider.d.ts +53 -56
  51. package/declarations/model/-private/type-utils.d.ts +41 -41
  52. package/declarations/model/-private/util.d.ts +1 -2
  53. package/declarations/model/-private.d.ts +8 -8
  54. package/declarations/model/migration-support.d.ts +281 -279
  55. package/declarations/model.d.ts +48 -49
  56. package/declarations/serializer/-private/embedded-records-mixin.d.ts +70 -71
  57. package/declarations/serializer/-private/transforms/boolean.d.ts +37 -37
  58. package/declarations/serializer/-private/transforms/date.d.ts +22 -22
  59. package/declarations/serializer/-private/transforms/number.d.ts +22 -22
  60. package/declarations/serializer/-private/transforms/string.d.ts +22 -22
  61. package/declarations/serializer/-private/transforms/transform.d.ts +109 -110
  62. package/declarations/serializer/-private/utils.d.ts +0 -1
  63. package/declarations/serializer/json-api.d.ts +124 -494
  64. package/declarations/serializer/json.d.ts +62 -1031
  65. package/declarations/serializer/rest.d.ts +52 -552
  66. package/declarations/serializer/transform.d.ts +5 -6
  67. package/declarations/serializer.d.ts +217 -218
  68. package/dist/{-private-DFfBszo5.js → -private-CKrP0ogQ.js} +1 -1
  69. package/dist/adapter/-private.js +1 -1
  70. package/dist/adapter/error.js +17 -0
  71. package/dist/adapter/json-api.js +1 -1
  72. package/dist/adapter/rest.js +5 -7
  73. package/dist/adapter.js +6 -35
  74. package/dist/compat/-private.js +1 -1
  75. package/dist/compat/extensions.js +0 -2
  76. package/dist/compat.js +3 -4
  77. package/dist/{errors-_QQ7xpSn.js → errors-BX5wowuz.js} +11 -10
  78. package/dist/{json-DSOlH9A8.js → json-Et4mt_LM.js} +84 -157
  79. package/dist/model/-private.js +1 -1
  80. package/dist/model/migration-support.js +3 -4
  81. package/dist/model.js +3 -3
  82. package/dist/{schema-provider-D_P8ReX6.js → schema-provider-BdQhkT-Q.js} +20 -13
  83. package/dist/{serialize-into-hash-BxfqWC8u.js → serialize-into-hash-Bp58npke.js} +1 -1
  84. package/dist/serializer/json-api.js +42 -2
  85. package/dist/serializer/json.js +1 -1
  86. package/dist/serializer/rest.js +46 -41
  87. package/dist/serializer/transform.js +0 -44
  88. package/package.json +7 -7
  89. package/declarations/adapter/-private/build-url-mixin.d.ts.map +0 -1
  90. package/declarations/adapter/-private/fastboot-interface.d.ts.map +0 -1
  91. package/declarations/adapter/-private/utils/continue-on-reject.d.ts.map +0 -1
  92. package/declarations/adapter/-private/utils/determine-body-promise.d.ts.map +0 -1
  93. package/declarations/adapter/-private/utils/fetch.d.ts.map +0 -1
  94. package/declarations/adapter/-private/utils/parse-response-headers.d.ts.map +0 -1
  95. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts.map +0 -1
  96. package/declarations/adapter/-private/utils/serialize-query-params.d.ts.map +0 -1
  97. package/declarations/adapter/-private.d.ts.map +0 -1
  98. package/declarations/adapter/error.d.ts.map +0 -1
  99. package/declarations/adapter/json-api.d.ts.map +0 -1
  100. package/declarations/adapter/rest.d.ts.map +0 -1
  101. package/declarations/adapter.d.ts.map +0 -1
  102. package/declarations/compat/-private.d.ts.map +0 -1
  103. package/declarations/compat/builders/find-all.d.ts.map +0 -1
  104. package/declarations/compat/builders/find-record.d.ts.map +0 -1
  105. package/declarations/compat/builders/query.d.ts.map +0 -1
  106. package/declarations/compat/builders/save-record.d.ts.map +0 -1
  107. package/declarations/compat/builders/utils.d.ts.map +0 -1
  108. package/declarations/compat/builders.d.ts.map +0 -1
  109. package/declarations/compat/extensions.d.ts.map +0 -1
  110. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts.map +0 -1
  111. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts.map +0 -1
  112. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts.map +0 -1
  113. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts.map +0 -1
  114. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts.map +0 -1
  115. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts.map +0 -1
  116. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts.map +0 -1
  117. package/declarations/compat/legacy-network-handler/serializer-response.d.ts.map +0 -1
  118. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts.map +0 -1
  119. package/declarations/compat/legacy-network-handler/snapshot.d.ts.map +0 -1
  120. package/declarations/compat/utils.d.ts.map +0 -1
  121. package/declarations/compat.d.ts.map +0 -1
  122. package/declarations/model/-private/attr.d.ts.map +0 -1
  123. package/declarations/model/-private/attr.type-test.d.ts +0 -2
  124. package/declarations/model/-private/attr.type-test.d.ts.map +0 -1
  125. package/declarations/model/-private/belongs-to.d.ts.map +0 -1
  126. package/declarations/model/-private/belongs-to.type-test.d.ts +0 -2
  127. package/declarations/model/-private/belongs-to.type-test.d.ts.map +0 -1
  128. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  129. package/declarations/model/-private/errors.d.ts.map +0 -1
  130. package/declarations/model/-private/has-many.d.ts.map +0 -1
  131. package/declarations/model/-private/has-many.type-test.d.ts +0 -2
  132. package/declarations/model/-private/has-many.type-test.d.ts.map +0 -1
  133. package/declarations/model/-private/hooks.d.ts.map +0 -1
  134. package/declarations/model/-private/legacy-relationships-support.d.ts.map +0 -1
  135. package/declarations/model/-private/model-for-mixin.d.ts.map +0 -1
  136. package/declarations/model/-private/model-methods.d.ts.map +0 -1
  137. package/declarations/model/-private/model.d.ts.map +0 -1
  138. package/declarations/model/-private/model.type-test.d.ts +0 -2
  139. package/declarations/model/-private/model.type-test.d.ts.map +0 -1
  140. package/declarations/model/-private/notify-changes.d.ts.map +0 -1
  141. package/declarations/model/-private/promise-belongs-to.d.ts.map +0 -1
  142. package/declarations/model/-private/promise-many-array.d.ts.map +0 -1
  143. package/declarations/model/-private/promise-proxy-base.d.ts +0 -3
  144. package/declarations/model/-private/promise-proxy-base.d.ts.map +0 -1
  145. package/declarations/model/-private/record-state.d.ts.map +0 -1
  146. package/declarations/model/-private/references/belongs-to.d.ts.map +0 -1
  147. package/declarations/model/-private/references/has-many.d.ts.map +0 -1
  148. package/declarations/model/-private/schema-provider.d.ts.map +0 -1
  149. package/declarations/model/-private/type-utils.d.ts.map +0 -1
  150. package/declarations/model/-private/util.d.ts.map +0 -1
  151. package/declarations/model/-private.d.ts.map +0 -1
  152. package/declarations/model/migration-support.d.ts.map +0 -1
  153. package/declarations/model/migration-support.type-test.d.ts +0 -2
  154. package/declarations/model/migration-support.type-test.d.ts.map +0 -1
  155. package/declarations/model.d.ts.map +0 -1
  156. package/declarations/serializer/-private/embedded-records-mixin.d.ts.map +0 -1
  157. package/declarations/serializer/-private/transforms/boolean.d.ts.map +0 -1
  158. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts +0 -2
  159. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts.map +0 -1
  160. package/declarations/serializer/-private/transforms/date.d.ts.map +0 -1
  161. package/declarations/serializer/-private/transforms/number.d.ts.map +0 -1
  162. package/declarations/serializer/-private/transforms/string.d.ts.map +0 -1
  163. package/declarations/serializer/-private/transforms/transform.d.ts.map +0 -1
  164. package/declarations/serializer/-private/utils.d.ts.map +0 -1
  165. package/declarations/serializer/json-api.d.ts.map +0 -1
  166. package/declarations/serializer/json.d.ts.map +0 -1
  167. package/declarations/serializer/rest.d.ts.map +0 -1
  168. package/declarations/serializer/transform.d.ts.map +0 -1
  169. package/declarations/serializer.d.ts.map +0 -1
  170. package/dist/-private-DFfBszo5.js.map +0 -1
  171. package/dist/adapter/-private.js.map +0 -1
  172. package/dist/adapter/error.js.map +0 -1
  173. package/dist/adapter/json-api.js.map +0 -1
  174. package/dist/adapter/rest.js.map +0 -1
  175. package/dist/adapter.js.map +0 -1
  176. package/dist/compat/-private.js.map +0 -1
  177. package/dist/compat/builders.js.map +0 -1
  178. package/dist/compat/extensions.js.map +0 -1
  179. package/dist/compat/utils.js.map +0 -1
  180. package/dist/compat.js.map +0 -1
  181. package/dist/errors-_QQ7xpSn.js.map +0 -1
  182. package/dist/json-DSOlH9A8.js.map +0 -1
  183. package/dist/model/-private.js.map +0 -1
  184. package/dist/model/migration-support.js.map +0 -1
  185. package/dist/model.js.map +0 -1
  186. package/dist/runtime-BPCpkOf1-BKOwiRJp.js.map +0 -1
  187. package/dist/schema-provider-D_P8ReX6.js.map +0 -1
  188. package/dist/serialize-into-hash-BxfqWC8u.js.map +0 -1
  189. package/dist/serializer/json-api.js.map +0 -1
  190. package/dist/serializer/json.js.map +0 -1
  191. package/dist/serializer/rest.js.map +0 -1
  192. package/dist/serializer/transform.js.map +0 -1
  193. package/dist/serializer.js.map +0 -1
@@ -1,138 +1,137 @@
1
- type Reporter = (type: 'formatted-id' | 'formatted-type', actual: unknown, expected: unknown) => void;
1
+ type Reporter = (type: "formatted-id" | "formatted-type", actual: unknown, expected: unknown) => void;
2
2
  /**
3
- * Configure a function to be called when an id or type
4
- * changes during normalization. This is useful for instrumenting
5
- * to discover places where usage in the app is not consistent.
6
- *
7
- * @param method a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
8
- * @public
9
- */
3
+ * Configure a function to be called when an id or type
4
+ * changes during normalization. This is useful for instrumenting
5
+ * to discover places where usage in the app is not consistent.
6
+ *
7
+ * @param method a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
8
+ * @public
9
+ */
10
10
  export declare function configureMismatchReporter(fn: Reporter): void;
11
11
  /**
12
- * Configure a function to be called when an id or type
13
- * fails validation. This is useful for instrumenting
14
- * to discover places where usage in the app is not consistent.
15
- *
16
- * @param method a function which takes a message and a condition
17
- * @public
18
- */
12
+ * Configure a function to be called when an id or type
13
+ * fails validation. This is useful for instrumenting
14
+ * to discover places where usage in the app is not consistent.
15
+ *
16
+ * @param method a function which takes a message and a condition
17
+ * @public
18
+ */
19
19
  export declare function configureAssertFn(fn: (message: string, condition: unknown) => void): void;
20
20
  /**
21
- * Configure a function to be called to normalize
22
- * a resource type string. Used by both formattedType
23
- * and isEquivType to ensure consistent normalization
24
- * during comparison.
25
- *
26
- * If validation fails or the type turns out be unnormalized
27
- * the configured mismatch reporter and assert functions will
28
- * be called.
29
- *
30
- * @param method a function which takes a string and returns a string
31
- * @public
32
- */
21
+ * Configure a function to be called to normalize
22
+ * a resource type string. Used by both formattedType
23
+ * and isEquivType to ensure consistent normalization
24
+ * during comparison.
25
+ *
26
+ * If validation fails or the type turns out be unnormalized
27
+ * the configured mismatch reporter and assert functions will
28
+ * be called.
29
+ *
30
+ * @param method a function which takes a string and returns a string
31
+ * @public
32
+ */
33
33
  export declare function configureTypeNormalization(fn: (type: string) => string): void;
34
34
  /**
35
- * Converts a potentially unnormalized type into the format expected
36
- * by our EmberData Cache. Currently this is singular-dasherized.
37
- *
38
- * you should not rely on this function to give you an exact format
39
- * for display purposes. Formatting for display should be handled
40
- * differently if the exact format matters.
41
- *
42
- * Asserts invalid types (undefined, null, '') in dev.
43
- *
44
- * **Usage**
45
- *
46
- * ```js
47
- * import formattedType from 'soxhub-client/helpers/formatted-type';
48
- *
49
- * formattedType('post'); // => 'post'
50
- * formattedType('posts'); // => 'post'
51
- * formattedType('Posts'); // => 'post'
52
- * formattedType('post-comment'); // => 'post-comment'
53
- * formattedType('post-comments'); // => 'post-comment'
54
- * formattedType('post_comment'); // => 'post-comment'
55
- * formattedType('postComment'); // => 'post-comment'
56
- * formattedType('PostComment'); // => 'post-comment'
57
- * ```
58
- *
59
- * @param {String} type the potentially un-normalized type
60
- * @return {String} the normalized type
61
- * @public
62
- */
35
+ * Converts a potentially unnormalized type into the format expected
36
+ * by our EmberData Cache. Currently this is singular-dasherized.
37
+ *
38
+ * you should not rely on this function to give you an exact format
39
+ * for display purposes. Formatting for display should be handled
40
+ * differently if the exact format matters.
41
+ *
42
+ * Asserts invalid types (undefined, null, '') in dev.
43
+ *
44
+ * **Usage**
45
+ *
46
+ * ```js
47
+ * import formattedType from 'soxhub-client/helpers/formatted-type';
48
+ *
49
+ * formattedType('post'); // => 'post'
50
+ * formattedType('posts'); // => 'post'
51
+ * formattedType('Posts'); // => 'post'
52
+ * formattedType('post-comment'); // => 'post-comment'
53
+ * formattedType('post-comments'); // => 'post-comment'
54
+ * formattedType('post_comment'); // => 'post-comment'
55
+ * formattedType('postComment'); // => 'post-comment'
56
+ * formattedType('PostComment'); // => 'post-comment'
57
+ * ```
58
+ *
59
+ * @param {String} type the potentially un-normalized type
60
+ * @return {String} the normalized type
61
+ * @public
62
+ */
63
63
  export declare function formattedType<T extends string>(type: T | string): T;
64
64
  /**
65
- * Format an id to the format expected by the EmberData Cache.
66
- * Currently this means that id should be `string | null`.
67
- *
68
- * Asserts invalid IDs (undefined, '', 0, '0') in dev.
69
- *
70
- * **Usage**
71
- *
72
- * ```js
73
- * import formattedId from 'client/utils/formatted-id';
74
- *
75
- * formattedId('1'); // => '1'
76
- * formattedId(1); // => '1'
77
- * formattedId(null); // => null
78
- * ```
79
- *
80
- * @param {String | Number | null} id the potentially un-normalized id
81
- * @return {String | null} the normalized id
82
- * @public
83
- */
65
+ * Format an id to the format expected by the EmberData Cache.
66
+ * Currently this means that id should be `string | null`.
67
+ *
68
+ * Asserts invalid IDs (undefined, '', 0, '0') in dev.
69
+ *
70
+ * **Usage**
71
+ *
72
+ * ```js
73
+ * import formattedId from 'client/utils/formatted-id';
74
+ *
75
+ * formattedId('1'); // => '1'
76
+ * formattedId(1); // => '1'
77
+ * formattedId(null); // => null
78
+ * ```
79
+ *
80
+ * @param {String | Number | null} id the potentially un-normalized id
81
+ * @return {String | null} the normalized id
82
+ * @public
83
+ */
84
84
  export declare function formattedId(id: string | number): string;
85
85
  export declare function formattedId(id: null): null;
86
86
  export declare function formattedId(id: string | number | null): string | null;
87
87
  export declare function expectId(id: string | number): string;
88
88
  export declare function expectId(id: null): never;
89
89
  /**
90
- * Compares two types for strict equality, converting them to
91
- * the format expected by the EmberData Cache to ensure
92
- * differences in format are accounted for in the comparison.
93
- *
94
- * Asserts when expected or actual are invalid types in dev.
95
- * Expected may never be null.
96
- *
97
- * ```js
98
- * isEquivType('posts', 'post'); // true
99
- * isEquivType('post', 'post'); // true
100
- * isEquivType('posts', 'posts'); // true
101
- * isEquivType('post-comment', 'postComment'); // true
102
- * isEquivType('post-comment', 'PostComment'); // true
103
- * isEquivType('post-comment', 'post_comment'); // true
104
- * isEquivType('post-comment', 'post-comment'); // true
105
- * isEquivType('post-comment', 'post'); // false
106
- * isEquivType('posts', null); // false
107
- * ```
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
112
- * @public
113
- */
90
+ * Compares two types for strict equality, converting them to
91
+ * the format expected by the EmberData Cache to ensure
92
+ * differences in format are accounted for in the comparison.
93
+ *
94
+ * Asserts when expected or actual are invalid types in dev.
95
+ * Expected may never be null.
96
+ *
97
+ * ```js
98
+ * isEquivType('posts', 'post'); // true
99
+ * isEquivType('post', 'post'); // true
100
+ * isEquivType('posts', 'posts'); // true
101
+ * isEquivType('post-comment', 'postComment'); // true
102
+ * isEquivType('post-comment', 'PostComment'); // true
103
+ * isEquivType('post-comment', 'post_comment'); // true
104
+ * isEquivType('post-comment', 'post-comment'); // true
105
+ * isEquivType('post-comment', 'post'); // false
106
+ * isEquivType('posts', null); // false
107
+ * ```
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
112
+ * @public
113
+ */
114
114
  export declare function isEquivType(expected: string, actual: string): boolean;
115
115
  /**
116
- * Compares two IDs for strict equality, converting them to
117
- * the format expected by the EmberData Cache to ensure
118
- * differences in format are accounted for in the comparison.
119
- *
120
- * Asserts when expected or actual are invalid IDs in dev.
121
- * Expected may never be null.
122
- *
123
- * ```js
124
- * isEquivId('1', 1); // true
125
- * isEquivId('2', '2'); // true
126
- * isEquivId(3, '3'); // true
127
- * isEquivId(4, '3'); // false
128
- * isEquivId(1, null); // false
129
- * ```
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
134
- * @public
135
- */
116
+ * Compares two IDs for strict equality, converting them to
117
+ * the format expected by the EmberData Cache to ensure
118
+ * differences in format are accounted for in the comparison.
119
+ *
120
+ * Asserts when expected or actual are invalid IDs in dev.
121
+ * Expected may never be null.
122
+ *
123
+ * ```js
124
+ * isEquivId('1', 1); // true
125
+ * isEquivId('2', '2'); // true
126
+ * isEquivId(3, '3'); // true
127
+ * isEquivId(4, '3'); // false
128
+ * isEquivId(1, null); // false
129
+ * ```
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
134
+ * @public
135
+ */
136
136
  export declare function isEquivId(expected: string | number, actual: string | number | null): boolean;
137
137
  export {};
138
- //# sourceMappingURL=utils.d.ts.map
@@ -1,134 +1,136 @@
1
- import { type Store } from '@warp-drive/core';
2
- import type { ObjectValue } from '@warp-drive/core/types/json/raw';
3
- import { FetchManager } from './compat/-private.ts';
4
- import type { AdapterPayload, MinimumAdapterInterface } from './compat/legacy-network-handler/minimum-adapter-interface.ts';
5
- import type { MinimumSerializerInterface, SerializerOptions } from './compat/legacy-network-handler/minimum-serializer-interface.ts';
6
- export { LegacyNetworkHandler } from './compat/legacy-network-handler/legacy-network-handler.ts';
1
+ import { type Store } from "@warp-drive/core";
2
+ import type { ObjectValue } from "@warp-drive/core/types/json/raw";
3
+ import type { SingleResourceDocument } from "@warp-drive/core/types/spec/json-api-raw";
4
+ import { FetchManager } from "./compat/-private.js";
5
+ import type { AdapterPayload, MinimumAdapterInterface } from "./compat/legacy-network-handler/minimum-adapter-interface.js";
6
+ import type { MinimumSerializerInterface, SerializerOptions } from "./compat/legacy-network-handler/minimum-serializer-interface.js";
7
+ export { LegacyNetworkHandler } from "./compat/legacy-network-handler/legacy-network-handler.js";
7
8
  export type { MinimumAdapterInterface, MinimumSerializerInterface, SerializerOptions, AdapterPayload };
8
9
  export type LegacyStoreCompat = {
9
- _fetchManager: FetchManager;
10
- adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
11
- adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
12
- serializerFor<K extends string>(modelName: K, _allowMissing?: boolean): MinimumSerializerInterface | null;
13
- normalize(modelName: string, payload: ObjectValue): ObjectValue;
14
- pushPayload(modelName: string, payload: ObjectValue): void;
15
- serializeRecord(record: unknown, options?: SerializerOptions): unknown;
16
- _adapterCache: Record<string, MinimumAdapterInterface & {
17
- store: Store;
18
- }>;
19
- _serializerCache: Record<string, MinimumSerializerInterface & {
20
- store: Store;
21
- }>;
10
+ _fetchManager: FetchManager;
11
+ adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
12
+ adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
13
+ serializerFor<K extends string>(modelName: K, _allowMissing?: boolean): MinimumSerializerInterface | null;
14
+ normalize(modelName: string, payload: ObjectValue): ObjectValue;
15
+ pushPayload(modelName: string, payload: ObjectValue): void;
16
+ serializeRecord(record: unknown, options?: SerializerOptions): unknown;
17
+ _adapterCache: Record<string, MinimumAdapterInterface & {
18
+ store: Store;
19
+ }>;
20
+ _serializerCache: Record<string, MinimumSerializerInterface & {
21
+ store: Store;
22
+ }>;
22
23
  };
23
24
  export type CompatStore = Store & LegacyStoreCompat;
24
25
  /**
25
- Returns an instance of the adapter for a given type. For
26
- example, `adapterFor('person')` will return an instance of
27
- the adapter located at `app/adapters/person.js`
28
-
29
- If no `person` adapter is found, this method will look
30
- for an `application` adapter (the default adapter for
31
- your entire application).
32
-
33
- @public
34
- @param {String} modelName
35
- @return {Adapter}
36
- */
26
+ Returns an instance of the adapter for a given type. For
27
+ example, `adapterFor('person')` will return an instance of
28
+ the adapter located at `app/adapters/person.js`
29
+
30
+ If no `person` adapter is found, this method will look
31
+ for an `application` adapter (the default adapter for
32
+ your entire application).
33
+
34
+ @public
35
+ @param {String} modelName
36
+ @return {Adapter}
37
+ */
37
38
  export declare function adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
38
39
  export declare function adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
39
40
  /**
40
- Returns an instance of the serializer for a given type. For
41
- example, `serializerFor('person')` will return an instance of
42
- `App.PersonSerializer`.
41
+ Returns an instance of the serializer for a given type. For
42
+ example, `serializerFor('person')` will return an instance of
43
+ `App.PersonSerializer`.
43
44
 
44
- If no `App.PersonSerializer` is found, this method will look
45
- for an `App.ApplicationSerializer` (the default serializer for
46
- your entire application).
45
+ If no `App.PersonSerializer` is found, this method will look
46
+ for an `App.ApplicationSerializer` (the default serializer for
47
+ your entire application).
47
48
 
48
- If a serializer cannot be found on the adapter, it will fall back
49
- to an instance of `JSONSerializer`.
49
+ If a serializer cannot be found on the adapter, it will fall back
50
+ to an instance of `JSONSerializer`.
50
51
 
51
- @public
52
- @param {String} modelName the record to serialize
53
- @return {Serializer}
54
- */
52
+ @public
53
+ @param {String} modelName the record to serialize
54
+ @return {Serializer}
55
+ */
55
56
  export declare function serializerFor(this: Store, modelName: string): MinimumSerializerInterface | null;
56
57
  /**
57
- `normalize` converts a json payload into the normalized form that
58
- [push](../methods/push?anchor=push) expects.
59
-
60
- Example
61
-
62
- ```js
63
- socket.on('message', function(message) {
64
- let modelName = message.model;
65
- let data = message.data;
66
- store.push(store.normalize(modelName, data));
67
- });
68
- ```
69
-
70
- @public
71
- @param {String} modelName The name of the model type for this payload
72
- @param {Object} payload
73
- @return {Object} The normalized payload
74
- */
75
- export declare function normalize(this: Store, modelName: string, payload: ObjectValue): import("@warp-drive/core/types/spec/json-api-raw.js").SingleResourceDocument;
58
+ `normalize` converts a json payload into the normalized form that
59
+ [push](../methods/push?anchor=push) expects.
60
+
61
+ Example
62
+
63
+ ```js
64
+ socket.on('message', function(message) {
65
+ let modelName = message.model;
66
+ let data = message.data;
67
+ store.push(store.normalize(modelName, data));
68
+ });
69
+ ```
70
+
71
+ @public
72
+ @param modelName The name of the model type for this payload
73
+ @return The normalized payload
74
+ */
75
+ // TODO @runspired @deprecate users should call normalize on the associated serializer directly
76
+ export declare function normalize(this: Store, modelName: string, payload: ObjectValue): SingleResourceDocument;
76
77
  /**
77
- Push some raw data into the store.
78
+ Push some raw data into the store.
78
79
 
79
- This method can be used both to push in brand new
80
- records, as well as to update existing records. You
81
- can push in more than one type of object at once.
82
- All objects should be in the format expected by the
83
- serializer.
80
+ This method can be used both to push in brand new
81
+ records, as well as to update existing records. You
82
+ can push in more than one type of object at once.
83
+ All objects should be in the format expected by the
84
+ serializer.
84
85
 
85
- ```js [app/serializers/application.js]
86
- import RESTSerializer from '@ember-data/serializer/rest';
86
+ ```js [app/serializers/application.js]
87
+ import RESTSerializer from '@ember-data/serializer/rest';
87
88
 
88
- export default class ApplicationSerializer extends RESTSerializer;
89
- ```
89
+ export default class ApplicationSerializer extends RESTSerializer;
90
+ ```
90
91
 
91
- ```js
92
- let pushData = {
93
- posts: [
94
- { id: 1, postTitle: "Great post", commentIds: [2] }
95
- ],
96
- comments: [
97
- { id: 2, commentBody: "Insightful comment" }
98
- ]
99
- }
92
+ ```js
93
+ let pushData = {
94
+ posts: [
95
+ { id: 1, postTitle: "Great post", commentIds: [2] }
96
+ ],
97
+ comments: [
98
+ { id: 2, commentBody: "Insightful comment" }
99
+ ]
100
+ }
100
101
 
101
- store.pushPayload(pushData);
102
- ```
102
+ store.pushPayload(pushData);
103
+ ```
103
104
 
104
- By default, the data will be deserialized using a default
105
- serializer (the application serializer if it exists).
105
+ By default, the data will be deserialized using a default
106
+ serializer (the application serializer if it exists).
106
107
 
107
- Alternatively, `pushPayload` will accept a model type which
108
- will determine which serializer will process the payload.
108
+ Alternatively, `pushPayload` will accept a model type which
109
+ will determine which serializer will process the payload.
109
110
 
110
- ```js [app/serializers/application.js]
111
- import RESTSerializer from '@ember-data/serializer/rest';
111
+ ```js [app/serializers/application.js]
112
+ import RESTSerializer from '@ember-data/serializer/rest';
112
113
 
113
- export default class ApplicationSerializer extends RESTSerializer;
114
- ```
114
+ export default class ApplicationSerializer extends RESTSerializer;
115
+ ```
115
116
 
116
- ```js [app/serializers/post.js]
117
- import JSONSerializer from '@ember-data/serializer/json';
117
+ ```js [app/serializers/post.js]
118
+ import JSONSerializer from '@ember-data/serializer/json';
118
119
 
119
- export default JSONSerializer;
120
- ```
120
+ export default JSONSerializer;
121
+ ```
121
122
 
122
- ```js
123
- store.pushPayload(pushData); // Will use the application serializer
124
- store.pushPayload('post', pushData); // Will use the post serializer
125
- ```
123
+ ```js
124
+ store.pushPayload(pushData); // Will use the application serializer
125
+ store.pushPayload('post', pushData); // Will use the post serializer
126
+ ```
126
127
 
127
- @public
128
- @param {String} modelName Optionally, a model type used to determine which serializer will be used
129
- @param {Object} inputPayload
130
- */
128
+ @public
129
+ @param {String} modelName Optionally, a model type used to determine which serializer will be used
130
+ @param {Object} inputPayload
131
+ */
132
+ // TODO @runspired @deprecate pushPayload in favor of looking up the serializer
131
133
  export declare function pushPayload(this: Store, modelName: string, inputPayload: ObjectValue): void;
134
+ // TODO @runspired @deprecate records should implement their own serialization if desired
132
135
  export declare function serializeRecord(this: Store, record: unknown, options?: SerializerOptions): unknown;
133
136
  export declare function cleanup(this: Store): void;
134
- //# sourceMappingURL=compat.d.ts.map