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

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,234 +1,233 @@
1
- import type { Store } from '@warp-drive/core';
2
- import type { ModelSchema } from '@warp-drive/core/types';
3
- import type { HTTPMethod } from '@warp-drive/core/types/request';
4
- import type { AdapterPayload } from '../compat.ts';
5
- import type { Snapshot, SnapshotRecordArray } from '../compat/-private.ts';
6
- import type { FetchRequestInit, JQueryRequestInit, QueryState } from './rest.ts';
7
- import { RESTAdapter } from './rest.ts';
1
+ import type { Store } from "@warp-drive/core";
2
+ import type { ModelSchema } from "@warp-drive/core/types";
3
+ import type { HTTPMethod } from "@warp-drive/core/types/request";
4
+ import type { AdapterPayload } from "../compat.js";
5
+ import type { Snapshot, SnapshotRecordArray } from "../compat/-private.js";
6
+ import type { FetchRequestInit, JQueryRequestInit, QueryState } from "./rest.js";
7
+ import { RESTAdapter } from "./rest.js";
8
8
  /**
9
- ## Overview
9
+ ## Overview
10
10
 
11
- <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
12
- <p>
13
- ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
14
- If starting a new app or thinking of implementing a new adapter, consider writing a
15
- <a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
16
- </p>
17
- </blockquote>
11
+ <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
12
+ <p>
13
+ ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
14
+ If starting a new app or thinking of implementing a new adapter, consider writing a
15
+ <a href="/ember-data/release/classes/%3CInterface%3E%20Handler">Handler</a> instead to be used with the <a href="https://github.com/emberjs/data/tree/main/packages/request#readme">RequestManager</a>
16
+ </p>
17
+ </blockquote>
18
18
 
19
- The `JSONAPIAdapter` is an adapter whichtransforms the store's
20
- requests into HTTP requests that follow the [JSON API format](http://jsonapi.org/format/).
19
+ The `JSONAPIAdapter` is an adapter whichtransforms the store's
20
+ requests into HTTP requests that follow the [JSON API format](http://jsonapi.org/format/).
21
21
 
22
- ## JSON API Conventions
22
+ ## JSON API Conventions
23
23
 
24
- The JSONAPIAdapter uses JSON API conventions for building the URL
25
- for a record and selecting the HTTP verb to use with a request. The
26
- actions you can take on a record map onto the following URLs in the
27
- JSON API adapter:
24
+ The JSONAPIAdapter uses JSON API conventions for building the URL
25
+ for a record and selecting the HTTP verb to use with a request. The
26
+ actions you can take on a record map onto the following URLs in the
27
+ JSON API adapter:
28
28
 
29
29
  <table>
30
- <tr>
31
- <th>
32
- Action
33
- </th>
34
- <th>
35
- HTTP Verb
36
- </th>
37
- <th>
38
- URL
39
- </th>
40
- </tr>
41
- <tr>
42
- <th>
43
- `store.findRecord('post', 123)`
44
- </th>
45
- <td>
46
- GET
47
- </td>
48
- <td>
49
- /posts/123
50
- </td>
51
- </tr>
52
- <tr>
53
- <th>
54
- `store.findAll('post')`
55
- </th>
56
- <td>
57
- GET
58
- </td>
59
- <td>
60
- /posts
61
- </td>
62
- </tr>
63
- <tr>
64
- <th>
65
- Update `postRecord.save()`
66
- </th>
67
- <td>
68
- PATCH
69
- </td>
70
- <td>
71
- /posts/123
72
- </td>
73
- </tr>
74
- <tr>
75
- <th>
76
- Create `store.createRecord('post').save()`
77
- </th>
78
- <td>
79
- POST
80
- </td>
81
- <td>
82
- /posts
83
- </td>
84
- </tr>
85
- <tr>
86
- <th>
87
- Delete `postRecord.destroyRecord()`
88
- </th>
89
- <td>
90
- DELETE
91
- </td>
92
- <td>
93
- /posts/123
94
- </td>
95
- </tr>
30
+ <tr>
31
+ <th>
32
+ Action
33
+ </th>
34
+ <th>
35
+ HTTP Verb
36
+ </th>
37
+ <th>
38
+ URL
39
+ </th>
40
+ </tr>
41
+ <tr>
42
+ <th>
43
+ `store.findRecord('post', 123)`
44
+ </th>
45
+ <td>
46
+ GET
47
+ </td>
48
+ <td>
49
+ /posts/123
50
+ </td>
51
+ </tr>
52
+ <tr>
53
+ <th>
54
+ `store.findAll('post')`
55
+ </th>
56
+ <td>
57
+ GET
58
+ </td>
59
+ <td>
60
+ /posts
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <th>
65
+ Update `postRecord.save()`
66
+ </th>
67
+ <td>
68
+ PATCH
69
+ </td>
70
+ <td>
71
+ /posts/123
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <th>
76
+ Create `store.createRecord('post').save()`
77
+ </th>
78
+ <td>
79
+ POST
80
+ </td>
81
+ <td>
82
+ /posts
83
+ </td>
84
+ </tr>
85
+ <tr>
86
+ <th>
87
+ Delete `postRecord.destroyRecord()`
88
+ </th>
89
+ <td>
90
+ DELETE
91
+ </td>
92
+ <td>
93
+ /posts/123
94
+ </td>
95
+ </tr>
96
96
  </table>
97
97
 
98
- ## Success and failure
98
+ ## Success and failure
99
99
 
100
- The JSONAPIAdapter will consider a success any response with a
101
- status code of the 2xx family ("Success"), as well as 304 ("Not
102
- Modified"). Any other status code will be considered a failure.
100
+ The JSONAPIAdapter will consider a success any response with a
101
+ status code of the 2xx family ("Success"), as well as 304 ("Not
102
+ Modified"). Any other status code will be considered a failure.
103
103
 
104
- On success, the request promise will be resolved with the full
105
- response payload.
104
+ On success, the request promise will be resolved with the full
105
+ response payload.
106
106
 
107
- Failed responses with status code 422 ("Unprocessable Entity") will
108
- be considered "invalid". The response will be discarded, except for
109
- the `errors` key. The request promise will be rejected with a
110
- `InvalidError`. This error object will encapsulate the saved
111
- `errors` value.
107
+ Failed responses with status code 422 ("Unprocessable Entity") will
108
+ be considered "invalid". The response will be discarded, except for
109
+ the `errors` key. The request promise will be rejected with a
110
+ `InvalidError`. This error object will encapsulate the saved
111
+ `errors` value.
112
112
 
113
- Any other status codes will be treated as an adapter error. The
114
- request promise will be rejected, similarly to the invalid case,
115
- but with an instance of `AdapterError` instead.
113
+ Any other status codes will be treated as an adapter error. The
114
+ request promise will be rejected, similarly to the invalid case,
115
+ but with an instance of `AdapterError` instead.
116
116
 
117
- ### Endpoint path customization
117
+ ### Endpoint path customization
118
118
 
119
- Endpoint paths can be prefixed with a `namespace` by setting the
120
- namespace property on the adapter:
119
+ Endpoint paths can be prefixed with a `namespace` by setting the
120
+ namespace property on the adapter:
121
121
 
122
- ```js [app/adapters/application.js]
123
- import JSONAPIAdapter from '@ember-data/adapter/json-api';
122
+ ```js [app/adapters/application.js]
123
+ import JSONAPIAdapter from '@ember-data/adapter/json-api';
124
124
 
125
- export default class ApplicationAdapter extends JSONAPIAdapter {
126
- namespace = 'api/1';
127
- }
128
- ```
129
- Requests for the `person` model would now target `/api/1/people/1`.
125
+ export default class ApplicationAdapter extends JSONAPIAdapter {
126
+ namespace = 'api/1';
127
+ }
128
+ ```
129
+ Requests for the `person` model would now target `/api/1/people/1`.
130
130
 
131
- ### Host customization
131
+ ### Host customization
132
132
 
133
- An adapter can target other hosts by setting the `host` property.
133
+ An adapter can target other hosts by setting the `host` property.
134
134
 
135
- ```js [app/adapters/application.js]
136
- import JSONAPIAdapter from '@ember-data/adapter/json-api';
135
+ ```js [app/adapters/application.js]
136
+ import JSONAPIAdapter from '@ember-data/adapter/json-api';
137
137
 
138
- export default class ApplicationAdapter extends JSONAPIAdapter {
139
- host = 'https://api.example.com';
140
- }
141
- ```
138
+ export default class ApplicationAdapter extends JSONAPIAdapter {
139
+ host = 'https://api.example.com';
140
+ }
141
+ ```
142
142
 
143
- Requests for the `person` model would now target
144
- `https://api.example.com/people/1`.
143
+ Requests for the `person` model would now target
144
+ `https://api.example.com/people/1`.
145
145
 
146
- @since 1.13.0
147
- @class JSONAPIAdapter
148
- @public
149
- @constructor
146
+ @since 1.13.0
147
+ @class JSONAPIAdapter
148
+ @public
149
+ @constructor
150
150
  */
