@warp-drive/legacy 5.10.0-alpha.13 → 5.10.0-alpha.14
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/dist/adapter/json-api.d.ts +5 -0
- package/dist/adapter/json-api.d.ts.map +1 -1
- package/dist/adapter.d.ts +218 -0
- package/dist/compat/builders.d.ts +12 -0
- package/dist/compat/builders.d.ts.map +1 -1
- package/dist/compat/extensions.d.ts +5 -0
- package/dist/compat/utils.d.ts +1 -0
- package/dist/{errors-BI0Xugyo.js → errors-DdSAsjym.js} +20 -7
- package/dist/errors-DdSAsjym.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.d.ts +1 -0
- package/dist/model/migration-support.js +2 -2
- package/dist/model-BPVLf-rp.d.ts.map +1 -1
- package/dist/{model-DdlhdL9V.js → model-CZ9xrojs.js} +3 -3
- package/dist/{model-DdlhdL9V.js.map → model-CZ9xrojs.js.map} +1 -1
- package/dist/model-fragments.d.ts +5 -0
- package/dist/model-fragments.d.ts.map +1 -1
- package/dist/model.d.ts +68 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -2
- package/dist/{schema-provider-Dyjpau2P.js → schema-provider-D49Ve3RX.js} +2 -2
- package/dist/{schema-provider-Dyjpau2P.js.map → schema-provider-D49Ve3RX.js.map} +1 -1
- package/dist/serializer/transform.d.ts +5 -0
- package/dist/serializer/transform.d.ts.map +1 -1
- package/dist/serializer.d.ts +143 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/store.d.ts +5 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/unpkg/dev/{errors-TUXPdiG8.js → errors-DcpficrE.js} +20 -7
- package/dist/unpkg/dev/errors-DcpficrE.js.map +1 -0
- package/dist/unpkg/dev/index.js +2 -2
- package/dist/unpkg/dev/model/-private.js +1 -1
- package/dist/unpkg/dev/model/migration-support.js +2 -2
- package/dist/unpkg/dev/{model-OQxvzZu6.js → model-C_M8bbIa.js} +3 -3
- package/dist/unpkg/dev/{model-OQxvzZu6.js.map → model-C_M8bbIa.js.map} +1 -1
- package/dist/unpkg/dev/model.js +2 -2
- package/dist/unpkg/dev/{schema-provider-Qxo5AVFM.js → schema-provider-BFAx8tuf.js} +2 -2
- package/dist/unpkg/dev/{schema-provider-Qxo5AVFM.js.map → schema-provider-BFAx8tuf.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{errors-CLRhQKym.js → errors-DoY5NrDy.js} +20 -7
- package/dist/unpkg/dev-deprecated/errors-DoY5NrDy.js.map +1 -0
- package/dist/unpkg/dev-deprecated/index.js +2 -2
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/model/migration-support.js +2 -2
- package/dist/unpkg/dev-deprecated/{model-DIvuaUiJ.js → model-BnkEa2WH.js} +3 -3
- package/dist/unpkg/dev-deprecated/{model-DIvuaUiJ.js.map → model-BnkEa2WH.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/model.js +2 -2
- package/dist/unpkg/dev-deprecated/{schema-provider-DHS8XOdK.js → schema-provider-CQ5d1aV0.js} +2 -2
- package/dist/unpkg/dev-deprecated/{schema-provider-DHS8XOdK.js.map → schema-provider-CQ5d1aV0.js.map} +1 -1
- package/dist/unpkg/prod/{errors-CImmK4OM.js → errors-j5uTW55X.js} +17 -4
- package/dist/unpkg/prod/errors-j5uTW55X.js.map +1 -0
- package/dist/unpkg/prod/index.js +2 -2
- package/dist/unpkg/prod/model/-private.js +1 -1
- package/dist/unpkg/prod/model/migration-support.js +2 -2
- package/dist/unpkg/prod/{model-_HpfLmtZ.js → model-DkbC6ZOe.js} +3 -3
- package/dist/unpkg/prod/{model-_HpfLmtZ.js.map → model-DkbC6ZOe.js.map} +1 -1
- package/dist/unpkg/prod/model.js +2 -2
- package/dist/unpkg/prod/{schema-provider-DEe5vZ8b.js → schema-provider-TW2W0ICA.js} +2 -2
- package/dist/unpkg/prod/{schema-provider-DEe5vZ8b.js.map → schema-provider-TW2W0ICA.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{errors-DIOUcGAT.js → errors-CfqH-9P7.js} +17 -4
- package/dist/unpkg/prod-deprecated/errors-CfqH-9P7.js.map +1 -0
- package/dist/unpkg/prod-deprecated/index.js +2 -2
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/model/migration-support.js +2 -2
- package/dist/unpkg/prod-deprecated/{model-wzHTp8Up.js → model-B7HrtFg9.js} +3 -3
- package/dist/unpkg/prod-deprecated/{model-wzHTp8Up.js.map → model-B7HrtFg9.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/model.js +2 -2
- package/dist/unpkg/prod-deprecated/{schema-provider-NWVqBEkW.js → schema-provider-CahhkXLW.js} +2 -2
- package/dist/unpkg/prod-deprecated/{schema-provider-NWVqBEkW.js.map → schema-provider-CahhkXLW.js.map} +1 -1
- package/logos/README.md +1 -1
- package/package.json +8 -8
- package/dist/errors-BI0Xugyo.js.map +0 -1
- package/dist/unpkg/dev/errors-TUXPdiG8.js.map +0 -1
- package/dist/unpkg/dev-deprecated/errors-CLRhQKym.js.map +0 -1
- package/dist/unpkg/prod/errors-CImmK4OM.js.map +0 -1
- package/dist/unpkg/prod-deprecated/errors-DIOUcGAT.js.map +0 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @summary Legacy `JSONAPIAdapter`, which turns store requests into HTTP requests following JSON:API URL, verb and
|
|
4
|
+
* header conventions.
|
|
5
|
+
*/
|
|
1
6
|
import { _ as AdapterPayload, m as Snapshot, p as SnapshotRecordArray } from "../compat-BZlQ-5eI.js";
|
|
2
7
|
import { i as RESTAdapter, n as JQueryRequestInit, r as QueryState, t as FetchRequestInit } from "../rest-ddU-K5eS.js";
|
|
3
8
|
import { Store } from "@warp-drive/core";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-api.d.ts","names":[],"sources":["../../src/adapter/json-api.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-api.d.ts","names":[],"sources":["../../src/adapter/json-api.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmKM,uBAAuB;;;;;EAK3B;;;;;;;;EASA,YACE,aACA,MAAM,YACN,UAAS,qBAAqB,cAC7B,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgEnB;MAQA,qBAAqB;EAIzB,SAAS,OAAO,OAAO,MAAM,aAAa,eAAe,WAAW,aAAa,QAAQ;;;;;;;;EAYzF,YAAY;EAKZ,aAAa,OAAO,OAAO,QAAQ,aAAa,UAAU,WAAW,QAAQ;;;;;;;;;;EAoB7E,WAAW,UAAU,WAAW,sBAAsB"}
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,2 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ## Overview
|
|
3
|
+
*
|
|
4
|
+
* :::danger
|
|
5
|
+
* ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
6
|
+
* If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
7
|
+
* {@link Handler} instead to be used with the {@link RequestManager}
|
|
8
|
+
* ::::
|
|
9
|
+
*
|
|
10
|
+
* In order to properly fetch and update data, @warp-drive/legacy
|
|
11
|
+
* needs to understand how to connect to your API.
|
|
12
|
+
*
|
|
13
|
+
* `Adapters` accept various kinds of requests from the store
|
|
14
|
+
* and manage fulfillment of the request from your API.
|
|
15
|
+
*
|
|
16
|
+
* ### Why It's Legacy
|
|
17
|
+
*
|
|
18
|
+
* The Adapter pattern was designed for class-based architectures in which each resource type
|
|
19
|
+
* could have its own data-fetching logic:
|
|
20
|
+
*
|
|
21
|
+
* - `store.adapterFor` resolves an adapter by resource type at runtime, looking up
|
|
22
|
+
* `adapter:<type>` and then `adapter:application` through Ember's owner.
|
|
23
|
+
* - Each request is fulfilled by a single adapter, so sharing behavior across resource types
|
|
24
|
+
* means extending a common base class rather than composing request logic.
|
|
25
|
+
* - The provided adapter classes extend `EmberObject`, which, together with the owner lookup,
|
|
26
|
+
* ties the pattern to Ember.
|
|
27
|
+
* - Adapter methods resolve with an untyped `AdapterPayload`, so nothing ties the response's
|
|
28
|
+
* type to the request that produced it.
|
|
29
|
+
*
|
|
30
|
+
* ### Modern Alternative
|
|
31
|
+
*
|
|
32
|
+
* Use [Handlers](/api/@warp-drive/core/request/types/Handler) with the {@link RequestManager}.
|
|
33
|
+
* Each request passes through a chain of handlers, any of which can fulfill it, modify it or
|
|
34
|
+
* pass it along. Handlers support:
|
|
35
|
+
*
|
|
36
|
+
* - request builders, which return a request typed with its expected response, so
|
|
37
|
+
* `store.request` resolves with that type
|
|
38
|
+
* - composition: `RequestManager.use` takes a list of handlers, such as the built-in `Fetch`
|
|
39
|
+
* handler, and wrappers such as `Gate` from `@warp-drive/utilities/handlers` run another
|
|
40
|
+
* handler only for the requests it accepts
|
|
41
|
+
* - explicit imports rather than lookup by name at runtime
|
|
42
|
+
* - any framework ***Warp*Drive** supports, since `@warp-drive/core` has no runtime
|
|
43
|
+
* dependency on Ember (see [Installation](/guides/installation/))
|
|
44
|
+
*
|
|
45
|
+
* For an alternative modern pattern to Adapters, see the
|
|
46
|
+
* [Request Handlers Guide](/guides/the-manual/requests/handlers).
|
|
47
|
+
*
|
|
48
|
+
* ### Request Flow
|
|
49
|
+
*
|
|
50
|
+
* When the store decides it needs to issue a request it uses the following flow to manage the request and process the data.
|
|
51
|
+
*
|
|
52
|
+
* - find the appropriate adapter
|
|
53
|
+
* - issue the request to the adapter
|
|
54
|
+
* - await the adapter's response
|
|
55
|
+
* - if an error occurs reject with the error
|
|
56
|
+
* - if no error
|
|
57
|
+
* - if there is response data
|
|
58
|
+
* - pass the response data to the appropriate serializer
|
|
59
|
+
* - update the cache using the JSON:API formatted data from the serializer's response
|
|
60
|
+
* - return the primary record(s) associated with the request
|
|
61
|
+
*
|
|
62
|
+
* ### Request Errors
|
|
63
|
+
*
|
|
64
|
+
* When a request errors and your adapter does not have the ability to recover from the error,
|
|
65
|
+
* you may either reject the promise returned by your adapter method with the error or simply
|
|
66
|
+
* throw the error.
|
|
67
|
+
*
|
|
68
|
+
* If the request was for a `createRecord` `updateRecord` or `deleteRecord` special rules
|
|
69
|
+
* apply to how this error will affect the state of the store and additional properties on
|
|
70
|
+
* the `Error` class may be used. See the documentation for these methods in
|
|
71
|
+
* {@link MinimumAdapterInterface} for more information.
|
|
72
|
+
*
|
|
73
|
+
* ### Implementing an Adapter
|
|
74
|
+
*
|
|
75
|
+
* There are seven required adapter methods, one for each of
|
|
76
|
+
* the primary request types that @warp-drive/legacy issues.
|
|
77
|
+
*
|
|
78
|
+
* They are:
|
|
79
|
+
*
|
|
80
|
+
* - findRecord
|
|
81
|
+
* - findAll
|
|
82
|
+
* - queryRecord
|
|
83
|
+
* - query
|
|
84
|
+
* - createRecord
|
|
85
|
+
* - updateRecord
|
|
86
|
+
* - deleteRecord
|
|
87
|
+
*
|
|
88
|
+
* Each of these request types has a matching store method that triggers it
|
|
89
|
+
* and matching `requestType` that is passed to the serializer's
|
|
90
|
+
* `normalizeResponse` method.
|
|
91
|
+
*
|
|
92
|
+
* If your app only reads data but never writes data, it is not necessary
|
|
93
|
+
* to implement the methods for create, update, and delete. This extends to
|
|
94
|
+
* all of the store's find methods with the exception of `findRecord` (`findAll`,
|
|
95
|
+
* `query`, `queryRecord`): if you do not use the store method in your app then
|
|
96
|
+
* your Adapter does not need the method.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* async function fetchData(url, options = {}) {
|
|
100
|
+
* let response = await fetch(url, options);
|
|
101
|
+
* return response.toJSON();
|
|
102
|
+
* }
|
|
103
|
+
*
|
|
104
|
+
* export default class ApplicationAdapter {
|
|
105
|
+
* findRecord(_, { modelName }, id) {
|
|
106
|
+
* return fetchData(`./${modelName}s/${id}`);
|
|
107
|
+
* }
|
|
108
|
+
*
|
|
109
|
+
* static create() {
|
|
110
|
+
* return new this();
|
|
111
|
+
* }
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* ### Adapter Resolution
|
|
116
|
+
*
|
|
117
|
+
* `store.adapterFor(name)` will lookup adapters defined in `app/adapters/` and
|
|
118
|
+
* return an instance.
|
|
119
|
+
*
|
|
120
|
+
* `adapterFor` first attempts to find an adapter with an exact match on `name`,
|
|
121
|
+
then falls back to checking for the presence of an adapter named `application`.
|
|
122
|
+
|
|
123
|
+
If no adapter is found, an error will be thrown.
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
store.adapterFor('author');
|
|
127
|
+
|
|
128
|
+
// lookup paths (in order) =>
|
|
129
|
+
// app/adapters/author.js
|
|
130
|
+
// app/adapters/application.js
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Most requests in @warp-drive/legacy are made with respect to a particular `type` (or `modelName`)
|
|
134
|
+
(e.g., "get me the full collection of **books**" or "get me the **employee** whose id is 37"). We
|
|
135
|
+
refer to this as the **primary** resource `type`.
|
|
136
|
+
|
|
137
|
+
`adapterFor` is used by the store to find an adapter with a name matching that of the primary
|
|
138
|
+
resource `type` for the request, which then falls back to the `application` adapter.
|
|
139
|
+
|
|
140
|
+
It is recommended that applications define only a single `application` adapter and serializer
|
|
141
|
+
where possible, only implementing an adapter specific to the `type` when absolutely necessary.
|
|
142
|
+
|
|
143
|
+
If you need to support multiple API versions for the same type, the per-type strategy for
|
|
144
|
+
defining adapters might not be adequate.
|
|
145
|
+
|
|
146
|
+
If you have multiple APIs or multiple API versions and the single application adapter and per-type
|
|
147
|
+
strategy does not suite your needs, one strategy is to write an `application` adapter and serializer
|
|
148
|
+
that make use of `options` to specify the desired format when making a request, then forwards to the
|
|
149
|
+
request to the desired adapter or serializer as needed.
|
|
150
|
+
|
|
151
|
+
```js [app/adapters/application.js]
|
|
152
|
+
export default class Adapter extends EmberObject {
|
|
153
|
+
findRecord(store, schema, id, snapshot) {
|
|
154
|
+
let { apiVersion } = snapshot.adapterOptions;
|
|
155
|
+
return this.adapterFor(`-api-${apiVersion}`).findRecord(store, schema, id, snapshot);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Overriding `Store.adapterFor`
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
import Store from '@ember-data/store';
|
|
164
|
+
import Adapter from '@ember-data/adapter/json-api';
|
|
165
|
+
|
|
166
|
+
class extends Store {
|
|
167
|
+
#adapter = new Adapter();
|
|
168
|
+
|
|
169
|
+
adapterFor() {
|
|
170
|
+
return this.#adapter;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
Note: If you are using Ember and would like to make use of `service` injections in your adapter, you will want to additionally `setOwner` for the Adapter.
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
import Store from '@ember-data/store';
|
|
180
|
+
import Adapter from '@ember-data/adapter/json-api';
|
|
181
|
+
import { getOwner, setOwner } from '@ember/owner';
|
|
182
|
+
|
|
183
|
+
class extends Store {
|
|
184
|
+
#adapter = null;
|
|
185
|
+
|
|
186
|
+
adapterFor() {
|
|
187
|
+
let adapter = this.#adapter;
|
|
188
|
+
if (!adapter) {
|
|
189
|
+
const owner = getOwner(this);
|
|
190
|
+
adapter = new Adapter();
|
|
191
|
+
setOwner(adapter, owner);
|
|
192
|
+
this.#adapter = adapter;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return adapter;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
By default when using with Ember you only need to implement this hook if you want your adapter usage to be statically analyzeable. *Ember***Data** will attempt to resolve adapters using Ember's resolver. To provide a single Adapter for your application like the above you would provide it as the default export of the file `app/adapters/application.{js/ts}`
|
|
201
|
+
|
|
202
|
+
### Using an Adapter
|
|
203
|
+
|
|
204
|
+
Any adapter in `app/adapters/` can be looked up by `name` using `store.adapterFor(name)`.
|
|
205
|
+
|
|
206
|
+
### Default Adapters
|
|
207
|
+
|
|
208
|
+
Applications whose API's structure endpoint URLs *very close to* or *exactly* the **REST**
|
|
209
|
+
or **JSON:API** convention, the `@ember-data/adapter` package contains implementations
|
|
210
|
+
these applications can extend.
|
|
211
|
+
|
|
212
|
+
Many applications will find writing their own adapter to be allow greater flexibility,
|
|
213
|
+
customization, and maintenance than attempting to override methods in these adapters.
|
|
214
|
+
|
|
215
|
+
@summary Legacy adapter layer through which the store fetches and saves data from an API, superseded by
|
|
216
|
+
`RequestManager` handlers.
|
|
217
|
+
@module
|
|
218
|
+
*/
|
|
1
219
|
import { n as BuildURLMixin, t as Adapter } from "./adapter-D3A8ixjz.js";
|
|
2
220
|
export { Adapter, BuildURLMixin };
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Builders for migrating from `store` methods to `store.request`.
|
|
3
|
+
|
|
4
|
+
These builders enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
5
|
+
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.
|
|
6
|
+
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
7
|
+
|
|
8
|
+
@summary Deprecated request builders that move `findRecord`, `query`, and `saveRecord` calls to `store.request`
|
|
9
|
+
while still using adapters and serializers.
|
|
10
|
+
@module
|
|
11
|
+
@deprecated
|
|
12
|
+
*/
|
|
1
13
|
import { StoreRequestInput } from "@warp-drive/core";
|
|
2
14
|
import { RequestSignature } from "@warp-drive/core/types/symbols";
|
|
3
15
|
import { FindAllOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, ResourceKey } from "@warp-drive/core/types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","names":[],"sources":["../../src/compat/builders/find-all.ts","../../src/compat/builders/find-record.ts","../../src/compat/builders/query.ts","../../src/compat/builders/save-record.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"builders.d.ts","names":[],"sources":["../../src/compat/builders/find-all.ts","../../src/compat/builders/find-record.ts","../../src/compat/builders/query.ts","../../src/compat/builders/save-record.ts"],"mappings":";;;;;;;;;;;;;;;;;;KASK,oBAAoB,2BAA2B,kBAAkB;EACpE;EACA;IACE,MAAM;IACN,SAAS;;GAEV,oBAAoB;;KAGlB,wBAAwB;;;;;;;;;;;;;;;;;;iBAmBb,eAAe,UAAU,qBACvC,MAAM,iBAAiB,IACvB,UAAU,wBACT,oBAAoB,iBAAiB,IAAI;iBAC5B,eAAe,cAAc,UAAU,wBAAwB;;;KC9B1E,uBAAuB,2BAA2B,gBAAgB;EACrE;EACA;IACE,QAAQ,yBAAyB;IACjC,SAAS;;GAEV,oBAAoB;;KAGlB,2BAA2B,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCrB,kBAAkB,UAAU,qBAC1C,MAAM,iBAAiB,IACvB,YACA,UAAU,2BACT,uBAAuB,iBAAiB,IAAI;iBAC/B,kBAAkB,cAAc,YAAY,UAAU,2BAA2B;iBACjF,kBAAkB,UAAU,qBAC1C,UAAU,yBAAyB,iBAAiB,KACpD,UAAU,2BACT,uBAAuB,iBAAiB,IAAI;iBAC/B,kBACd,UAAU,0BACV,UAAU,2BACT;;;KC9DE,kBAAkB,2BAA2B,kBAAkB;EAClE;EACA;IACE,MAAM;IACN,OAAO;IACP,SAAS;;GAEV,oBAAoB;;KAGlB,sBAAsB;;;;;;;;;;;;;;;;;;;iBAoBX,aAAa,UAAU,qBACrC,MAAM,iBAAiB,IACvB,OAAO,qBACP,UAAU,sBACT,kBAAkB,iBAAiB,IAAI;iBAC1B,aACd,cACA,OAAO,qBACP,UAAU,sBACT;KAwBE,wBAAwB,2BAA2B,gBAAgB;EACtE;EACA;IACE,MAAM;IACN,OAAO;IACP,SAAS;;GAEV,oBAAoB;;;;;;;;;;;;;;;;;;;;iBAqBP,mBAAmB,UAAU,qBAC3C,MAAM,iBAAiB,IACvB,OAAO,qBACP,UAAU,sBACT,wBAAwB,iBAAiB,IAAI;iBAChC,mBACd,cACA,OAAO,qBACP,UAAU,sBACT;;;KCpGE,uBAAuB,2BAA2B,gBAAgB;EACrE;EACA;IACE,QAAQ,YAAY;IACpB,SAAS;;EAEX,UAAU,YAAY;GACrB,oBAAoB;;KAGlB,2BAA2B;;;;;;;;;;;;;;;;;;iBA4BhB,kBAAkB,UAAU,qBAC1C,QAAQ,GACR,UAAS,0BACR,uBAAuB,iBAAiB,IAAI"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @summary Legacy schema extensions that give reactive objects and arrays the classic `EmberObject` and Ember array
|
|
4
|
+
* APIs, such as `get`, `set` and `mapBy`, plus matching types.
|
|
5
|
+
*/
|
|
1
6
|
import { a as WithArrayLike, i as EmberObjectExtension, n as EmberArrayLikeExtension, o as WithEmberObject, r as EmberObjectArrayExtension, t as ArrayType } from "../extensions-fwdnX9n4.js";
|
|
2
7
|
export { ArrayType, EmberArrayLikeExtension, EmberObjectArrayExtension, EmberObjectExtension, WithArrayLike, WithEmberObject };
|
package/dist/compat/utils.d.ts
CHANGED
|
@@ -163,4 +163,5 @@ export declare function isEquivType(expected: string, actual: string): boolean;
|
|
|
163
163
|
*/
|
|
164
164
|
export declare function isEquivId(expected: string | number, actual: string | number | null): boolean;
|
|
165
165
|
//#endregion
|
|
166
|
+
export {};
|
|
166
167
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1589,16 +1589,17 @@ var LegacySupport = class {
|
|
|
1589
1589
|
if (this.graph) {
|
|
1590
1590
|
if (!resource) return;
|
|
1591
1591
|
const { definition, state } = relationship;
|
|
1592
|
-
/* @__PURE__ */ upgradeStore(this.store);
|
|
1593
|
-
const adapter = this.store.adapterFor?.(definition.type);
|
|
1594
|
-
const { isStale, hasDematerializedInverse, hasReceivedData, isEmpty, shouldForceReload } = state;
|
|
1595
|
-
const allInverseRecordsAreLoaded = areAllInverseRecordsLoaded(this.store, resource);
|
|
1596
|
-
const identifiers = resource.data;
|
|
1597
|
-
const shouldFindViaLink = resource.links && resource.links.related && (typeof adapter?.findHasMany === "function" || typeof identifiers === "undefined") && (shouldForceReload || hasDematerializedInverse || isStale || !allInverseRecordsAreLoaded && !isEmpty);
|
|
1598
1592
|
const field = this.store.schema.fields({ type: definition.inverseType }).get(definition.key);
|
|
1599
1593
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) && ((test) => {
|
|
1600
1594
|
if (!test) throw new Error(`Expected a hasMany field definition for ${definition.inverseType}.${definition.key}`);
|
|
1601
1595
|
})(field && field.kind === "hasMany");
|
|
1596
|
+
/* @__PURE__ */ upgradeStore(this.store);
|
|
1597
|
+
const isLinksMode = Boolean(field.options.linksMode);
|
|
1598
|
+
const adapter = isLinksMode ? void 0 : this.store.adapterFor?.(definition.type);
|
|
1599
|
+
const { isStale, hasDematerializedInverse, hasReceivedData, isEmpty, shouldForceReload } = state;
|
|
1600
|
+
const allInverseRecordsAreLoaded = areAllInverseRecordsLoaded(this.store, resource);
|
|
1601
|
+
const identifiers = resource.data;
|
|
1602
|
+
const shouldFindViaLink = resource.links && resource.links.related && (isLinksMode || typeof adapter?.findHasMany === "function" || typeof identifiers === "undefined") && (shouldForceReload || hasDematerializedInverse || isStale || !allInverseRecordsAreLoaded && !isEmpty);
|
|
1602
1603
|
const request = {
|
|
1603
1604
|
useLink: shouldFindViaLink,
|
|
1604
1605
|
field,
|
|
@@ -1620,6 +1621,12 @@ var LegacySupport = class {
|
|
|
1620
1621
|
method: "GET",
|
|
1621
1622
|
records: identifiers || [],
|
|
1622
1623
|
data: request,
|
|
1624
|
+
options: {
|
|
1625
|
+
field,
|
|
1626
|
+
identifier: parentIdentifier,
|
|
1627
|
+
links: resource.links,
|
|
1628
|
+
meta: resource.meta
|
|
1629
|
+
},
|
|
1623
1630
|
[EnableHydration]: false
|
|
1624
1631
|
} : {
|
|
1625
1632
|
op: "findHasMany",
|
|
@@ -1685,6 +1692,12 @@ var LegacySupport = class {
|
|
|
1685
1692
|
method: "GET",
|
|
1686
1693
|
records: identifier ? [identifier] : [],
|
|
1687
1694
|
data: request,
|
|
1695
|
+
options: {
|
|
1696
|
+
field,
|
|
1697
|
+
identifier: parentIdentifier,
|
|
1698
|
+
links: resource.links,
|
|
1699
|
+
meta: resource.meta
|
|
1700
|
+
},
|
|
1688
1701
|
[EnableHydration]: false
|
|
1689
1702
|
} : {
|
|
1690
1703
|
op: "findBelongsTo",
|
|
@@ -2140,4 +2153,4 @@ var Errors = class extends ArrayProxyWithCustomOverrides {
|
|
|
2140
2153
|
|
|
2141
2154
|
//#endregion
|
|
2142
2155
|
export { PromiseManyArray as a, releaseLegacySupport as i, LEGACY_SUPPORT as n, PromiseBelongsTo as o, lookupLegacySupport as r, Errors as t };
|
|
2143
|
-
//# sourceMappingURL=errors-
|
|
2156
|
+
//# sourceMappingURL=errors-DdSAsjym.js.map
|