@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.
- package/README.md +14 -27
- package/declarations/adapter/error.d.ts +7 -7
- package/declarations/adapter/json-api.d.ts +2 -2
- package/declarations/adapter/rest.d.ts +21 -104
- package/declarations/adapter.d.ts +2 -2
- package/declarations/compat/builders/find-all.d.ts +6 -6
- package/declarations/compat/builders/find-record.d.ts +8 -8
- package/declarations/compat/builders/query.d.ts +12 -12
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +16 -24
- package/declarations/compat/utils.d.ts +13 -13
- package/declarations/compat.d.ts +31 -5
- package/declarations/index.d.ts +25 -8
- package/declarations/model/-private/legacy-relationships-support.d.ts +2 -2
- package/declarations/model/-private/model.d.ts +10 -51
- package/declarations/model/-private/promise-many-array.d.ts +0 -18
- package/declarations/model/-private/references/belongs-to.d.ts +18 -28
- package/declarations/model/-private/references/has-many.d.ts +13 -15
- package/declarations/model/migration-support.d.ts +42 -19
- package/declarations/model-fragments/extensions/fragment-array.d.ts +16 -0
- package/declarations/model-fragments/extensions/fragment.d.ts +15 -0
- package/declarations/model-fragments/hooks/model-for.d.ts +20 -0
- package/declarations/model-fragments/index.d.ts +5 -0
- package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +9 -0
- package/declarations/model-fragments/utilities/with-array-defaults.d.ts +15 -0
- package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +20 -0
- package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +19 -0
- package/declarations/model-fragments/utilities/with-legacy.d.ts +3 -0
- package/declarations/model-fragments.d.ts +9 -0
- package/declarations/model.d.ts +2 -2
- package/declarations/serializer/-private/embedded-records-mixin.d.ts +1 -1
- package/declarations/serializer/json-api.d.ts +7 -6
- package/declarations/serializer/json.d.ts +3 -3
- package/declarations/serializer.d.ts +5 -6
- package/dist/{-private-B1pSSN52.js → -private-BG3bMiKp.js} +2 -1
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/error.js +9 -9
- package/dist/adapter/json-api.js +1 -1
- package/dist/adapter/rest.js +33 -117
- package/dist/adapter.js +2 -2
- package/dist/compat/-private.js +1 -1
- package/dist/compat/builders.js +26 -26
- package/dist/compat/utils.js +13 -14
- package/dist/compat.js +28 -8
- package/dist/{errors-COviC59J.js → errors-Cz5KrzBk.js} +113 -120
- package/dist/{hooks-Bp8SIQBU.js → hooks-D6diaM34.js} +1 -1
- package/dist/index.js +25 -8
- package/dist/{json-ksWOHRfq.js → json-ChdEfB0X.js} +12 -27
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +55 -25
- package/dist/model-for-CqXsIKws.js +221 -0
- package/dist/model-fragments.js +76 -0
- package/dist/model.js +3 -3
- package/dist/{schema-provider-JlCneqZH.js → schema-provider-DJCV_6AF.js} +44 -87
- package/dist/{serialize-into-hash-BnYvPex3.js → serialize-into-hash-DPZYoF-i.js} +1 -1
- package/dist/serializer/json-api.js +18 -45
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +10 -10
- package/dist/serializer.js +5 -6
- package/dist/store.js +2 -1
- package/dist/unpkg/dev/-private-DtjBbEgy.js +1206 -0
- package/dist/unpkg/dev/adapter/-private.js +1 -0
- package/dist/unpkg/dev/adapter/error.js +335 -0
- package/dist/unpkg/dev/adapter/json-api.js +271 -0
- package/dist/unpkg/dev/adapter/rest.js +1171 -0
- package/dist/unpkg/dev/adapter.js +1252 -0
- package/dist/unpkg/dev/compat/-private.js +1 -0
- package/dist/unpkg/dev/compat/builders.js +275 -0
- package/dist/unpkg/dev/compat/extensions.js +242 -0
- package/dist/unpkg/dev/compat/utils.js +223 -0
- package/dist/unpkg/dev/compat.js +1147 -0
- package/dist/unpkg/dev/errors-DmGGJr3T.js +2562 -0
- package/dist/unpkg/dev/hooks-CkYiE6Ud.js +73 -0
- package/dist/unpkg/dev/index.js +197 -0
- package/dist/unpkg/dev/json-Cu1LNgmQ.js +1256 -0
- package/dist/unpkg/dev/model/-private.js +1 -0
- package/dist/unpkg/dev/model/migration-support.js +553 -0
- package/dist/unpkg/dev/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/dev/model-fragments.js +76 -0
- package/dist/unpkg/dev/model.js +678 -0
- package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/dev/schema-provider-DDVYxmUV.js +2186 -0
- package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +259 -0
- package/dist/unpkg/dev/serializer/json-api.js +649 -0
- package/dist/unpkg/dev/serializer/json.js +4 -0
- package/dist/unpkg/dev/serializer/rest.js +1242 -0
- package/dist/unpkg/dev/serializer/transform.js +278 -0
- package/dist/unpkg/dev/serializer.js +248 -0
- package/dist/unpkg/dev/store.js +637 -0
- package/dist/unpkg/dev/util-DvanW33H.js +20 -0
- package/dist/unpkg/dev/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +1206 -0
- package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/adapter/error.js +335 -0
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +271 -0
- package/dist/unpkg/dev-deprecated/adapter/rest.js +1171 -0
- package/dist/unpkg/dev-deprecated/adapter.js +1252 -0
- package/dist/unpkg/dev-deprecated/compat/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/compat/builders.js +275 -0
- package/dist/unpkg/dev-deprecated/compat/extensions.js +242 -0
- package/dist/unpkg/dev-deprecated/compat/utils.js +223 -0
- package/dist/unpkg/dev-deprecated/compat.js +1147 -0
- package/dist/unpkg/dev-deprecated/errors-Spt6ubMd.js +2565 -0
- package/dist/unpkg/dev-deprecated/hooks-DOXegvhL.js +73 -0
- package/dist/unpkg/dev-deprecated/index.js +196 -0
- package/dist/unpkg/dev-deprecated/json-Cu1LNgmQ.js +1256 -0
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/model/migration-support.js +570 -0
- package/dist/unpkg/dev-deprecated/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/dev-deprecated/model-fragments.js +76 -0
- package/dist/unpkg/dev-deprecated/model.js +682 -0
- package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/dev-deprecated/schema-provider-BP6_8N-V.js +2211 -0
- package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +259 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +649 -0
- package/dist/unpkg/dev-deprecated/serializer/json.js +4 -0
- package/dist/unpkg/dev-deprecated/serializer/rest.js +1242 -0
- package/dist/unpkg/dev-deprecated/serializer/transform.js +278 -0
- package/dist/unpkg/dev-deprecated/serializer.js +248 -0
- package/dist/unpkg/dev-deprecated/store.js +637 -0
- package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +24 -0
- package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +12 -0
- package/dist/unpkg/prod/-private-BdyZaGEh.js +971 -0
- package/dist/unpkg/prod/adapter/-private.js +1 -0
- package/dist/unpkg/prod/adapter/error.js +330 -0
- package/dist/unpkg/prod/adapter/json-api.js +266 -0
- package/dist/unpkg/prod/adapter/rest.js +1134 -0
- package/dist/unpkg/prod/adapter.js +1219 -0
- package/dist/unpkg/prod/compat/-private.js +1 -0
- package/dist/unpkg/prod/compat/builders.js +210 -0
- package/dist/unpkg/prod/compat/extensions.js +232 -0
- package/dist/unpkg/prod/compat/utils.js +218 -0
- package/dist/unpkg/prod/compat.js +727 -0
- package/dist/unpkg/prod/errors-BGVFCBmi.js +2314 -0
- package/dist/unpkg/prod/hooks-BztVA_x0.js +41 -0
- package/dist/unpkg/prod/index.js +151 -0
- package/dist/unpkg/prod/json-BWrZ5546.js +1243 -0
- package/dist/unpkg/prod/model/-private.js +1 -0
- package/dist/unpkg/prod/model/migration-support.js +546 -0
- package/dist/unpkg/prod/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/prod/model-fragments.js +76 -0
- package/dist/unpkg/prod/model.js +593 -0
- package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/prod/schema-provider-DJtD_8jZ.js +1861 -0
- package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +215 -0
- package/dist/unpkg/prod/serializer/json-api.js +592 -0
- package/dist/unpkg/prod/serializer/json.js +4 -0
- package/dist/unpkg/prod/serializer/rest.js +1210 -0
- package/dist/unpkg/prod/serializer/transform.js +278 -0
- package/dist/unpkg/prod/serializer.js +248 -0
- package/dist/unpkg/prod/store.js +505 -0
- package/dist/unpkg/prod/util-DvanW33H.js +20 -0
- package/dist/unpkg/prod/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +971 -0
- package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/adapter/error.js +330 -0
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +266 -0
- package/dist/unpkg/prod-deprecated/adapter/rest.js +1134 -0
- package/dist/unpkg/prod-deprecated/adapter.js +1219 -0
- package/dist/unpkg/prod-deprecated/compat/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/compat/builders.js +210 -0
- package/dist/unpkg/prod-deprecated/compat/extensions.js +232 -0
- package/dist/unpkg/prod-deprecated/compat/utils.js +218 -0
- package/dist/unpkg/prod-deprecated/compat.js +727 -0
- package/dist/unpkg/prod-deprecated/errors-CdDaK81x.js +2317 -0
- package/dist/unpkg/prod-deprecated/hooks-yId87yyG.js +41 -0
- package/dist/unpkg/prod-deprecated/index.js +150 -0
- package/dist/unpkg/prod-deprecated/json-BWrZ5546.js +1243 -0
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/model/migration-support.js +563 -0
- package/dist/unpkg/prod-deprecated/model-for-CqXsIKws.js +221 -0
- package/dist/unpkg/prod-deprecated/model-fragments.js +76 -0
- package/dist/unpkg/prod-deprecated/model.js +596 -0
- package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
- package/dist/unpkg/prod-deprecated/schema-provider-CjX55uSY.js +1904 -0
- package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +215 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +592 -0
- package/dist/unpkg/prod-deprecated/serializer/json.js +4 -0
- package/dist/unpkg/prod-deprecated/serializer/rest.js +1210 -0
- package/dist/unpkg/prod-deprecated/serializer/transform.js +278 -0
- package/dist/unpkg/prod-deprecated/serializer.js +248 -0
- package/dist/unpkg/prod-deprecated/store.js +505 -0
- package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +23 -0
- package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +11 -0
- package/logos/README.md +2 -2
- package/logos/logo-yellow-slab.svg +1 -0
- package/logos/word-mark-black.svg +1 -0
- package/logos/word-mark-white.svg +1 -0
- package/package.json +14 -6
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
package/README.md
CHANGED
|
@@ -1,44 +1,31 @@
|
|
|
1
|
-
<
|
|
2
|
-
<img
|
|
3
|
-
class="project-logo"
|
|
4
|
-
src="./logos/github-header.svg#gh-light-mode-only"
|
|
5
|
-
alt="WarpDrive | Boldly go where no app has gone before"
|
|
6
|
-
title="WarpDrive | Boldly go where no app has gone before"
|
|
7
|
-
/>
|
|
1
|
+
<p align="center">
|
|
8
2
|
<img
|
|
9
3
|
class="project-logo"
|
|
10
|
-
src="./logos/
|
|
11
|
-
alt="WarpDrive
|
|
12
|
-
|
|
4
|
+
src="./logos/logo-yellow-slab.svg"
|
|
5
|
+
alt="WarpDrive"
|
|
6
|
+
width="180px"
|
|
7
|
+
title="WarpDrive"
|
|
13
8
|
/>
|
|
14
|
-
</
|
|
9
|
+
</p>
|
|
15
10
|
|
|
16
|
-
](https://discord.gg/zT3asNS
|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+
[](https://discord.gg/zT3asNS
|
|
21
15
|
)
|
|
22
|
-
[](https://discord.gg/PHBbnWJx5S
|
|
23
17
|
)
|
|
24
18
|
|
|
19
|
+
# @warp-drive/legacy
|
|
25
20
|
|
|
26
21
|
<br>
|
|
27
22
|
|
|
28
23
|
<p align="center">
|
|
29
|
-
Decommissioned
|
|
24
|
+
Decommissioned Features from <em>Warp</em><strong>Drive</strong> that your App may want to continue using for a little while longer.
|
|
30
25
|
</p>
|
|
31
26
|
|
|
32
27
|
<br>
|
|
33
28
|
|
|
34
|
-
## Installation
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
pnpm add -E @warp-drive/legacy
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
<br>
|
|
41
|
-
|
|
42
29
|
## Documentation
|
|
43
30
|
|
|
44
31
|
*Get Started* → [Guides](https://docs.warp-drive.io)
|
|
@@ -48,7 +35,7 @@ pnpm add -E @warp-drive/legacy
|
|
|
48
35
|
|
|
49
36
|
## Code of Conduct
|
|
50
37
|
|
|
51
|
-
Refer to the [Code of Conduct](https://github.com/
|
|
38
|
+
Refer to the [Code of Conduct](https://github.com/warp-drive-data/warp-drive/blob/main/CODE_OF_CONDUCT.md) for community guidelines and inclusivity.
|
|
52
39
|
|
|
53
40
|
<br>
|
|
54
41
|
|
|
@@ -21,8 +21,8 @@ from an adapter is rejected with a `InvalidError` the record will
|
|
|
21
21
|
transition to the `invalid` state and the errors will be set to the
|
|
22
22
|
`errors` property on the record.
|
|
23
23
|
|
|
24
|
-
For
|
|
25
|
-
properties on the model,
|
|
24
|
+
For WarpDrive to correctly map errors to their corresponding
|
|
25
|
+
properties on the model, WarpDrive expects each error to be
|
|
26
26
|
a valid JSON-API error object with a `source/pointer` that matches
|
|
27
27
|
the property name. For example, if you had a Post model that
|
|
28
28
|
looked like this.
|
|
@@ -42,8 +42,8 @@ rejects with a `InvalidError` object that looks like this:
|
|
|
42
42
|
|
|
43
43
|
```js [app/adapters/post.js]
|
|
44
44
|
import RSVP from 'RSVP';
|
|
45
|
-
import RESTAdapter from '@
|
|
46
|
-
import { InvalidError } from '@
|
|
45
|
+
import RESTAdapter from '@warp-drive/legacy/adapter/rest';
|
|
46
|
+
import { InvalidError } from '@warp-drive/legacy/adapter/error';
|
|
47
47
|
|
|
48
48
|
export default class ApplicationAdapter extends RESTAdapter {
|
|
49
49
|
updateRecord() {
|
|
@@ -82,7 +82,7 @@ An example use case would be to warn the user to check their internet
|
|
|
82
82
|
connection if an adapter operation has timed out:
|
|
83
83
|
|
|
84
84
|
```js [app/routes/application.js]
|
|
85
|
-
import { TimeoutError } from '@
|
|
85
|
+
import { TimeoutError } from '@warp-drive/legacy/adapter/error';
|
|
86
86
|
|
|
87
87
|
export default class ApplicationRoute extends Route {
|
|
88
88
|
@action
|
|
@@ -124,7 +124,7 @@ An example use case would be to redirect the user to a login route if a
|
|
|
124
124
|
request is unauthorized:
|
|
125
125
|
|
|
126
126
|
```js [app/routes/application.js]
|
|
127
|
-
import { UnauthorizedError } from '@
|
|
127
|
+
import { UnauthorizedError } from '@warp-drive/legacy/adapter/error';
|
|
128
128
|
|
|
129
129
|
export default class ApplicationRoute extends Route {
|
|
130
130
|
@action
|
|
@@ -166,7 +166,7 @@ An example use case would be to detect if the user has entered a route
|
|
|
166
166
|
for a specific model that does not exist. For example:
|
|
167
167
|
|
|
168
168
|
```js [app/routes/post.js]
|
|
169
|
-
import { NotFoundError } from '@
|
|
169
|
+
import { NotFoundError } from '@warp-drive/legacy/adapter/error';
|
|
170
170
|
|
|
171
171
|
export default class PostRoute extends Route {
|
|
172
172
|
@service store;
|
|
@@ -118,7 +118,7 @@ Endpoint paths can be prefixed with a `namespace` by setting the
|
|
|
118
118
|
namespace property on the adapter:
|
|
119
119
|
|
|
120
120
|
```js [app/adapters/application.js]
|
|
121
|
-
import JSONAPIAdapter from '@
|
|
121
|
+
import JSONAPIAdapter from '@warp-drive/legacy/adapter/json-api';
|
|
122
122
|
|
|
123
123
|
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
124
124
|
namespace = 'api/1';
|
|
@@ -131,7 +131,7 @@ Requests for the `person` model would now target `/api/1/people/1`.
|
|
|
131
131
|
An adapter can target other hosts by setting the `host` property.
|
|
132
132
|
|
|
133
133
|
```js [app/adapters/application.js]
|
|
134
|
-
import JSONAPIAdapter from '@
|
|
134
|
+
import JSONAPIAdapter from '@warp-drive/legacy/adapter/json-api';
|
|
135
135
|
|
|
136
136
|
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
137
137
|
host = 'https://api.example.com';
|
|
@@ -106,7 +106,7 @@ look like this:
|
|
|
106
106
|
Note that the object root can be pluralized for both a single-object response
|
|
107
107
|
and an array response: the REST adapter is not strict on this. Further, if the
|
|
108
108
|
HTTP server responds to a `GET` request to `/posts/1` (e.g. the response to a
|
|
109
|
-
`findRecord` query) with more than one object in the array,
|
|
109
|
+
`findRecord` query) with more than one object in the array, WarpDrive will
|
|
110
110
|
only display the object with the matching ID.
|
|
111
111
|
|
|
112
112
|
### Conventional Names
|
|
@@ -167,7 +167,7 @@ response under a key for the type.
|
|
|
167
167
|
|
|
168
168
|
If the records in the relationship are not known when the response
|
|
169
169
|
is serialized it's also possible to represent the relationship as a
|
|
170
|
-
URL using the `links` key in the response.
|
|
170
|
+
URL using the `links` key in the response. WarpDrive will fetch
|
|
171
171
|
this URL to resolve the relationship when it is accessed for the
|
|
172
172
|
first time.
|
|
173
173
|
|
|
@@ -250,10 +250,7 @@ return {
|
|
|
250
250
|
}
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
@class RESTAdapter
|
|
254
253
|
@public
|
|
255
|
-
@constructor
|
|
256
|
-
@uses BuildURLMixin
|
|
257
254
|
*/
|
|
258
255
|
declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
259
256
|
_fastboot: FastBoot;
|
|
@@ -263,8 +260,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
263
260
|
/**
|
|
264
261
|
This property allows ajax to still be used instead when `false`.
|
|
265
262
|
|
|
266
|
-
@property useFetch
|
|
267
|
-
@type {Boolean}
|
|
268
263
|
@default true
|
|
269
264
|
@public
|
|
270
265
|
*/
|
|
@@ -310,8 +305,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
310
305
|
}
|
|
311
306
|
```
|
|
312
307
|
|
|
313
|
-
@param {Object} obj
|
|
314
|
-
@return {Object}
|
|
315
308
|
@public
|
|
316
309
|
*/
|
|
317
310
|
sortQueryParams(obj: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -359,9 +352,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
359
352
|
Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
|
|
360
353
|
`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
|
|
361
354
|
|
|
362
|
-
@property coalesceFindRequests
|
|
363
355
|
@public
|
|
364
|
-
@type {Boolean}
|
|
365
356
|
*/
|
|
366
357
|
get coalesceFindRequests(): boolean;
|
|
367
358
|
set coalesceFindRequests(value: boolean);
|
|
@@ -379,9 +370,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
379
370
|
|
|
380
371
|
Requests for the `Post` model would now target `/api/1/post/`.
|
|
381
372
|
|
|
382
|
-
@property namespace
|
|
383
373
|
@public
|
|
384
|
-
@type {String}
|
|
385
374
|
*/
|
|
386
375
|
/**
|
|
387
376
|
An adapter can target other hosts by setting the `host` property.
|
|
@@ -396,14 +385,12 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
396
385
|
|
|
397
386
|
Requests for the `Post` model would now target `https://api.example.com/post/`.
|
|
398
387
|
|
|
399
|
-
@property host
|
|
400
388
|
@public
|
|
401
|
-
@type {String}
|
|
402
389
|
*/
|
|
403
390
|
/**
|
|
404
391
|
Some APIs require HTTP headers, e.g. to provide an API
|
|
405
392
|
key. Arbitrary headers can be set as key/value pairs on the
|
|
406
|
-
`RESTAdapter`'s `headers` object and
|
|
393
|
+
`RESTAdapter`'s `headers` object and WarpDrive will send them
|
|
407
394
|
along with each ajax request..
|
|
408
395
|
|
|
409
396
|
```js [app/adapters/application.js]
|
|
@@ -419,9 +406,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
419
406
|
}
|
|
420
407
|
```
|
|
421
408
|
|
|
422
|
-
@property headers
|
|
423
409
|
@public
|
|
424
|
-
@type {Object}
|
|
425
410
|
*/
|
|
426
411
|
headers: Record<string, unknown> | undefined;
|
|
427
412
|
/**
|
|
@@ -435,11 +420,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
435
420
|
|
|
436
421
|
@since 1.13.0
|
|
437
422
|
@public
|
|
438
|
-
@param {Store} store
|
|
439
|
-
@param {Model} type
|
|
440
|
-
@param {String} id
|
|
441
|
-
@param {Snapshot} snapshot
|
|
442
|
-
@return {Promise} promise
|
|
443
423
|
*/
|
|
444
424
|
findRecord(store: Store, type: ModelSchema, id: string, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
445
425
|
/**
|
|
@@ -450,13 +430,8 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
450
430
|
promise for the resulting payload.
|
|
451
431
|
|
|
452
432
|
@public
|
|
453
|
-
@param {Store} store
|
|
454
|
-
@param {Model} type
|
|
455
|
-
@param {undefined} neverSet a value is never provided to this argument
|
|
456
|
-
@param {SnapshotRecordArray} snapshotRecordArray
|
|
457
|
-
@return {Promise} promise
|
|
458
433
|
*/
|
|
459
|
-
findAll(store: Store, type: ModelSchema,
|
|
434
|
+
findAll(store: Store, type: ModelSchema, neverUsed: null, snapshotRecordArray: SnapshotRecordArray): Promise<AdapterPayload>;
|
|
460
435
|
/**
|
|
461
436
|
Called by the store in order to fetch a JSON array for
|
|
462
437
|
the records that match a particular query.
|
|
@@ -469,12 +444,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
469
444
|
to the server as parameters.
|
|
470
445
|
|
|
471
446
|
@public
|
|
472
|
-
@param {Store} store
|
|
473
|
-
@param {Model} type
|
|
474
|
-
@param {Object} query
|
|
475
|
-
@param {Collection} recordArray
|
|
476
|
-
@param {Object} adapterOptions
|
|
477
|
-
@return {Promise} promise
|
|
478
447
|
*/
|
|
479
448
|
query(store: Store, type: ModelSchema, query: Record<string, unknown>): Promise<AdapterPayload>;
|
|
480
449
|
/**
|
|
@@ -490,11 +459,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
490
459
|
|
|
491
460
|
@since 1.13.0
|
|
492
461
|
@public
|
|
493
|
-
@param {Store} store
|
|
494
|
-
@param {Model} type
|
|
495
|
-
@param {Object} query
|
|
496
|
-
@param {Object} adapterOptions
|
|
497
|
-
@return {Promise} promise
|
|
498
462
|
*/
|
|
499
463
|
queryRecord(store: Store, type: ModelSchema, query: Record<string, unknown>, adapterOptions: Record<string, unknown>): Promise<AdapterPayload>;
|
|
500
464
|
/**
|
|
@@ -524,11 +488,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
524
488
|
promise for the resulting payload.
|
|
525
489
|
|
|
526
490
|
@public
|
|
527
|
-
@param {Store} store
|
|
528
|
-
@param {Model} type
|
|
529
|
-
@param {Array} ids
|
|
530
|
-
@param {Array} snapshots
|
|
531
|
-
@return {Promise} promise
|
|
532
491
|
*/
|
|
533
492
|
findMany(store: Store, type: ModelSchema, ids: string[], snapshots: Snapshot[]): Promise<AdapterPayload>;
|
|
534
493
|
/**
|
|
@@ -561,11 +520,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
561
520
|
* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.
|
|
562
521
|
|
|
563
522
|
@public
|
|
564
|
-
@param {Store} store
|
|
565
|
-
@param {Snapshot} snapshot
|
|
566
|
-
@param {String} url
|
|
567
|
-
@param {Object} relationship meta object describing the relationship
|
|
568
|
-
@return {Promise} promise
|
|
569
523
|
*/
|
|
570
524
|
findHasMany(store: Store, snapshot: Snapshot, url: string, relationship: Record<string, unknown>): Promise<AdapterPayload>;
|
|
571
525
|
/**
|
|
@@ -611,10 +565,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
611
565
|
of a record.
|
|
612
566
|
|
|
613
567
|
@public
|
|
614
|
-
@param {Store} store
|
|
615
|
-
@param {Model} type
|
|
616
|
-
@param {Snapshot} snapshot
|
|
617
|
-
@return {Promise} promise
|
|
618
568
|
*/
|
|
619
569
|
createRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
620
570
|
/**
|
|
@@ -628,10 +578,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
628
578
|
of a record.
|
|
629
579
|
|
|
630
580
|
@public
|
|
631
|
-
@param {Store} store
|
|
632
|
-
@param {Model} schema
|
|
633
|
-
@param {Snapshot} snapshot
|
|
634
|
-
@return {Promise} promise
|
|
635
581
|
*/
|
|
636
582
|
updateRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
637
583
|
/**
|
|
@@ -640,12 +586,11 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
640
586
|
The `deleteRecord` method makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.
|
|
641
587
|
|
|
642
588
|
@public
|
|
643
|
-
@param {Store} store
|
|
644
|
-
@param {Model} type
|
|
645
|
-
@param {Snapshot} snapshot
|
|
646
|
-
@return {Promise} promise
|
|
647
589
|
*/
|
|
648
590
|
deleteRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
591
|
+
/**
|
|
592
|
+
@private
|
|
593
|
+
*/
|
|
649
594
|
_stripIDFromURL(store: Store, snapshot: Snapshot): string;
|
|
650
595
|
maxURLLength: number;
|
|
651
596
|
/**
|
|
@@ -665,9 +610,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
665
610
|
and `/posts/2/comments/3`
|
|
666
611
|
|
|
667
612
|
@public
|
|
668
|
-
@
|
|
669
|
-
@param {Array} snapshots
|
|
670
|
-
@return {Array} an array of arrays of records, each of which is to be
|
|
613
|
+
@return an array of arrays of records, each of which is to be
|
|
671
614
|
loaded separately by `findMany`.
|
|
672
615
|
*/
|
|
673
616
|
groupRecordsForFindMany(store: Store, snapshots: Snapshot[]): Snapshot[][];
|
|
@@ -694,11 +637,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
694
637
|
|
|
695
638
|
@since 1.13.0
|
|
696
639
|
@public
|
|
697
|
-
@param {Number} status
|
|
698
|
-
@param {Object} headers
|
|
699
|
-
@param {Object} payload
|
|
700
|
-
@param {Object} requestData - the original request information
|
|
701
|
-
@return {Object | AdapterError} response
|
|
702
640
|
*/
|
|
703
641
|
handleResponse(status: number, headers: Record<string, string>, payload: Payload, requestData: RequestData): Payload | typeof AdapterError;
|
|
704
642
|
/**
|
|
@@ -707,10 +645,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
707
645
|
|
|
708
646
|
@since 1.13.0
|
|
709
647
|
@public
|
|
710
|
-
@param {Number} status
|
|
711
|
-
@param {Object} headers
|
|
712
|
-
@param {Object} payload
|
|
713
|
-
@return {Boolean}
|
|
714
648
|
*/
|
|
715
649
|
isSuccess(status: number, _headers: Record<string, unknown>, _payload: Payload): boolean;
|
|
716
650
|
/**
|
|
@@ -719,17 +653,13 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
719
653
|
|
|
720
654
|
@since 1.13.0
|
|
721
655
|
@public
|
|
722
|
-
@param {Number} status
|
|
723
|
-
@param {Object} headers
|
|
724
|
-
@param {Object} payload
|
|
725
|
-
@return {Boolean}
|
|
726
656
|
*/
|
|
727
657
|
isInvalid(status: number, _headers: Record<string, unknown>, _payload: Payload): boolean;
|
|
728
658
|
/**
|
|
729
659
|
Takes a URL, an HTTP method and a hash of data, and makes an
|
|
730
660
|
HTTP request.
|
|
731
661
|
|
|
732
|
-
When the server responds with a payload,
|
|
662
|
+
When the server responds with a payload, WarpDrive will call into `extractSingle`
|
|
733
663
|
or `extractArray` (depending on whether the original query was for one record or
|
|
734
664
|
many records).
|
|
735
665
|
|
|
@@ -743,40 +673,36 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
743
673
|
* Registers success and failure handlers.
|
|
744
674
|
|
|
745
675
|
@private
|
|
746
|
-
@param {String} url
|
|
747
|
-
@param {String} type The request type GET, POST, PUT, DELETE etc.
|
|
748
|
-
@param {Object} options
|
|
749
|
-
@return {Promise} promise
|
|
750
676
|
*/
|
|
751
677
|
ajax(url: string, type: HTTPMethod, options?: JQueryAjaxSettings | RequestInit): Promise<AdapterPayload>;
|
|
752
678
|
/**
|
|
753
679
|
@private
|
|
754
|
-
@param
|
|
680
|
+
@param options jQuery ajax options to be used for the ajax request
|
|
755
681
|
*/
|
|
756
682
|
_ajaxRequest(options: JQueryRequestInit): void;
|
|
683
|
+
/**
|
|
684
|
+
@private
|
|
685
|
+
*/
|
|
757
686
|
_fetchRequest(options: FetchRequestInit): Promise<Response>;
|
|
687
|
+
/**
|
|
688
|
+
@private
|
|
689
|
+
*/
|
|
758
690
|
_ajax(options: FetchRequestInit | JQueryRequestInit): void;
|
|
759
691
|
/**
|
|
760
692
|
@private
|
|
761
|
-
@param {String} url
|
|
762
|
-
@param {String} type The request type GET, POST, PUT, DELETE etc.
|
|
763
|
-
@param {Object} options
|
|
764
|
-
@return {Object}
|
|
765
693
|
*/
|
|
766
694
|
ajaxOptions(url: string, method: HTTPMethod, options: JQueryAjaxSettings | RequestInit): JQueryRequestInit | FetchRequestInit;
|
|
695
|
+
/**
|
|
696
|
+
* @private
|
|
697
|
+
*/
|
|
767
698
|
_ajaxURL(url: string): string;
|
|
768
699
|
/**
|
|
769
700
|
@private
|
|
770
|
-
@param {String} responseText
|
|
771
|
-
@return {Object}
|
|
772
701
|
*/
|
|
773
702
|
parseErrorResponse(responseText: string): Record<string, unknown> | string;
|
|
774
703
|
/**
|
|
775
704
|
@private
|
|
776
|
-
@
|
|
777
|
-
@param {Object} headers
|
|
778
|
-
@param {Object} payload
|
|
779
|
-
@return {Array} errors payload
|
|
705
|
+
@return errors payload
|
|
780
706
|
*/
|
|
781
707
|
normalizeErrorResponse(status: number, _headers: Record<string, unknown>, payload: Payload): Record<string, unknown>[];
|
|
782
708
|
/**
|
|
@@ -784,11 +710,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
784
710
|
of information for debugging (good luck!)
|
|
785
711
|
|
|
786
712
|
@private
|
|
787
|
-
@
|
|
788
|
-
@param {Object} headers
|
|
789
|
-
@param {Object} payload
|
|
790
|
-
@param {Object} requestData
|
|
791
|
-
@return {String} detailed error message
|
|
713
|
+
@return detailed error message
|
|
792
714
|
*/
|
|
793
715
|
generatedDetailedMessage(status: number, headers: Record<string, string>, payload: Payload, requestData: RequestData): string;
|
|
794
716
|
/**
|
|
@@ -797,8 +719,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
797
719
|
|
|
798
720
|
@since 2.5.0
|
|
799
721
|
@public
|
|
800
|
-
@param {Snapshot} snapshot
|
|
801
|
-
@return {Object}
|
|
802
722
|
*/
|
|
803
723
|
buildQuery(snapshot: Snapshot | SnapshotRecordArray): QueryState;
|
|
804
724
|
}
|
|
@@ -806,10 +726,7 @@ interface RESTAdapter extends MixtBuildURLMixin {}
|
|
|
806
726
|
/**
|
|
807
727
|
* Helper function that translates the options passed to `jQuery.ajax` into a format that `fetch` expects.
|
|
808
728
|
*
|
|
809
|
-
* @param {Object} _options
|
|
810
|
-
* @param {Adapter} adapter
|
|
811
729
|
* @private
|
|
812
|
-
* @return {Object}
|
|
813
730
|
*/
|
|
814
731
|
export declare function fetchOptions(options: JQueryRequestInit & Partial<FetchRequestInit>, adapter: RESTAdapter): FetchRequestInit;
|
|
815
732
|
export { RESTAdapter };
|
|
@@ -453,10 +453,10 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
453
453
|
|
|
454
454
|
The updateRecord method is expected to return a promise that will
|
|
455
455
|
resolve with the serialized record. This allows the backend to
|
|
456
|
-
inform the
|
|
456
|
+
inform the WarpDrive store the current state of this record after
|
|
457
457
|
the update. If it is not possible to return a serialized record
|
|
458
458
|
the updateRecord promise can also resolve with `undefined` and the
|
|
459
|
-
|
|
459
|
+
WarpDrive store will assume all of the updates were successfully
|
|
460
460
|
applied on the backend.
|
|
461
461
|
|
|
462
462
|
Example
|
|
@@ -19,16 +19,16 @@ This function builds a request config to perform a `findAll` request for the giv
|
|
|
19
19
|
When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.
|
|
20
20
|
Additionally, it takes the same options as `store.findAll`.
|
|
21
21
|
|
|
22
|
-
All `@
|
|
22
|
+
All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
23
23
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
24
|
-
To that end, these builders are deprecated and will be removed in a future version of
|
|
24
|
+
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
25
25
|
|
|
26
26
|
@deprecated
|
|
27
27
|
@public
|
|
28
|
-
@param
|
|
29
|
-
@param
|
|
30
|
-
@param
|
|
31
|
-
@return
|
|
28
|
+
@param type the name of the resource
|
|
29
|
+
@param query a query to be used by the adapter
|
|
30
|
+
@param options optional, may include `adapterOptions` hash which will be passed to adapter.findAll
|
|
31
|
+
@return request config
|
|
32
32
|
*/
|
|
33
33
|
export declare function findAllBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, options?: FindAllBuilderOptions): FindAllRequestInput<TypeFromInstance<T>, T[]>;
|
|
34
34
|
export declare function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;
|
|
@@ -23,7 +23,7 @@ Additionally, it takes the same options as `store.findRecord`, with the exceptio
|
|
|
23
23
|
**Example 1**
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
|
-
import { findRecord } from '@
|
|
26
|
+
import { findRecord } from '@warp-drive/legacy/compat/builders';
|
|
27
27
|
const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -34,20 +34,20 @@ of `type` (modelName) and `id` as separate arguments. You may recognize this com
|
|
|
34
34
|
the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
import { findRecord } from '@
|
|
37
|
+
import { findRecord } from '@warp-drive/legacy/compat/builders';
|
|
38
38
|
const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
All `@
|
|
41
|
+
All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
42
42
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
43
|
-
To that end, these builders are deprecated and will be removed in a future version of
|
|
43
|
+
To that end, these builders are deprecated and will be removed in a future version of Warp Drive.
|
|
44
44
|
|
|
45
45
|
@deprecated
|
|
46
46
|
@public
|
|
47
|
-
@param
|
|
48
|
-
@param
|
|
49
|
-
@param
|
|
50
|
-
@return
|
|
47
|
+
@param resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
|
|
48
|
+
@param id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved
|
|
49
|
+
@param options - if the first param is a string this will be the optional options for the request. See examples for available options.
|
|
50
|
+
@return request config
|
|
51
51
|
*/
|
|
52
52
|
export declare function findRecordBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput<TypeFromInstance<T>, T>;
|
|
53
53
|
export declare function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;
|
|
@@ -20,16 +20,16 @@ This function builds a request config for a given type and query object.
|
|
|
20
20
|
When passed to `store.request`, this config will result in the same behavior as a `store.query` request.
|
|
21
21
|
Additionally, it takes the same options as `store.query`.
|
|
22
22
|
|
|
23
|
-
All `@
|
|
23
|
+
All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
24
24
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
25
|
-
To that end, these builders are deprecated and will be removed in a future version of
|
|
25
|
+
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
26
26
|
|
|
27
27
|
@deprecated
|
|
28
28
|
@public
|
|
29
|
-
@param
|
|
30
|
-
@param
|
|
31
|
-
@param
|
|
32
|
-
@return
|
|
29
|
+
@param type the name of the resource
|
|
30
|
+
@param query a query to be used by the adapter
|
|
31
|
+
@param options optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
32
|
+
@return request config
|
|
33
33
|
*/
|
|
34
34
|
export declare function queryBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRequestInput<TypeFromInstance<T>, T[]>;
|
|
35
35
|
export declare function queryBuilder(type: string, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRequestInput;
|
|
@@ -50,16 +50,16 @@ This function builds a request config for a given type and query object.
|
|
|
50
50
|
When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.
|
|
51
51
|
Additionally, it takes the same options as `store.queryRecord`.
|
|
52
52
|
|
|
53
|
-
All `@
|
|
53
|
+
All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
54
54
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
55
|
-
To that end, these builders are deprecated and will be removed in a future version of
|
|
55
|
+
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
56
56
|
|
|
57
57
|
@deprecated
|
|
58
58
|
@public
|
|
59
|
-
@param
|
|
60
|
-
@param
|
|
61
|
-
@param
|
|
62
|
-
@return
|
|
59
|
+
@param type the name of the resource
|
|
60
|
+
@param query a query to be used by the adapter
|
|
61
|
+
@param options optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
62
|
+
@return request config
|
|
63
63
|
*/
|
|
64
64
|
export declare function queryRecordBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;
|
|
65
65
|
export declare function queryRecordBuilder(type: string, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRecordRequestInput;
|