151
151
  declare class JSONAPIAdapter extends RESTAdapter {
152
- _defaultContentType: string;
153
- /**
154
- @private
155
- @param {String} url
156
- @param {String} type The request type GET, POST, PUT, DELETE etc.
157
- @param {Object} options
158
- @return {Object}
159
- */
160
- ajaxOptions(url: string, type: HTTPMethod, options?: JQueryAjaxSettings | RequestInit): JQueryRequestInit | FetchRequestInit;
161
- /**
162
- By default the JSONAPIAdapter will send each find request coming from a `store.find`
163
- or from accessing a relationship separately to the server. If your server supports passing
164
- ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
165
- within a single runloop.
166
-
167
- For example, if you have an initial payload of:
168
-
169
- ```javascript
170
- {
171
- data: {
172
- id: 1,
173
- type: 'post',
174
- relationship: {
175
- comments: {
176
- data: [
177
- { id: 1, type: 'comment' },
178
- { id: 2, type: 'comment' }
179
- ]
180
- }
181
- }
182
- }
183
- }
184
- ```
185
-
186
- By default calling `post.comments` will trigger the following requests(assuming the
187
- comments haven't been loaded before):
188
-
189
- ```
190
- GET /comments/1
191
- GET /comments/2
192
- ```
193
-
194
- If you set coalesceFindRequests to `true` it will instead trigger the following request:
195
-
196
- ```
197
- GET /comments?filter[id]=1,2
198
- ```
199
-
200
- Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
201
- relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
202
-
203
- ```javascript
204
- store.findRecord('comment', 1);
205
- store.findRecord('comment', 2);
206
- ```
207
-
208
- will also send a request to: `GET /comments?filter[id]=1,2`
209
-
210
- Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
211
- `groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
212
-
213
- @property coalesceFindRequests
214
- @public
215
- @type {Boolean}
216
- */
217
- get coalesceFindRequests(): boolean;
218
- set coalesceFindRequests(value: boolean);
219
- findMany(store: Store, type: ModelSchema, ids: string[], snapshots: Snapshot[]): Promise<AdapterPayload>;
220
- pathForType(modelName: string): string;
221
- updateRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
222
- /**
223
- Used by `findAll` and `findRecord` to build the query's `data` hash
224
- supplied to the ajax method.
225
-
226
- @since 2.5.0
227
- @public
228
- @param {Snapshot} snapshot
229
- @return {Object}
230
- */
231
- buildQuery(snapshot: Snapshot | SnapshotRecordArray): QueryState;
152
+ _defaultContentType: string;
153
+ /**
154
+ @private
155
+ @param {String} url
156
+ @param {String} type The request type GET, POST, PUT, DELETE etc.
157
+ @param {Object} options
158
+ @return {Object}
159
+ */
160
+ ajaxOptions(url: string, type: HTTPMethod, options?: JQueryAjaxSettings | RequestInit): JQueryRequestInit | FetchRequestInit;
161
+ /**
162
+ By default the JSONAPIAdapter will send each find request coming from a `store.find`
163
+ or from accessing a relationship separately to the server. If your server supports passing
164
+ ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
165
+ within a single runloop.
166
+
167
+ For example, if you have an initial payload of:
168
+
169
+ ```javascript
170
+ {
171
+ data: {
172
+ id: 1,
173
+ type: 'post',
174
+ relationship: {
175
+ comments: {
176
+ data: [
177
+ { id: 1, type: 'comment' },
178
+ { id: 2, type: 'comment' }
179
+ ]
180
+ }
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
186
+ By default calling `post.comments` will trigger the following requests(assuming the
187
+ comments haven't been loaded before):
188
+
189
+ ```
190
+ GET /comments/1
191
+ GET /comments/2
192
+ ```
193
+
194
+ If you set coalesceFindRequests to `true` it will instead trigger the following request:
195
+
196
+ ```
197
+ GET /comments?filter[id]=1,2
198
+ ```
199
+
200
+ Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
201
+ relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
202
+
203
+ ```javascript
204
+ store.findRecord('comment', 1);
205
+ store.findRecord('comment', 2);
206
+ ```
207
+
208
+ will also send a request to: `GET /comments?filter[id]=1,2`
209
+
210
+ Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
211
+ `groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
212
+
213
+ @property coalesceFindRequests
214
+ @public
215
+ @type {Boolean}
216
+ */
217
+ get coalesceFindRequests(): boolean;
218
+ set coalesceFindRequests(value: boolean);
219
+ findMany(store: Store, type: ModelSchema, ids: string[], snapshots: Snapshot[]): Promise<AdapterPayload>;
220
+ pathForType(modelName: string): string;
221
+ updateRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
222
+ /**
223
+ Used by `findAll` and `findRecord` to build the query's `data` hash
224
+ supplied to the ajax method.
225
+
226
+ @since 2.5.0
227
+ @public
228
+ @param {Snapshot} snapshot
229
+ @return {Object}
230
+ */
231
+ buildQuery(snapshot: Snapshot | SnapshotRecordArray): QueryState;
232
232
  }
233
233
  export { JSONAPIAdapter };
234
- //# sourceMappingURL=json-api.d.ts.map