@warp-drive/legacy 5.8.0-alpha.4 → 5.8.0-alpha.40
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 +5 -5
- package/declarations/adapter/json-api.d.ts +6 -8
- package/declarations/adapter/rest.d.ts +5 -8
- package/declarations/adapter.d.ts +4 -6
- package/declarations/compat/-private.d.ts +1 -1
- 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/extensions.d.ts +1 -1
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +7 -9
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +20 -30
- package/declarations/compat/utils.d.ts +17 -17
- package/declarations/compat.d.ts +35 -11
- package/declarations/index.d.ts +70 -0
- package/declarations/model/-private/attr.d.ts +5 -6
- package/declarations/model/-private/belongs-to.d.ts +4 -5
- package/declarations/model/-private/has-many.d.ts +4 -5
- package/declarations/model/-private/hooks.d.ts +1 -1
- package/declarations/model/-private/legacy-relationships-support.d.ts +2 -2
- package/declarations/model/-private/model.d.ts +8 -8
- package/declarations/model/-private/record-state.d.ts +1 -1
- package/declarations/model/-private/references/belongs-to.d.ts +5 -5
- package/declarations/model/-private/references/has-many.d.ts +3 -3
- package/declarations/model/migration-support.d.ts +46 -21
- 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 -6
- package/declarations/serializer/-private/transforms/boolean.d.ts +2 -2
- package/declarations/serializer/-private/transforms/date.d.ts +2 -2
- package/declarations/serializer/-private/transforms/number.d.ts +1 -1
- package/declarations/serializer/-private/transforms/string.d.ts +1 -1
- package/declarations/serializer/json-api.d.ts +7 -9
- package/declarations/serializer/json.d.ts +7 -9
- package/declarations/serializer/rest.d.ts +4 -6
- package/declarations/serializer.d.ts +9 -12
- package/dist/{-private-8UmnAf9J.js → -private-B1pSSN52.js} +1 -1
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/error.js +12 -13
- package/dist/adapter/json-api.js +4 -1
- package/dist/adapter/rest.js +6 -9
- package/dist/adapter.js +4 -6
- package/dist/compat/-private.js +1 -1
- package/dist/compat/builders.js +26 -26
- package/dist/compat/utils.js +17 -18
- package/dist/compat.js +58 -41
- package/dist/{errors-8kD2mSe_.js → errors-CIGPcDvd.js} +87 -65
- package/dist/hooks-QqRnX108.js +74 -0
- package/dist/index.js +195 -0
- package/dist/{json-DziiodPf.js → json-BNrV8EYG.js} +12 -16
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +54 -24
- package/dist/model-for-CqXsIKws.js +221 -0
- package/dist/model-fragments.js +76 -0
- package/dist/model.js +18 -90
- package/dist/{schema-provider-DQu4Rjco.js → schema-provider-g5MfTj8n.js} +18 -20
- package/dist/{serialize-into-hash-CS0MIv4F.js → serialize-into-hash-BnYvPex3.js} +1 -1
- package/dist/serializer/json-api.js +17 -44
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +14 -21
- package/dist/serializer/transform.js +15 -6
- package/dist/serializer.js +9 -13
- package/dist/store.js +3 -0
- package/dist/unpkg/dev/-private-DbaSCSym.js +1205 -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 +1255 -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 +1146 -0
- package/dist/unpkg/dev/errors-DD96TBEs.js +2591 -0
- package/dist/unpkg/dev/hooks-CqWjNWeL.js +73 -0
- package/dist/unpkg/dev/index.js +197 -0
- package/dist/unpkg/dev/json-CCU-ZQ4b.js +1269 -0
- package/dist/unpkg/dev/model/-private.js +1 -0
- package/dist/unpkg/dev/model/migration-support.js +551 -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-B8jiJOYC.js +2229 -0
- package/dist/unpkg/dev/serialize-into-hash-CPAZXrQU.js +259 -0
- package/dist/unpkg/dev/serializer/json-api.js +648 -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 +636 -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-DbaSCSym.js +1205 -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 +1255 -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 +1146 -0
- package/dist/unpkg/dev-deprecated/errors-DEnabIZj.js +2594 -0
- package/dist/unpkg/dev-deprecated/hooks-CAll-Ets.js +73 -0
- package/dist/unpkg/dev-deprecated/index.js +196 -0
- package/dist/unpkg/dev-deprecated/json-CCU-ZQ4b.js +1269 -0
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/model/migration-support.js +568 -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-k2qXQTBg.js +2254 -0
- package/dist/unpkg/dev-deprecated/serialize-into-hash-CPAZXrQU.js +259 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +648 -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 +636 -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-Cvf_97EG.js +970 -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 +1218 -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 +726 -0
- package/dist/unpkg/prod/errors-CXnfnBfQ.js +2343 -0
- package/dist/unpkg/prod/hooks-DvyWhLNg.js +41 -0
- package/dist/unpkg/prod/index.js +151 -0
- package/dist/unpkg/prod/json-BYrUP8ao.js +1256 -0
- package/dist/unpkg/prod/model/-private.js +1 -0
- package/dist/unpkg/prod/model/migration-support.js +544 -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-CHujJvA9.js +1904 -0
- package/dist/unpkg/prod/serialize-into-hash-DYU2egXl.js +215 -0
- package/dist/unpkg/prod/serializer/json-api.js +591 -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 +504 -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-Cvf_97EG.js +970 -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 +1218 -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 +726 -0
- package/dist/unpkg/prod-deprecated/errors-CG1SPYVg.js +2346 -0
- package/dist/unpkg/prod-deprecated/hooks-BIUBiNGR.js +41 -0
- package/dist/unpkg/prod-deprecated/index.js +150 -0
- package/dist/unpkg/prod-deprecated/json-BYrUP8ao.js +1256 -0
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/model/migration-support.js +561 -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-BJ4TWnZf.js +1947 -0
- package/dist/unpkg/prod-deprecated/serialize-into-hash-DYU2egXl.js +215 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +591 -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 +504 -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
|
|
|
@@ -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;
|
|
@@ -8,13 +8,11 @@ import { RESTAdapter } from "./rest.js";
|
|
|
8
8
|
/**
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
11
|
+
:::danger
|
|
12
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
14
13
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</blockquote>
|
|
14
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
15
|
+
:::
|
|
18
16
|
|
|
19
17
|
The `JSONAPIAdapter` is an adapter whichtransforms the store's
|
|
20
18
|
requests into HTTP requests that follow the [JSON API format](http://jsonapi.org/format/).
|
|
@@ -120,7 +118,7 @@ Endpoint paths can be prefixed with a `namespace` by setting the
|
|
|
120
118
|
namespace property on the adapter:
|
|
121
119
|
|
|
122
120
|
```js [app/adapters/application.js]
|
|
123
|
-
import JSONAPIAdapter from '@
|
|
121
|
+
import JSONAPIAdapter from '@warp-drive/legacy/adapter/json-api';
|
|
124
122
|
|
|
125
123
|
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
126
124
|
namespace = 'api/1';
|
|
@@ -133,7 +131,7 @@ Requests for the `person` model would now target `/api/1/people/1`.
|
|
|
133
131
|
An adapter can target other hosts by setting the `host` property.
|
|
134
132
|
|
|
135
133
|
```js [app/adapters/application.js]
|
|
136
|
-
import JSONAPIAdapter from '@
|
|
134
|
+
import JSONAPIAdapter from '@warp-drive/legacy/adapter/json-api';
|
|
137
135
|
|
|
138
136
|
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
139
137
|
host = 'https://api.example.com';
|
|
@@ -31,13 +31,11 @@ export type RequestData = {
|
|
|
31
31
|
};
|
|
32
32
|
declare const AdapterWithBuildURLMixin: Readonly<typeof Adapter> & (new (owner?: Owner) => Adapter) & Mixin;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
34
|
+
* :::danger
|
|
35
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
37
36
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</blockquote>
|
|
37
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
38
|
+
:::
|
|
41
39
|
|
|
42
40
|
The REST adapter allows your store to communicate with an HTTP server by
|
|
43
41
|
transmitting JSON via XHR.
|
|
@@ -406,8 +404,7 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
406
404
|
Some APIs require HTTP headers, e.g. to provide an API
|
|
407
405
|
key. Arbitrary headers can be set as key/value pairs on the
|
|
408
406
|
`RESTAdapter`'s `headers` object and Ember Data will send them
|
|
409
|
-
along with each ajax request
|
|
410
|
-
customization](/ember-data/release/classes/RESTAdapter).
|
|
407
|
+
along with each ajax request..
|
|
411
408
|
|
|
412
409
|
```js [app/adapters/application.js]
|
|
413
410
|
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ## Overview
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
4
|
+
* :::danger
|
|
5
|
+
* ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
7
6
|
* If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* </blockquote>
|
|
7
|
+
* {@link Handler} instead to be used with the {@link RequestManager}
|
|
8
|
+
* ::::
|
|
11
9
|
*
|
|
12
10
|
* In order to properly fetch and update data, @warp-drive/legacy
|
|
13
11
|
* needs to understand how to connect to your API.
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type default as EmberObject } from "@ember/object";
|
|
2
|
-
import type { CAUTION_MEGA_DANGER_ZONE_Extension } from "@warp-drive/core/reactive
|
|
2
|
+
import type { CAUTION_MEGA_DANGER_ZONE_Extension } from "@warp-drive/core/reactive";
|
|
3
3
|
declare const EmberObjectMethods: readonly ["addObserver", "cacheFor", "decrementProperty", "get", "getProperties", "incrementProperty", "notifyPropertyChange", "removeObserver", "set", "setProperties", "toggleProperty"];
|
|
4
4
|
export declare const EmberObjectArrayExtension: CAUTION_MEGA_DANGER_ZONE_Extension;
|
|
5
5
|
export declare const EmberObjectExtension: CAUTION_MEGA_DANGER_ZONE_Extension;
|
|
@@ -7,13 +7,11 @@ import type { SnapshotRecordArray } from "./snapshot-record-array.js";
|
|
|
7
7
|
type Group = Snapshot[];
|
|
8
8
|
export type AdapterPayload = Record<string, unknown> | unknown[];
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
10
|
+
* :::danger
|
|
11
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
13
12
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</blockquote>
|
|
13
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
14
|
+
:::
|
|
17
15
|
|
|
18
16
|
The following documentation describes the methods an
|
|
19
17
|
adapter should implement with descriptions around when an
|
|
@@ -170,7 +168,7 @@ export interface MinimumAdapterInterface {
|
|
|
170
168
|
* let error = new Error(errorMessage);
|
|
171
169
|
*
|
|
172
170
|
* // these two properties combined
|
|
173
|
-
* // alert
|
|
171
|
+
* // alert WarpDrive to this error being for
|
|
174
172
|
* // invalid properties on the record during
|
|
175
173
|
* // the request
|
|
176
174
|
* error.isAdapterError = true;
|
|
@@ -221,7 +219,7 @@ export interface MinimumAdapterInterface {
|
|
|
221
219
|
* let error = new Error(errorMessage);
|
|
222
220
|
*
|
|
223
221
|
* // these two properties combined
|
|
224
|
-
* // alert
|
|
222
|
+
* // alert WarpDrive to this error being for
|
|
225
223
|
* // invalid properties on the record during
|
|
226
224
|
* // the request
|
|
227
225
|
* error.isAdapterError = true;
|
|
@@ -404,7 +402,7 @@ export interface MinimumAdapterInterface {
|
|
|
404
402
|
*
|
|
405
403
|
* A group is an array of snapshots meant to be fetched together by a single `findMany` request.
|
|
406
404
|
*
|
|
407
|
-
* By default if this method is not implemented
|
|
405
|
+
* By default if this method is not implemented WarpDrive will call `findMany` once with all
|
|
408
406
|
* requested records as a single group when `coalesceFindRequests` is `true`.
|
|
409
407
|
*
|
|
410
408
|
* See also `findMany` and `coalesceFindRequests`
|
|
@@ -9,13 +9,11 @@ export type SerializerOptions = {
|
|
|
9
9
|
};
|
|
10
10
|
export type RequestType = "findRecord" | "queryRecord" | "findAll" | "findBelongsTo" | "findHasMany" | "findMany" | "query" | "createRecord" | "deleteRecord" | "updateRecord";
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.
|
|
12
|
+
* :::danger
|
|
13
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
15
14
|
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</blockquote>
|
|
15
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
16
|
+
:::
|
|
19
17
|
|
|
20
18
|
The following documentation describes the methods an application
|
|
21
19
|
serializer should implement with descriptions around when an
|
|
@@ -23,7 +21,6 @@ application might expect these methods to be called.
|
|
|
23
21
|
|
|
24
22
|
Methods that are not required are marked as **optional**.
|
|
25
23
|
|
|
26
|
-
@class (Interface) Serializer
|
|
27
24
|
@public
|
|
28
25
|
*/
|
|
29
26
|
export interface MinimumSerializerInterface {
|
|
@@ -43,23 +40,22 @@ export interface MinimumSerializerInterface {
|
|
|
43
40
|
* and [Resource Identifier Objects](https://jsonapi.org/format/#document-resource-identifier-objects)
|
|
44
41
|
*
|
|
45
42
|
* @public
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
43
|
+
* @param store The store service that initiated the request being normalized
|
|
44
|
+
* @param schema An object with methods for accessing information about
|
|
48
45
|
* the type, attributes and relationships of the primary type associated with the request.
|
|
49
|
-
* @param
|
|
46
|
+
* @param rawPayload The raw JSON response data returned from an API request.
|
|
50
47
|
* This correlates to the value the promise returned by the adapter method that performed
|
|
51
48
|
* the request resolved to.
|
|
52
|
-
* @param
|
|
49
|
+
* @param id For a findRecord request, this is the id initially provided
|
|
53
50
|
* in the call to store.findRecord. Else this value is null.
|
|
54
|
-
* @param
|
|
55
|
-
* type of request the Adapter had been asked to perform.
|
|
51
|
+
* @param requestType The type of request the Adapter had been asked to perform.
|
|
56
52
|
*
|
|
57
|
-
* @return
|
|
53
|
+
* @return a document following the structure of a [{json:api} Document](https://jsonapi.org/format/#document-structure).
|
|
58
54
|
*/
|
|
59
55
|
normalizeResponse(store: Store, schema: ModelSchema, rawPayload: AdapterPayload, id: string | null, requestType: "findRecord" | "queryRecord" | "findAll" | "findBelongsTo" | "findHasMany" | "findMany" | "query" | "createRecord" | "deleteRecord" | "updateRecord"): JsonApiDocument;
|
|
60
56
|
/**
|
|
61
57
|
* This method is responsible for serializing an individual record
|
|
62
|
-
* via a
|
|
58
|
+
* via a {@link Snapshot} into the format expected by the API.
|
|
63
59
|
*
|
|
64
60
|
* This method is called by `snapshot.serialize()`.
|
|
65
61
|
*
|
|
@@ -70,8 +66,7 @@ export interface MinimumSerializerInterface {
|
|
|
70
66
|
* is not implemented.
|
|
71
67
|
*
|
|
72
68
|
* @public
|
|
73
|
-
* @param
|
|
74
|
-
* @param {Object} [options]
|
|
69
|
+
* @param snapshot A Snapshot for the record to serialize
|
|
75
70
|
*/
|
|
76
71
|
serialize(snapshot: Snapshot, options?: SerializerOptions): ObjectValue;
|
|
77
72
|
/**
|
|
@@ -118,14 +113,12 @@ export interface MinimumSerializerInterface {
|
|
|
118
113
|
*
|
|
119
114
|
* @public
|
|
120
115
|
* @optional
|
|
121
|
-
* @param
|
|
116
|
+
* @param schema An object with methods for accessing information about
|
|
122
117
|
* the type, attributes and relationships of the primary type associated with the request.
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
118
|
+
* @param rawPayload Some raw JSON data to be normalized into a JSON:API Resource.
|
|
119
|
+
* @param prop When called by the EmbeddedRecordsMixin this param will be the
|
|
125
120
|
* property at which the object provided as rawPayload was found.
|
|
126
|
-
* @return
|
|
127
|
-
* containing a single JSON:API Resource
|
|
128
|
-
* as its primary data.
|
|
121
|
+
* @return A JSON:API Document containing a single JSON:API Resource as its primary data.
|
|
129
122
|
*/
|
|
130
123
|
normalize?(schema: ModelSchema, rawPayload: ObjectValue, prop?: string): SingleResourceDocument;
|
|
131
124
|
/**
|
|
@@ -161,11 +154,9 @@ export interface MinimumSerializerInterface {
|
|
|
161
154
|
* @optional
|
|
162
155
|
* @param hash A top most object of the request payload onto
|
|
163
156
|
* which to append the serialized record
|
|
164
|
-
* @param
|
|
157
|
+
* @param schema An object with methods for accessing information about
|
|
165
158
|
* the type, attributes and relationships of the primary type associated with the request.
|
|
166
|
-
* @param
|
|
167
|
-
* @param [options]
|
|
168
|
-
* @return {void}
|
|
159
|
+
* @param snapshot A Snapshot for the record to serialize
|
|
169
160
|
*/
|
|
170
161
|
serializeIntoHash?(hash: object, schema: ModelSchema, snapshot: Snapshot, options?: SerializerOptions): void;
|
|
171
162
|
/**
|
|
@@ -204,10 +195,9 @@ export interface MinimumSerializerInterface {
|
|
|
204
195
|
*
|
|
205
196
|
* @public
|
|
206
197
|
* @optional
|
|
207
|
-
* @param
|
|
208
|
-
* @param
|
|
198
|
+
* @param store The store service that initiated the request being normalized
|
|
199
|
+
* @param rawPayload The raw JSON response data returned from an API request.
|
|
209
200
|
* This JSON should be in the API format expected by the serializer.
|
|
210
|
-
* @return {void}
|
|
211
201
|
*/
|
|
212
202
|
pushPayload?(store: Store, rawPayload: ObjectValue): void;
|
|
213
203
|
/**
|
|
@@ -4,7 +4,7 @@ type Reporter = (type: "formatted-id" | "formatted-type", actual: unknown, expec
|
|
|
4
4
|
* changes during normalization. This is useful for instrumenting
|
|
5
5
|
* to discover places where usage in the app is not consistent.
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
7
|
+
* @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export declare function configureMismatchReporter(fn: Reporter): void;
|
|
@@ -13,7 +13,7 @@ export declare function configureMismatchReporter(fn: Reporter): void;
|
|
|
13
13
|
* fails validation. This is useful for instrumenting
|
|
14
14
|
* to discover places where usage in the app is not consistent.
|
|
15
15
|
*
|
|
16
|
-
* @param
|
|
16
|
+
* @param fn - a function which takes a message and a condition
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export declare function configureAssertFn(fn: (message: string, condition: unknown) => void): void;
|
|
@@ -27,13 +27,13 @@ export declare function configureAssertFn(fn: (message: string, condition: unkno
|
|
|
27
27
|
* the configured mismatch reporter and assert functions will
|
|
28
28
|
* be called.
|
|
29
29
|
*
|
|
30
|
-
* @param
|
|
30
|
+
* @param fn - a function which takes a string and returns a string
|
|
31
31
|
* @public
|
|
32
32
|
*/
|
|
33
33
|
export declare function configureTypeNormalization(fn: (type: string) => string): void;
|
|
34
34
|
/**
|
|
35
35
|
* Converts a potentially unnormalized type into the format expected
|
|
36
|
-
* by our
|
|
36
|
+
* by our WarpDrive Cache. Currently this is singular-dasherized.
|
|
37
37
|
*
|
|
38
38
|
* you should not rely on this function to give you an exact format
|
|
39
39
|
* for display purposes. Formatting for display should be handled
|
|
@@ -56,13 +56,13 @@ export declare function configureTypeNormalization(fn: (type: string) => string)
|
|
|
56
56
|
* formattedType('PostComment'); // => 'post-comment'
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
|
-
* @param
|
|
60
|
-
* @return
|
|
59
|
+
* @param type the potentially un-normalized type
|
|
60
|
+
* @return the normalized type
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
63
|
export declare function formattedType<T extends string>(type: T | string): T;
|
|
64
64
|
/**
|
|
65
|
-
* Format an id to the format expected by the
|
|
65
|
+
* Format an id to the format expected by the WarpDrive Cache.
|
|
66
66
|
* Currently this means that id should be `string | null`.
|
|
67
67
|
*
|
|
68
68
|
* Asserts invalid IDs (undefined, '', 0, '0') in dev.
|
|
@@ -77,8 +77,8 @@ export declare function formattedType<T extends string>(type: T | string): T;
|
|
|
77
77
|
* formattedId(null); // => null
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
80
|
-
* @param
|
|
81
|
-
* @return
|
|
80
|
+
* @param id the potentially un-normalized id
|
|
81
|
+
* @return the normalized id
|
|
82
82
|
* @public
|
|
83
83
|
*/
|
|
84
84
|
export declare function formattedId(id: string | number): string;
|
|
@@ -88,7 +88,7 @@ export declare function expectId(id: string | number): string;
|
|
|
88
88
|
export declare function expectId(id: null): never;
|
|
89
89
|
/**
|
|
90
90
|
* Compares two types for strict equality, converting them to
|
|
91
|
-
* the format expected by the
|
|
91
|
+
* the format expected by the WarpDrive Cache to ensure
|
|
92
92
|
* differences in format are accounted for in the comparison.
|
|
93
93
|
*
|
|
94
94
|
* Asserts when expected or actual are invalid types in dev.
|
|
@@ -106,15 +106,15 @@ export declare function expectId(id: null): never;
|
|
|
106
106
|
* isEquivType('posts', null); // false
|
|
107
107
|
* ```
|
|
108
108
|
*
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
111
|
-
* @return
|
|
109
|
+
* @param expected a potentially unnormalized type to match against
|
|
110
|
+
* @param actual a potentially unnormalized type to match against
|
|
111
|
+
* @return true if the types are equivalent
|
|
112
112
|
* @public
|
|
113
113
|
*/
|
|
114
114
|
export declare function isEquivType(expected: string, actual: string): boolean;
|
|
115
115
|
/**
|
|
116
116
|
* Compares two IDs for strict equality, converting them to
|
|
117
|
-
* the format expected by the
|
|
117
|
+
* the format expected by the WarpDrive Cache to ensure
|
|
118
118
|
* differences in format are accounted for in the comparison.
|
|
119
119
|
*
|
|
120
120
|
* Asserts when expected or actual are invalid IDs in dev.
|
|
@@ -128,9 +128,9 @@ export declare function isEquivType(expected: string, actual: string): boolean;
|
|
|
128
128
|
* isEquivId(1, null); // false
|
|
129
129
|
* ```
|
|
130
130
|
*
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @return
|
|
131
|
+
* @param expected a potentially un-normalized id to match against
|
|
132
|
+
* @param actual a potentially un-normalized id to match against
|
|
133
|
+
* @return true if the ids are equivalent
|
|
134
134
|
* @public
|
|
135
135
|
*/
|
|
136
136
|
export declare function isEquivId(expected: string | number, actual: string | number | null): boolean;
|