@warp-drive/legacy 5.10.0-alpha.21 → 5.10.0-alpha.22
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/-private.d.ts +1 -1
- package/dist/adapter/json-api.d.ts +6 -1
- package/dist/adapter/json-api.d.ts.map +1 -1
- package/dist/adapter/rest.d.ts +1 -1
- package/dist/adapter/rest.js +2 -2
- 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/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/model/migration-support.js +1 -1
- package/dist/{model-Be-e84FX.js → model-EM9IS3kJ.js} +2 -2
- package/dist/{model-Be-e84FX.js.map → model-EM9IS3kJ.js.map} +1 -1
- package/dist/{unpkg/dev/model-fragments-DCHMDr5f.js → model-fragments-bM9vucwt.js} +2 -2
- package/dist/{model-fragments-DCHMDr5f.js.map → model-fragments-bM9vucwt.js.map} +1 -1
- package/dist/model-fragments.d.ts +5 -0
- package/dist/model-fragments.d.ts.map +1 -1
- package/dist/model-fragments.js +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/{rest-CmFneLJH.d.ts → rest-CzVG2wcS.d.ts} +2 -2
- package/dist/{rest-CmFneLJH.d.ts.map → rest-CzVG2wcS.d.ts.map} +1 -1
- package/dist/{schema-provider-BAB8DyMr.js → schema-provider-BsP-TyJN.js} +3 -3
- package/dist/{schema-provider-BAB8DyMr.js.map → schema-provider-BsP-TyJN.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-BLKEsJyw.js → store-09VISmB-.js} +2 -2
- package/dist/{store-BLKEsJyw.js.map → store-09VISmB-.js.map} +1 -1
- package/dist/store.d.ts +5 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1 -1
- package/dist/unpkg/dev/adapter/rest.js +2 -2
- package/dist/unpkg/dev/index.js +3 -3
- package/dist/unpkg/dev/model/migration-support.js +1 -1
- package/dist/unpkg/dev/{model-QCZr8eec.js → model-BRhfRvm7.js} +2 -2
- package/dist/unpkg/dev/{model-QCZr8eec.js.map → model-BRhfRvm7.js.map} +1 -1
- package/dist/{model-fragments-DCHMDr5f.js → unpkg/dev/model-fragments-bM9vucwt.js} +2 -2
- package/dist/unpkg/dev/{model-fragments-DCHMDr5f.js.map → model-fragments-bM9vucwt.js.map} +1 -1
- package/dist/unpkg/dev/model-fragments.js +1 -1
- package/dist/unpkg/dev/model.js +2 -2
- package/dist/unpkg/dev/{schema-provider-IMFO9Kgw.js → schema-provider-KpRvBrnz.js} +3 -3
- package/dist/unpkg/dev/{schema-provider-IMFO9Kgw.js.map → schema-provider-KpRvBrnz.js.map} +1 -1
- package/dist/unpkg/dev/{store-BiXsLLAu.js → store-DwneLtlP.js} +2 -2
- package/dist/unpkg/{dev-deprecated/store-Ci8k7Lh6.js.map → dev/store-DwneLtlP.js.map} +1 -1
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev-deprecated/adapter/rest.js +2 -2
- package/dist/unpkg/dev-deprecated/index.js +3 -3
- package/dist/unpkg/dev-deprecated/model/migration-support.js +1 -1
- package/dist/unpkg/dev-deprecated/{model-B0ZNLaHO.js → model-C5LZIABq.js} +2 -2
- package/dist/unpkg/dev-deprecated/{model-B0ZNLaHO.js.map → model-C5LZIABq.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{model-fragments-DCHMDr5f.js → model-fragments-bM9vucwt.js} +2 -2
- package/dist/unpkg/dev-deprecated/{model-fragments-DCHMDr5f.js.map → model-fragments-bM9vucwt.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/model-fragments.js +1 -1
- package/dist/unpkg/dev-deprecated/model.js +2 -2
- package/dist/unpkg/dev-deprecated/{schema-provider-DGWYnFno.js → schema-provider-BHW1XG6Q.js} +3 -3
- package/dist/unpkg/dev-deprecated/{schema-provider-DGWYnFno.js.map → schema-provider-BHW1XG6Q.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{store-Ci8k7Lh6.js → store-CBtAELz5.js} +2 -2
- package/dist/unpkg/{dev/store-BiXsLLAu.js.map → dev-deprecated/store-CBtAELz5.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/prod/adapter/rest.js +2 -2
- package/dist/unpkg/prod/index.js +3 -3
- package/dist/unpkg/prod/model/migration-support.js +1 -1
- package/dist/unpkg/prod/{model-QtC0IWbE.js → model-QIzJrhcV.js} +2 -2
- package/dist/unpkg/prod/{model-QtC0IWbE.js.map → model-QIzJrhcV.js.map} +1 -1
- package/dist/unpkg/prod/model-fragments-bM9vucwt.js +348 -0
- package/dist/unpkg/prod/{model-fragments-DCHMDr5f.js.map → model-fragments-bM9vucwt.js.map} +1 -1
- package/dist/unpkg/prod/model-fragments.js +1 -1
- package/dist/unpkg/prod/model.js +2 -2
- package/dist/unpkg/prod/{schema-provider-DPOzTa8e.js → schema-provider-D_H0kna2.js} +3 -3
- package/dist/unpkg/prod/{schema-provider-DPOzTa8e.js.map → schema-provider-D_H0kna2.js.map} +1 -1
- package/dist/unpkg/prod/{store-BsSkzWgk.js → store-BB1Ab-3t.js} +2 -2
- package/dist/unpkg/{prod-deprecated/store-Dsw2f4s-.js.map → prod/store-BB1Ab-3t.js.map} +1 -1
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod-deprecated/adapter/rest.js +2 -2
- package/dist/unpkg/prod-deprecated/index.js +3 -3
- package/dist/unpkg/prod-deprecated/model/migration-support.js +1 -1
- package/dist/unpkg/prod-deprecated/{model-B946S2pl.js → model-Dik7yYTm.js} +2 -2
- package/dist/unpkg/prod-deprecated/{model-B946S2pl.js.map → model-Dik7yYTm.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{model-fragments-DCHMDr5f.js → model-fragments-bM9vucwt.js} +2 -2
- package/dist/unpkg/prod-deprecated/{model-fragments-DCHMDr5f.js.map → model-fragments-bM9vucwt.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/model-fragments.js +1 -1
- package/dist/unpkg/prod-deprecated/model.js +2 -2
- package/dist/unpkg/prod-deprecated/{schema-provider-xcaytn9y.js → schema-provider-BKBnIcPE.js} +3 -3
- package/dist/unpkg/prod-deprecated/{schema-provider-xcaytn9y.js.map → schema-provider-BKBnIcPE.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{store-Dsw2f4s-.js → store-Cp64p5ZC.js} +2 -2
- package/dist/unpkg/{prod/store-BsSkzWgk.js.map → prod-deprecated/store-Cp64p5ZC.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/package.json +8 -8
- package/dist/unpkg/prod/model-fragments-DCHMDr5f.js +0 -348
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @summary Legacy transforms that serialize and deserialize attribute values: the `Transform` base class plus the
|
|
4
|
+
* boolean, date, number and string transforms.
|
|
5
|
+
*/
|
|
1
6
|
import EmberObject from "@ember/object";
|
|
2
7
|
import { TransformName } from "@warp-drive/core/types/symbols";
|
|
3
8
|
import { LegacyAttributeField } from "@warp-drive/core/types/schema/fields";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","names":[],"sources":["../../src/serializer/-private/transforms/transform.ts","../../src/serializer/-private/transforms/boolean.ts","../../src/serializer/-private/transforms/date.ts","../../src/serializer/-private/transforms/number.ts","../../src/serializer/-private/transforms/string.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"transform.d.ts","names":[],"sources":["../../src/serializer/-private/transforms/transform.ts","../../src/serializer/-private/transforms/boolean.ts","../../src/serializer/-private/transforms/date.ts","../../src/serializer/-private/transforms/number.ts","../../src/serializer/-private/transforms/string.ts"],"mappings":";;;;;;;;iBAIiB;;;;;;;;;;;;;;;;;;EAkBf,UAAU,gBAAgB,SAAS;;;;;;;;;;;;;;;;;;EAmBnC,YAAY,gBAAgB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkF1B,kBAAkB;iBCtHd;;;;GAId;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuCU;;;;;EAKX,YAAY,8CAA8C;IAAY;;;;;EAmBtE,UAAU,8BAA8B;IAAY;;;;;SAW7C,UAAU;;iBC9EF;;;;GAId;;;;;;;;;;;;;;;;;;;;;;;qBAwBU;;;;;EAKX,YAAY,oCAAoC,WAAW,0BAA0B;;;;;EAwBrF,UAAU,MAAM,MAAM,WAAW;;;;SAY1B,UAAU;;iBCjEF;;;;GAId;;;;;;;;;;;;;;;;;;;;;;;;qBAyBU;;;;;EAKX,YAAY,gDAAgD,WAAW;;;;EAavE,UAAU,kDAAkD,WAAW;;;;SAahE,UAAU;;iBChEF;;;;GAId;;;;;;;;;;;;;;;;;;;;;;;qBAuBU;;;;;EAKX,YAAY,qBAAqB,WAAW;;;;EAM5C,UAAU,uBAAuB,WAAW;;;;SAOrC,UAAU"}
|
package/dist/serializer.d.ts
CHANGED
|
@@ -1,3 +1,146 @@
|
|
|
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 serializer, consider writing a
|
|
7
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
8
|
+
:::
|
|
9
|
+
|
|
10
|
+
In order to properly manage and present your data, WarpDrive
|
|
11
|
+
needs to understand the structure of data it receives.
|
|
12
|
+
|
|
13
|
+
`Serializers` convert data between the server's API format and
|
|
14
|
+
the format WarpDrive understands.
|
|
15
|
+
|
|
16
|
+
Data received from an API response is **normalized** into
|
|
17
|
+
[{json:api}](https://jsonapi.org/) (the format used internally
|
|
18
|
+
by WarpDrive), while data sent to an API is **serialized**
|
|
19
|
+
into the format the API expects.
|
|
20
|
+
|
|
21
|
+
### Why It's Legacy
|
|
22
|
+
|
|
23
|
+
The Serializer pattern was designed to transform data between your API's format and the
|
|
24
|
+
{json:api} format the legacy store works with:
|
|
25
|
+
|
|
26
|
+
- `store.serializerFor` resolves a serializer by resource type at runtime, looking up
|
|
27
|
+
`serializer:<type>` and then `serializer:application` through Ember's owner, though an
|
|
28
|
+
API's format more often varies per API version than per resource type (see Serializer
|
|
29
|
+
Resolution below).
|
|
30
|
+
- Every response is converted into {json:api} before it reaches the cache, whatever format
|
|
31
|
+
the API actually uses.
|
|
32
|
+
- The provided serializer classes extend `EmberObject`, which, together with the owner
|
|
33
|
+
lookup, ties the pattern to Ember.
|
|
34
|
+
|
|
35
|
+
### Modern Alternative
|
|
36
|
+
|
|
37
|
+
Use [Handlers](/api/@warp-drive/core/request/types/Handler) with the {@link RequestManager}.
|
|
38
|
+
Modern ***Warp*Drive**:
|
|
39
|
+
|
|
40
|
+
- normalizes a payload inside a handler when it needs transforming, using plain functions
|
|
41
|
+
and helpers such as `dasherize` and `singularize` from `@warp-drive/utilities/string`
|
|
42
|
+
- lets you pick a cache that understands your API's format natively, such as `JSONAPICache`
|
|
43
|
+
from `@warp-drive/json-api` for {json:api}, or write your own that implements the Cache
|
|
44
|
+
interface
|
|
45
|
+
|
|
46
|
+
For an alternative modern pattern to Serializers, see the
|
|
47
|
+
[Request Handlers Guide](/guides/the-manual/requests/handlers).
|
|
48
|
+
|
|
49
|
+
### Setup
|
|
50
|
+
|
|
51
|
+
Serializers run inside the `LegacyNetworkHandler` from
|
|
52
|
+
[`@warp-drive/legacy/compat`](/api/@warp-drive/legacy/compat/). A store created with
|
|
53
|
+
`useLegacyStore` adds it unless `linksMode` is `true`; a store you build yourself must add it
|
|
54
|
+
to its `RequestManager`, as shown in
|
|
55
|
+
[Configure the Store](/guides/configuration/legacy-package-setup/setup/universal.md#configure-the-store).
|
|
56
|
+
|
|
57
|
+
### Implementing a Serializer
|
|
58
|
+
|
|
59
|
+
There are only two required serializer methods, one for
|
|
60
|
+
normalizing data from the server API format into {json:api}, and
|
|
61
|
+
another for serializing records via `Snapshots` into the expected
|
|
62
|
+
server API format.
|
|
63
|
+
|
|
64
|
+
To implement a serializer, export a class that conforms to the structure
|
|
65
|
+
described by {@link MinimumSerializerInterface}
|
|
66
|
+
from the `app/serializers/` directory. An example is below.
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import EmberObject from '@ember/object';
|
|
70
|
+
|
|
71
|
+
export default class ApplicationSerializer extends EmberObject {
|
|
72
|
+
normalizeResponse(store, schema, rawPayload) {
|
|
73
|
+
return rawPayload;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
serialize(snapshot, options) {
|
|
77
|
+
const serializedResource = {
|
|
78
|
+
id: snapshot.id,
|
|
79
|
+
type: snapshot.modelName,
|
|
80
|
+
attributes: snapshot.attributes()
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return serializedResource;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Serializer Resolution
|
|
90
|
+
|
|
91
|
+
`store.serializerFor(name)` will lookup serializers defined in
|
|
92
|
+
`app/serializers/` and return an instance. If no serializer is found, an
|
|
93
|
+
error will be thrown.
|
|
94
|
+
|
|
95
|
+
`serializerFor` first attempts to find a serializer with an exact match on `name`,
|
|
96
|
+
then falls back to checking for the presence of a serializer named `application`.
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
store.serializerFor('author');
|
|
100
|
+
|
|
101
|
+
// lookup paths (in order) =>
|
|
102
|
+
// app/serializers/author.js
|
|
103
|
+
// app/serializers/application.js
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Most requests in `@warp-drive/legacy` are made with respect to a particular `type` (or `modelName`)
|
|
107
|
+
(e.g., "get me the full collection of **books**" or "get me the **employee** whose id is 37"). We
|
|
108
|
+
refer to this as the **primary** resource `type`.
|
|
109
|
+
|
|
110
|
+
Typically `serializerFor` will be used to find a serializer with a name matching that of the primary
|
|
111
|
+
resource `type` for the request, falling back to the `application` serializer for those types that
|
|
112
|
+
do not have a defined serializer. This is often described as a `per-model` or `per-type` strategy
|
|
113
|
+
for defining serializers. However, because APIs rarely format payloads per-type but rather
|
|
114
|
+
per-API-version, this may not be a desired strategy.
|
|
115
|
+
|
|
116
|
+
It is recommended that applications define only a single `application` adapter and serializer
|
|
117
|
+
where possible.
|
|
118
|
+
|
|
119
|
+
If you have multiple API formats and the per-type strategy is not viable, one strategy is to
|
|
120
|
+
write an `application` adapter and serializer that make use of `options` to specify the desired
|
|
121
|
+
format when making a request.
|
|
122
|
+
|
|
123
|
+
### Using a Serializer
|
|
124
|
+
|
|
125
|
+
Any serializer in `app/serializers/` can be looked up by `name` using `store.serializerFor(name)`.
|
|
126
|
+
|
|
127
|
+
### Default Serializers
|
|
128
|
+
|
|
129
|
+
For applications whose APIs are *very close to* or *exactly* the **REST** format or **JSON:API**
|
|
130
|
+
format the `@warp-drive/legacy/serializer` package contains implementations these applications can
|
|
131
|
+
extend. It also contains a simple `JSONSerializer` for serializing to/from very basic JSON objects.
|
|
132
|
+
|
|
133
|
+
Many applications will find writing their own serializer to be more performant and less
|
|
134
|
+
complex than extending these classes even when their API format is very close to that expected
|
|
135
|
+
by these serializers.
|
|
136
|
+
|
|
137
|
+
It is recommended that apps write their own serializer to best suit the needs of their API and
|
|
138
|
+
application.
|
|
139
|
+
|
|
140
|
+
@summary Legacy serializer layer that converts data between an API's format and JSON:API for the adapter-based
|
|
141
|
+
request flow.
|
|
142
|
+
@module
|
|
143
|
+
*/
|
|
1
144
|
import { Store } from "@warp-drive/core";
|
|
2
145
|
import EmberObject from "@ember/object";
|
|
3
146
|
import { ModelSchema } from "@warp-drive/core/types";
|
package/dist/serializer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","names":[],"sources":["../src/serializer.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","names":[],"sources":["../src/serializer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuLa,mBAAmB;;;;;;;;;;;;;;;;;;;;EAoB9B,OAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwGxB,UAAU,YAAY,aAAa,MAAM,0BAA0B,yBAAyB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as normalizeModelName } from "./util-fMuLguoj.js";
|
|
2
1
|
import { t as isMaybeIdentifier } from "./utils-UqBsN9IU.js";
|
|
2
|
+
import { n as normalizeModelName } from "./util-fMuLguoj.js";
|
|
3
3
|
import { assertPrivateStore, constructResource, ensureStringId, recordIdentifierFor, storeFor } from "@warp-drive/core/store/-private";
|
|
4
4
|
import { defineSignal } from "@warp-drive/core/signals/-leaked";
|
|
5
5
|
import { getOrSetGlobal } from "@warp-drive/core/types/-private";
|
|
@@ -476,4 +476,4 @@ function upgradeInstanceCaches(cache) {
|
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
export { restoreDeprecatedStoreBehaviors as t };
|
|
479
|
-
//# sourceMappingURL=store-
|
|
479
|
+
//# sourceMappingURL=store-09VISmB-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-BLKEsJyw.js","names":["defineSignal","assertPrivateStore","ensureStringId","recordIdentifierFor","getOrSetGlobal","macroCondition","getGlobalConfig","preloadData","store","identifier","preload","jsonPayload","schemas","schema","fields","Object","keys","forEach","key","preloadValue","field","get","kind","relationships","preloadRelationship","attributes","cache","hasRecord","Boolean","_instanceCache","peek","upsert","relatedType","type","WarpDrive","env","DEBUG","test","Error","Array","isArray","data","map","value","_convertPreloadRelationshipToJSON","id","_resourceIsFullDeleted","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","RecordReference","___token","___identifier","constructor","notifications","subscribe","_","bucket","notifiedKey","_ref","destroy","unsubscribe","remoteType","push","objectOrPromise","Promise","resolve","then","peekRecord","load","findRecord","reload","prototype","AvailableShims","WeakMap","getShimClass","modelName","shims","create","set","shim","undefined","ShimModelClass","__store","Map","fieldSchemas","attrs","relationshipsByName","rels","eachAttribute","callback","binding","call","eachRelationship","eachTransformedAttribute","assertPrivateStore","constructResource","ensureStringId","recordIdentifierFor","storeFor","SkipCache","isMaybeIdentifier","normalizeModelName","getShimClass","preloadData","RecordReference","resourceIsFullyDeleted","macroCondition","getGlobalConfig","restoreDeprecatedStoreBehaviors","StoreKlass","prototype","findRecord","resource","id","options","WarpDrive","env","DEBUG","test","Error","isDestroying","isDestroyed","type","normalizedId","identifier","cacheKeyManager","getOrCreateRecordIdentifier","preload","_instanceCache","recordIsLoaded","reload","_join","promise","request","op","data","record","cacheOptions","then","document","content","findAll","query","queryRecord","getReference","resourceIdentifier","arguments","length","cache","upgradeInstanceCaches","__instances","reference","get","set","modelFor","schema","hasResource","saveRecord","Promise","reject","lid","resolve","operation","isNew","isDeleted","records","withReferences","WeakMap"],"sources":["../src/store/-private.ts","../src/store.ts"],"sourcesContent":["import type { NotificationType } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { defineSignal } from '@warp-drive/core/signals/-leaked';\nimport {\n assertPrivateStore,\n ensureStringId,\n type InstanceCache,\n recordIdentifierFor,\n} from '@warp-drive/core/store/-private';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { NewResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type {\n LegacyAttributeField,\n LegacyRelationshipField,\n LegacyRelationshipField as RelationshipSchema,\n} from '@warp-drive/core/types/schema/fields';\nimport type {\n ExistingResourceIdentifierObject,\n ExistingResourceObject,\n InnerRelationshipDocument,\n SingleResourceDocument,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { Store } from '../store.ts';\n\n/*\n When a find request is triggered on the store, the user can optionally pass in\n attributes and relationships to be preloaded. These are meant to behave as if they\n came back from the server, except the user obtained them out of band and is informing\n the store of their existence. The most common use case is for supporting client side\n nested URLs, such as `/posts/1/comments/2` so the user can do\n `store.findRecord('comment', 2, { preload: { post: 1 } })` without having to fetch the post.\n\n Preloaded data can be attributes and relationships passed in either as IDs or as actual\n models.\n */\ntype PreloadRelationshipValue = OpaqueRecordInstance | string;\nexport function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void {\n const jsonPayload: Partial<ExistingResourceObject> = {};\n //TODO(Igor) consider the polymorphic case\n const schemas = store.schema;\n const fields = schemas.fields(identifier);\n Object.keys(preload).forEach((key) => {\n const preloadValue = preload[key];\n\n const field = fields.get(key);\n if (field && (field.kind === 'hasMany' || field.kind === 'belongsTo')) {\n if (!jsonPayload.relationships) {\n jsonPayload.relationships = {};\n }\n jsonPayload.relationships[key] = preloadRelationship(field, preloadValue);\n } else {\n if (!jsonPayload.attributes) {\n jsonPayload.attributes = {};\n }\n jsonPayload.attributes[key] = preloadValue;\n }\n });\n const cache = store.cache;\n assertPrivateStore(store);\n const hasRecord = Boolean(store._instanceCache.peek(identifier));\n cache.upsert(identifier, jsonPayload, hasRecord);\n}\n\nfunction preloadRelationship(\n schema: RelationshipSchema,\n preloadValue: PreloadRelationshipValue | null | Array<PreloadRelationshipValue>\n): InnerRelationshipDocument<ExistingResourceIdentifierObject> {\n const relatedType = schema.type;\n\n if (schema.kind === 'hasMany') {\n assert('You need to pass in an array to set a hasMany property on a record', Array.isArray(preloadValue));\n return { data: preloadValue.map((value) => _convertPreloadRelationshipToJSON(value, relatedType)) };\n }\n\n assert('You should not pass in an array to set a belongsTo property on a record', !Array.isArray(preloadValue));\n return { data: preloadValue ? _convertPreloadRelationshipToJSON(preloadValue, relatedType) : null };\n}\n\n/*\n findRecord('user', '1', { preload: { friends: ['1'] }});\n findRecord('user', '1', { preload: { friends: [record] }});\n*/\nfunction _convertPreloadRelationshipToJSON(\n value: OpaqueRecordInstance | string,\n type: string\n): ExistingResourceIdentifierObject {\n if (typeof value === 'string' || typeof value === 'number') {\n return { type, id: ensureStringId(value) };\n }\n // TODO if not a record instance assert it's an identifier\n // and allow identifiers to be used\n return recordIdentifierFor(value) as ExistingResourceIdentifierObject;\n}\n\nexport interface BaseFinderOptions {\n reload?: boolean;\n backgroundReload?: boolean;\n include?: string | string[];\n adapterOptions?: Record<string, unknown>;\n}\nexport interface FindRecordOptions extends BaseFinderOptions {\n /**\n * Data to preload into the store before the request is made.\n * This feature is *highly* discouraged and has no corresponding\n * feature when using builders and handlers.\n *\n * Excepting relationships: the data should be in the form of a\n * JSON object where the keys are fields on the record and the value\n * is the raw value to be added to the cache.\n *\n * Relationships can either be provided as string IDs from which\n * an identifier will be built base upon the relationship's expected\n * resource type, or be record instances from which the identifier\n * will be extracted.\n *\n */\n preload?: Record<string, Value>;\n}\n\nexport type QueryOptions = {\n [K in string | 'adapterOptions']?: K extends 'adapterOptions' ? Record<string, unknown> : unknown;\n};\n\nexport type FindAllOptions = BaseFinderOptions;\nexport type LegacyResourceQuery = {\n include?: string | string[];\n [key: string]: Value | undefined;\n};\n\nexport type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;\n\n/**\n * Minimum subset of static schema methods and properties on the\n * \"model\" class.\n *\n * Only used when using the legacy schema-service implementation\n * for @ember-data/model or when wrapping schema for legacy\n * Adapters/Serializers.\n *\n */\nexport interface ModelSchema<T = unknown> {\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n fields: Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>;\n attributes: Map<KeyOrString<T>, LegacyAttributeField>;\n relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;\n eachAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void;\n eachRelationship<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void;\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, type: string | null) => void,\n binding?: T\n ): void;\n}\n\nfunction _resourceIsFullDeleted(identifier: ResourceKey, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nexport function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n A `RecordReference` is a low-level API that allows users and\n addon authors to perform meta-operations on a record.\n\n @hideconstructor\n @public\n*/\nexport class RecordReference {\n /** @internal */\n declare private store: Store;\n // unsubscribe token given to us by the notification manager\n /** @internal */\n private ___token!: object;\n /** @internal */\n private ___identifier: ResourceKey;\n /** @internal */\n declare private _ref: number;\n\n constructor(store: Store, identifier: ResourceKey) {\n this.store = store;\n this.___identifier = identifier;\n this.___token = store.notifications.subscribe(\n identifier,\n (_: ResourceKey, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'identity' || (bucket === 'attributes' && notifiedKey === 'id')) {\n this._ref++;\n }\n }\n );\n }\n\n /** @internal */\n destroy(): void {\n this.store.notifications.unsubscribe(this.___token);\n }\n\n get type(): string {\n return this.identifier().type;\n }\n\n /**\n The `id` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.id(); // '1'\n ```\n\n @public\n @return The id of the record.\n */\n id(): string | null {\n // oxlint-disable-next-line no-unused-expressions\n this._ref; // consume the tracked prop\n return this.___identifier.id;\n }\n\n /**\n The `identifier` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.identifier(); // '1'\n ```\n\n @public\n @return The identifier of the record.\n */\n identifier(): ResourceKey {\n return this.___identifier;\n }\n\n /**\n How the reference will be looked up when it is loaded. Currently\n this always returns `identity` to signify that a record will be\n loaded by its `type` and `id`.\n\n Example\n\n ```javascript\n const userRef = store.getReference('user', 1);\n\n userRef.remoteType(); // 'identity'\n ```\n\n @public\n */\n remoteType(): 'identity' {\n return 'identity';\n }\n\n /**\n This API allows you to provide a reference with new data. The\n simplest usage of this API is similar to `store.push`: you provide a\n normalized hash of data and the object represented by the reference\n will update.\n\n If you pass a promise to `push`, WarpDrive will not ask the adapter\n for the data if another attempt to fetch it is made in the\n interim. When the promise resolves, the underlying object is updated\n with the new data, and the promise returned by *this function* is resolved\n with that object.\n\n For example, `recordReference.push(promise)` will be resolved with a\n record.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({\n data: {\n id: \"1\",\n type: \"user\",\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n ```\n\n @public\n @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one\n @return a promise for the value (record or relationship)\n */\n push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance> {\n // TODO @deprecate pushing unresolved payloads\n return Promise.resolve(objectOrPromise).then((data) => {\n return this.store.push(data);\n });\n }\n\n /**\n If the entity referred to by the reference is already loaded, it is\n present as `reference.value`. Otherwise the value returned by this function\n is `null`.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.value(); // user\n ```\n\n @public\n @return the record for this RecordReference\n */\n value(): OpaqueRecordInstance | null {\n return this.store.peekRecord(this.___identifier);\n }\n\n /**\n Triggers a fetch for the backing entity based on its `remoteType`\n (see `remoteType` definitions per reference type).\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // load user (via store.find)\n userRef.load().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n load(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id);\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n\n /**\n Reloads the record if it is already loaded. If the record is not\n loaded it will load the record via `store.findRecord`\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // or trigger a reload\n userRef.reload().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n reload(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id, { reload: true });\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n}\n\ndefineSignal(RecordReference.prototype, '_ref');\n\n// if modelFor turns out to be a bottleneck we should replace with a Map\n// and clear it during store teardown.\nconst AvailableShims = getOrSetGlobal('AvailableShims', new WeakMap<Store, Record<string, ShimModelClass>>());\n\nexport function getShimClass<T>(\n store: Store,\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n): ShimModelClass<T> {\n let shims = AvailableShims.get(store);\n\n if (!shims) {\n shims = Object.create(null) as Record<string, ShimModelClass>;\n AvailableShims.set(store, shims);\n }\n\n let shim = shims[modelName];\n if (shim === undefined) {\n shim = shims[modelName] = new ShimModelClass<unknown>(store, modelName);\n }\n\n return shim;\n}\n\n// Mimics the static apis of @ember-data/model\nexport class ShimModelClass<T = unknown> implements ModelSchema<T> {\n declare __store: Store;\n declare modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string) {\n this.__store = store;\n this.modelName = modelName;\n }\n\n get fields(): Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'> {\n const fields = new Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>();\n const fieldSchemas = this.__store.schema.fields({ type: this.modelName });\n\n fieldSchemas.forEach((schema, key) => {\n if (schema.kind === 'attribute' || schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n fields.set(key as KeyOrString<T>, schema.kind);\n }\n });\n\n return fields;\n }\n\n get attributes(): Map<KeyOrString<T>, LegacyAttributeField> {\n const attrs = new Map<KeyOrString<T>, LegacyAttributeField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n attrs.set(key as KeyOrString<T>, schema);\n }\n });\n\n return attrs;\n }\n\n get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField> {\n const rels = new Map<KeyOrString<T>, LegacyRelationshipField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n rels.set(key as KeyOrString<T>, schema);\n }\n });\n\n return rels;\n }\n\n eachAttribute<K extends KeyOrString<T>>(\n callback: (key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachRelationship<K extends KeyOrString<T>>(\n callback: (key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (key: K, type: string | null) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n const type = schema.type;\n if (type) callback.call(binding, key as K, type);\n }\n });\n }\n}\n","/**\n * @module\n * @summary Legacy `restoreDeprecatedStoreBehaviors`, which restores the adapter-based `findRecord`, `findAll`, `query`,\n * `saveRecord` and related methods onto a `Store` class.\n */\n\nimport type { Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { LegacyLiveArray, LegacyQueryArray, PrivateStore } from '@warp-drive/core/store/-private';\nimport {\n assertPrivateStore,\n constructResource,\n ensureStringId,\n recordIdentifierFor,\n storeFor,\n} from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { isMaybeIdentifier } from './compat/builders/utils.ts';\nimport { normalizeModelName } from './model/-private/util.ts';\nimport type {\n FindAllOptions,\n FindRecordOptions,\n LegacyResourceQuery,\n ModelSchema,\n QueryOptions,\n} from './store/-private.ts';\nimport { getShimClass, preloadData, RecordReference, resourceIsFullyDeleted } from './store/-private.ts';\n\n/**\n * Restores the deprecated `findRecord`/`findAll`/`query`/`queryRecord`/\n * `findBelongsTo`/`findHasMany`/`createRecord`/`deleteRecord`/`saveRecord`\n * legacy-network-layer implementations of these methods onto the given\n * `Store` subclass, for apps that have not yet migrated to the\n * `RequestManager`-based equivalents.\n *\n * @summary Legacy opt-in that restores the adapter-based `findRecord`, `findAll`, `query`, `saveRecord`, and related\n * methods onto a `Store` class.\n */\nexport function restoreDeprecatedStoreBehaviors(StoreKlass: typeof Store): void {\n StoreKlass.prototype.findRecord = function (\n resource: string | ResourceIdentifierObject,\n id?: string | number | FindRecordOptions,\n options?: FindRecordOptions\n ): Promise<unknown> {\n assert(\n `Attempted to call store.findRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = id as FindRecordOptions;\n } else {\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(id as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resource);\n options = options || {};\n assertPrivateStore(this);\n\n if (options.preload) {\n // force reload if we preload to ensure we don't resolve the promise\n // until we are complete, else we will end up background-reloading\n // even for initial load.\n if (!this._instanceCache.recordIsLoaded(identifier)) {\n options.reload = true;\n }\n this._join(() => {\n preloadData(this, identifier, options.preload!);\n });\n }\n\n const promise = this.request<OpaqueRecordInstance>({\n op: 'findRecord',\n data: {\n record: identifier,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => {\n return document.content;\n });\n };\n\n StoreKlass.prototype.findAll = function <T>(\n type: TypeFromInstance<T> | string,\n options: FindAllOptions = {}\n ): Promise<LegacyLiveArray<T>> {\n assert(\n `Attempted to call store.findAll(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's findAll method`, type);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyLiveArray<T>>({\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.query = function (\n type: string,\n query: LegacyResourceQuery,\n options: QueryOptions = {}\n ): Promise<LegacyQueryArray> {\n assert(\n `Attempted to call store.query(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's query method`, type);\n assert(`You need to pass a query hash to the store's query method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyQueryArray>({\n op: 'query',\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.queryRecord = function (\n type: string,\n query: Record<string, unknown>,\n options?: QueryOptions\n ): Promise<OpaqueRecordInstance | null> {\n assert(\n `Attempted to call store.queryRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's queryRecord method`, type);\n assert(`You need to pass a query hash to the store's queryRecord method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<OpaqueRecordInstance | null>({\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n // do not put a ts-expect-error here, because typedoc will fail to\n // build due to this error only occurring when references are in use in the editor.\n // The return statement below casts to `PrivateStore['getReference']`'s return\n // type rather than annotating this function `: RecordReference` directly,\n // since this package's `RecordReference` and core's `deprecated/-private.ts`\n // copy are structurally identical but nominally distinct classes (TS treats\n // their private fields as separate brands); casting only the return value\n // (instead of the whole function) keeps `this` contextually typed from the\n // assignment target below.\n StoreKlass.prototype.getReference = function (resource: string | ResourceIdentifierObject, id: string | number) {\n assert(\n `Attempted to call store.getReference(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n let resourceIdentifier: ResourceIdentifierObject;\n if (arguments.length === 1 && isMaybeIdentifier(resource)) {\n resourceIdentifier = resource;\n } else {\n const type = normalizeModelName(resource as string);\n const normalizedId = ensureStringId(id);\n resourceIdentifier = constructResource(type, normalizedId);\n }\n\n assert(\n 'getReference expected to receive either a resource identifier or type and id as arguments',\n isMaybeIdentifier(resourceIdentifier)\n );\n\n const identifier: ResourceKey = this.cacheKeyManager.getOrCreateRecordIdentifier(resourceIdentifier);\n assertPrivateStore(this);\n\n const cache = upgradeInstanceCaches(this._instanceCache.__instances).reference;\n let reference = cache.get(identifier);\n\n if (!reference) {\n reference = new RecordReference(this, identifier);\n cache.set(identifier, reference);\n }\n return reference;\n };\n\n StoreKlass.prototype.modelFor = function <T>(\n type: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n ): ModelSchema<T> {\n assert(`Attempted to call store.modelFor(), but the store instance has already been destroyed.`, !this.isDestroyed);\n assert(`You need to pass <type> to the store's modelFor method`, typeof type === 'string' && type.length);\n assert(`No model was found for '${type}' and no schema handles the type`, this.schema.hasResource({ type }));\n\n return getShimClass<T>(this, type);\n };\n\n StoreKlass.prototype.saveRecord = function <T>(record: T, options: Record<string, unknown> = {}): Promise<T> {\n assert(\n `Attempted to call store.saveRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`Unable to initiate save for a record in a disconnected state`, storeFor(record, true));\n const identifier = recordIdentifierFor(record);\n const cache = this.cache;\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we reject here to prevent bad things.\n return Promise.reject(new Error(`Record Is Disconnected`));\n }\n assertPrivateStore(this);\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n this._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(this._instanceCache, identifier)) {\n return Promise.resolve(record);\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n const request = {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n\n return this.request<T>(request).then((document) => document.content);\n };\n}\n\nexport type { Store };\n\ntype Caches = PrivateStore['_instanceCache']['__instances'];\nfunction upgradeInstanceCaches(cache: Caches): Caches & { reference: WeakMap<ResourceKey, RecordReference> } {\n const withReferences = cache as Caches & { reference: WeakMap<ResourceKey, RecordReference> };\n if (!withReferences.reference) {\n withReferences.reference = new WeakMap();\n }\n\n return withReferences;\n}\n"],"mappings":";;;;;;;;;AAwCA,SAAgBO,YAAYC,OAAcC,YAA4BC,SAAsC;CAC1G,MAAMC,cAA+C,CAAC;CAGtD,MAAMG,SADUN,MAAMK,OACCC,OAAOL,UAAU;CACxCM,OAAOC,KAAKN,OAAO,CAAC,CAACO,SAASC,QAAQ;EACpC,MAAMC,eAAeT,QAAQQ;EAE7B,MAAME,QAAQN,OAAOO,IAAIH,GAAG;EAC5B,IAAIE,UAAUA,MAAME,SAAS,aAAaF,MAAME,SAAS,cAAc;GACrE,IAAI,CAACX,YAAYY,eACfZ,YAAYY,gBAAgB,CAAC;GAE/BZ,YAAYY,cAAcL,OAAOM,oBAAoBJ,OAAOD,YAAY;EAC1E,OAAO;GACL,IAAI,CAACR,YAAYc,YACfd,YAAYc,aAAa,CAAC;GAE5Bd,YAAYc,WAAWP,OAAOC;EAChC;CACF,CAAC;CACD,MAAMO,QAAQlB,MAAMkB;CACpBzB,mBAAmBO,KAAK;CACxB,MAAMmB,YAAYC,QAAQpB,MAAMqB,eAAeC,KAAKrB,UAAU,CAAC;CAC/DiB,MAAMK,OAAOtB,YAAYE,aAAagB,SAAS;AACjD;AAEA,SAASH,oBACPX,QACAM,cAC6D;CAC7D,MAAMa,cAAcnB,OAAOoB;CAE3B,IAAIpB,OAAOS,SAAS,WAAW;EAC7BjB,eAAAC,gBAAA,CAAA,CAAA4B,UAAAC,IAAAC,KAAA,OAAAC,SAAA;GAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,oEAAoE;EAAA,EAAA,CAAEC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AAK;EACpC;EAEA,OAAO,KAAKkC,QAAWA,OAAO,CAAC,CAACK,MAAMC,aAAaA,SAASC,OAAO;CACrE;AACF;AAKA,SAASS,sBAAsBD,OAA8E;CAC3G,MAAMkB,iBAAiBlB;CACvB,IAAI,CAACkB,eAAef,WAClBe,eAAef,4BAAY,IAAIgB,QAAQ;CAGzC,OAAOD;AACT"}
|
|
1
|
+
{"version":3,"file":"store-09VISmB-.js","names":["defineSignal","assertPrivateStore","ensureStringId","recordIdentifierFor","getOrSetGlobal","macroCondition","getGlobalConfig","preloadData","store","identifier","preload","jsonPayload","schemas","schema","fields","Object","keys","forEach","key","preloadValue","field","get","kind","relationships","preloadRelationship","attributes","cache","hasRecord","Boolean","_instanceCache","peek","upsert","relatedType","type","WarpDrive","env","DEBUG","test","Error","Array","isArray","data","map","value","_convertPreloadRelationshipToJSON","id","_resourceIsFullDeleted","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","RecordReference","___token","___identifier","constructor","notifications","subscribe","_","bucket","notifiedKey","_ref","destroy","unsubscribe","remoteType","push","objectOrPromise","Promise","resolve","then","peekRecord","load","findRecord","reload","prototype","AvailableShims","WeakMap","getShimClass","modelName","shims","create","set","shim","undefined","ShimModelClass","__store","Map","fieldSchemas","attrs","relationshipsByName","rels","eachAttribute","callback","binding","call","eachRelationship","eachTransformedAttribute","assertPrivateStore","constructResource","ensureStringId","recordIdentifierFor","storeFor","SkipCache","isMaybeIdentifier","normalizeModelName","getShimClass","preloadData","RecordReference","resourceIsFullyDeleted","macroCondition","getGlobalConfig","restoreDeprecatedStoreBehaviors","StoreKlass","prototype","findRecord","resource","id","options","WarpDrive","env","DEBUG","test","Error","isDestroying","isDestroyed","type","normalizedId","identifier","cacheKeyManager","getOrCreateRecordIdentifier","preload","_instanceCache","recordIsLoaded","reload","_join","promise","request","op","data","record","cacheOptions","then","document","content","findAll","query","queryRecord","getReference","resourceIdentifier","arguments","length","cache","upgradeInstanceCaches","__instances","reference","get","set","modelFor","schema","hasResource","saveRecord","Promise","reject","lid","resolve","operation","isNew","isDeleted","records","withReferences","WeakMap"],"sources":["../src/store/-private.ts","../src/store.ts"],"sourcesContent":["import type { NotificationType } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { defineSignal } from '@warp-drive/core/signals/-leaked';\nimport {\n assertPrivateStore,\n ensureStringId,\n type InstanceCache,\n recordIdentifierFor,\n} from '@warp-drive/core/store/-private';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { NewResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type {\n LegacyAttributeField,\n LegacyRelationshipField,\n LegacyRelationshipField as RelationshipSchema,\n} from '@warp-drive/core/types/schema/fields';\nimport type {\n ExistingResourceIdentifierObject,\n ExistingResourceObject,\n InnerRelationshipDocument,\n SingleResourceDocument,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { Store } from '../store.ts';\n\n/*\n When a find request is triggered on the store, the user can optionally pass in\n attributes and relationships to be preloaded. These are meant to behave as if they\n came back from the server, except the user obtained them out of band and is informing\n the store of their existence. The most common use case is for supporting client side\n nested URLs, such as `/posts/1/comments/2` so the user can do\n `store.findRecord('comment', 2, { preload: { post: 1 } })` without having to fetch the post.\n\n Preloaded data can be attributes and relationships passed in either as IDs or as actual\n models.\n */\ntype PreloadRelationshipValue = OpaqueRecordInstance | string;\nexport function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void {\n const jsonPayload: Partial<ExistingResourceObject> = {};\n //TODO(Igor) consider the polymorphic case\n const schemas = store.schema;\n const fields = schemas.fields(identifier);\n Object.keys(preload).forEach((key) => {\n const preloadValue = preload[key];\n\n const field = fields.get(key);\n if (field && (field.kind === 'hasMany' || field.kind === 'belongsTo')) {\n if (!jsonPayload.relationships) {\n jsonPayload.relationships = {};\n }\n jsonPayload.relationships[key] = preloadRelationship(field, preloadValue);\n } else {\n if (!jsonPayload.attributes) {\n jsonPayload.attributes = {};\n }\n jsonPayload.attributes[key] = preloadValue;\n }\n });\n const cache = store.cache;\n assertPrivateStore(store);\n const hasRecord = Boolean(store._instanceCache.peek(identifier));\n cache.upsert(identifier, jsonPayload, hasRecord);\n}\n\nfunction preloadRelationship(\n schema: RelationshipSchema,\n preloadValue: PreloadRelationshipValue | null | Array<PreloadRelationshipValue>\n): InnerRelationshipDocument<ExistingResourceIdentifierObject> {\n const relatedType = schema.type;\n\n if (schema.kind === 'hasMany') {\n assert('You need to pass in an array to set a hasMany property on a record', Array.isArray(preloadValue));\n return { data: preloadValue.map((value) => _convertPreloadRelationshipToJSON(value, relatedType)) };\n }\n\n assert('You should not pass in an array to set a belongsTo property on a record', !Array.isArray(preloadValue));\n return { data: preloadValue ? _convertPreloadRelationshipToJSON(preloadValue, relatedType) : null };\n}\n\n/*\n findRecord('user', '1', { preload: { friends: ['1'] }});\n findRecord('user', '1', { preload: { friends: [record] }});\n*/\nfunction _convertPreloadRelationshipToJSON(\n value: OpaqueRecordInstance | string,\n type: string\n): ExistingResourceIdentifierObject {\n if (typeof value === 'string' || typeof value === 'number') {\n return { type, id: ensureStringId(value) };\n }\n // TODO if not a record instance assert it's an identifier\n // and allow identifiers to be used\n return recordIdentifierFor(value) as ExistingResourceIdentifierObject;\n}\n\nexport interface BaseFinderOptions {\n reload?: boolean;\n backgroundReload?: boolean;\n include?: string | string[];\n adapterOptions?: Record<string, unknown>;\n}\nexport interface FindRecordOptions extends BaseFinderOptions {\n /**\n * Data to preload into the store before the request is made.\n * This feature is *highly* discouraged and has no corresponding\n * feature when using builders and handlers.\n *\n * Excepting relationships: the data should be in the form of a\n * JSON object where the keys are fields on the record and the value\n * is the raw value to be added to the cache.\n *\n * Relationships can either be provided as string IDs from which\n * an identifier will be built base upon the relationship's expected\n * resource type, or be record instances from which the identifier\n * will be extracted.\n *\n */\n preload?: Record<string, Value>;\n}\n\nexport type QueryOptions = {\n [K in string | 'adapterOptions']?: K extends 'adapterOptions' ? Record<string, unknown> : unknown;\n};\n\nexport type FindAllOptions = BaseFinderOptions;\nexport type LegacyResourceQuery = {\n include?: string | string[];\n [key: string]: Value | undefined;\n};\n\nexport type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;\n\n/**\n * Minimum subset of static schema methods and properties on the\n * \"model\" class.\n *\n * Only used when using the legacy schema-service implementation\n * for @ember-data/model or when wrapping schema for legacy\n * Adapters/Serializers.\n *\n */\nexport interface ModelSchema<T = unknown> {\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n fields: Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>;\n attributes: Map<KeyOrString<T>, LegacyAttributeField>;\n relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;\n eachAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void;\n eachRelationship<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void;\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, type: string | null) => void,\n binding?: T\n ): void;\n}\n\nfunction _resourceIsFullDeleted(identifier: ResourceKey, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nexport function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n A `RecordReference` is a low-level API that allows users and\n addon authors to perform meta-operations on a record.\n\n @hideconstructor\n @public\n*/\nexport class RecordReference {\n /** @internal */\n declare private store: Store;\n // unsubscribe token given to us by the notification manager\n /** @internal */\n private ___token!: object;\n /** @internal */\n private ___identifier: ResourceKey;\n /** @internal */\n declare private _ref: number;\n\n constructor(store: Store, identifier: ResourceKey) {\n this.store = store;\n this.___identifier = identifier;\n this.___token = store.notifications.subscribe(\n identifier,\n (_: ResourceKey, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'identity' || (bucket === 'attributes' && notifiedKey === 'id')) {\n this._ref++;\n }\n }\n );\n }\n\n /** @internal */\n destroy(): void {\n this.store.notifications.unsubscribe(this.___token);\n }\n\n get type(): string {\n return this.identifier().type;\n }\n\n /**\n The `id` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.id(); // '1'\n ```\n\n @public\n @return The id of the record.\n */\n id(): string | null {\n // oxlint-disable-next-line no-unused-expressions\n this._ref; // consume the tracked prop\n return this.___identifier.id;\n }\n\n /**\n The `identifier` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.identifier(); // '1'\n ```\n\n @public\n @return The identifier of the record.\n */\n identifier(): ResourceKey {\n return this.___identifier;\n }\n\n /**\n How the reference will be looked up when it is loaded. Currently\n this always returns `identity` to signify that a record will be\n loaded by its `type` and `id`.\n\n Example\n\n ```javascript\n const userRef = store.getReference('user', 1);\n\n userRef.remoteType(); // 'identity'\n ```\n\n @public\n */\n remoteType(): 'identity' {\n return 'identity';\n }\n\n /**\n This API allows you to provide a reference with new data. The\n simplest usage of this API is similar to `store.push`: you provide a\n normalized hash of data and the object represented by the reference\n will update.\n\n If you pass a promise to `push`, WarpDrive will not ask the adapter\n for the data if another attempt to fetch it is made in the\n interim. When the promise resolves, the underlying object is updated\n with the new data, and the promise returned by *this function* is resolved\n with that object.\n\n For example, `recordReference.push(promise)` will be resolved with a\n record.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({\n data: {\n id: \"1\",\n type: \"user\",\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n ```\n\n @public\n @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one\n @return a promise for the value (record or relationship)\n */\n push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance> {\n // TODO @deprecate pushing unresolved payloads\n return Promise.resolve(objectOrPromise).then((data) => {\n return this.store.push(data);\n });\n }\n\n /**\n If the entity referred to by the reference is already loaded, it is\n present as `reference.value`. Otherwise the value returned by this function\n is `null`.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.value(); // user\n ```\n\n @public\n @return the record for this RecordReference\n */\n value(): OpaqueRecordInstance | null {\n return this.store.peekRecord(this.___identifier);\n }\n\n /**\n Triggers a fetch for the backing entity based on its `remoteType`\n (see `remoteType` definitions per reference type).\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // load user (via store.find)\n userRef.load().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n load(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id);\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n\n /**\n Reloads the record if it is already loaded. If the record is not\n loaded it will load the record via `store.findRecord`\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // or trigger a reload\n userRef.reload().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n reload(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id, { reload: true });\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n}\n\ndefineSignal(RecordReference.prototype, '_ref');\n\n// if modelFor turns out to be a bottleneck we should replace with a Map\n// and clear it during store teardown.\nconst AvailableShims = getOrSetGlobal('AvailableShims', new WeakMap<Store, Record<string, ShimModelClass>>());\n\nexport function getShimClass<T>(\n store: Store,\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n): ShimModelClass<T> {\n let shims = AvailableShims.get(store);\n\n if (!shims) {\n shims = Object.create(null) as Record<string, ShimModelClass>;\n AvailableShims.set(store, shims);\n }\n\n let shim = shims[modelName];\n if (shim === undefined) {\n shim = shims[modelName] = new ShimModelClass<unknown>(store, modelName);\n }\n\n return shim;\n}\n\n// Mimics the static apis of @ember-data/model\nexport class ShimModelClass<T = unknown> implements ModelSchema<T> {\n declare __store: Store;\n declare modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string) {\n this.__store = store;\n this.modelName = modelName;\n }\n\n get fields(): Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'> {\n const fields = new Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>();\n const fieldSchemas = this.__store.schema.fields({ type: this.modelName });\n\n fieldSchemas.forEach((schema, key) => {\n if (schema.kind === 'attribute' || schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n fields.set(key as KeyOrString<T>, schema.kind);\n }\n });\n\n return fields;\n }\n\n get attributes(): Map<KeyOrString<T>, LegacyAttributeField> {\n const attrs = new Map<KeyOrString<T>, LegacyAttributeField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n attrs.set(key as KeyOrString<T>, schema);\n }\n });\n\n return attrs;\n }\n\n get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField> {\n const rels = new Map<KeyOrString<T>, LegacyRelationshipField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n rels.set(key as KeyOrString<T>, schema);\n }\n });\n\n return rels;\n }\n\n eachAttribute<K extends KeyOrString<T>>(\n callback: (key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachRelationship<K extends KeyOrString<T>>(\n callback: (key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (key: K, type: string | null) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n const type = schema.type;\n if (type) callback.call(binding, key as K, type);\n }\n });\n }\n}\n","/**\n * @module\n * @summary Legacy `restoreDeprecatedStoreBehaviors`, which restores the adapter-based `findRecord`, `findAll`, `query`,\n * `saveRecord` and related methods onto a `Store` class.\n */\n\nimport type { Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { LegacyLiveArray, LegacyQueryArray, PrivateStore } from '@warp-drive/core/store/-private';\nimport {\n assertPrivateStore,\n constructResource,\n ensureStringId,\n recordIdentifierFor,\n storeFor,\n} from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { isMaybeIdentifier } from './compat/builders/utils.ts';\nimport { normalizeModelName } from './model/-private/util.ts';\nimport type {\n FindAllOptions,\n FindRecordOptions,\n LegacyResourceQuery,\n ModelSchema,\n QueryOptions,\n} from './store/-private.ts';\nimport { getShimClass, preloadData, RecordReference, resourceIsFullyDeleted } from './store/-private.ts';\n\n/**\n * Restores the deprecated `findRecord`/`findAll`/`query`/`queryRecord`/\n * `findBelongsTo`/`findHasMany`/`createRecord`/`deleteRecord`/`saveRecord`\n * legacy-network-layer implementations of these methods onto the given\n * `Store` subclass, for apps that have not yet migrated to the\n * `RequestManager`-based equivalents.\n *\n * @summary Legacy opt-in that restores the adapter-based `findRecord`, `findAll`, `query`, `saveRecord`, and related\n * methods onto a `Store` class.\n */\nexport function restoreDeprecatedStoreBehaviors(StoreKlass: typeof Store): void {\n StoreKlass.prototype.findRecord = function (\n resource: string | ResourceIdentifierObject,\n id?: string | number | FindRecordOptions,\n options?: FindRecordOptions\n ): Promise<unknown> {\n assert(\n `Attempted to call store.findRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = id as FindRecordOptions;\n } else {\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(id as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resource);\n options = options || {};\n assertPrivateStore(this);\n\n if (options.preload) {\n // force reload if we preload to ensure we don't resolve the promise\n // until we are complete, else we will end up background-reloading\n // even for initial load.\n if (!this._instanceCache.recordIsLoaded(identifier)) {\n options.reload = true;\n }\n this._join(() => {\n preloadData(this, identifier, options.preload!);\n });\n }\n\n const promise = this.request<OpaqueRecordInstance>({\n op: 'findRecord',\n data: {\n record: identifier,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => {\n return document.content;\n });\n };\n\n StoreKlass.prototype.findAll = function <T>(\n type: TypeFromInstance<T> | string,\n options: FindAllOptions = {}\n ): Promise<LegacyLiveArray<T>> {\n assert(\n `Attempted to call store.findAll(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's findAll method`, type);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyLiveArray<T>>({\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.query = function (\n type: string,\n query: LegacyResourceQuery,\n options: QueryOptions = {}\n ): Promise<LegacyQueryArray> {\n assert(\n `Attempted to call store.query(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's query method`, type);\n assert(`You need to pass a query hash to the store's query method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyQueryArray>({\n op: 'query',\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.queryRecord = function (\n type: string,\n query: Record<string, unknown>,\n options?: QueryOptions\n ): Promise<OpaqueRecordInstance | null> {\n assert(\n `Attempted to call store.queryRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's queryRecord method`, type);\n assert(`You need to pass a query hash to the store's queryRecord method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<OpaqueRecordInstance | null>({\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n // do not put a ts-expect-error here, because typedoc will fail to\n // build due to this error only occurring when references are in use in the editor.\n // The return statement below casts to `PrivateStore['getReference']`'s return\n // type rather than annotating this function `: RecordReference` directly,\n // since this package's `RecordReference` and core's `deprecated/-private.ts`\n // copy are structurally identical but nominally distinct classes (TS treats\n // their private fields as separate brands); casting only the return value\n // (instead of the whole function) keeps `this` contextually typed from the\n // assignment target below.\n StoreKlass.prototype.getReference = function (resource: string | ResourceIdentifierObject, id: string | number) {\n assert(\n `Attempted to call store.getReference(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n let resourceIdentifier: ResourceIdentifierObject;\n if (arguments.length === 1 && isMaybeIdentifier(resource)) {\n resourceIdentifier = resource;\n } else {\n const type = normalizeModelName(resource as string);\n const normalizedId = ensureStringId(id);\n resourceIdentifier = constructResource(type, normalizedId);\n }\n\n assert(\n 'getReference expected to receive either a resource identifier or type and id as arguments',\n isMaybeIdentifier(resourceIdentifier)\n );\n\n const identifier: ResourceKey = this.cacheKeyManager.getOrCreateRecordIdentifier(resourceIdentifier);\n assertPrivateStore(this);\n\n const cache = upgradeInstanceCaches(this._instanceCache.__instances).reference;\n let reference = cache.get(identifier);\n\n if (!reference) {\n reference = new RecordReference(this, identifier);\n cache.set(identifier, reference);\n }\n return reference;\n };\n\n StoreKlass.prototype.modelFor = function <T>(\n type: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n ): ModelSchema<T> {\n assert(`Attempted to call store.modelFor(), but the store instance has already been destroyed.`, !this.isDestroyed);\n assert(`You need to pass <type> to the store's modelFor method`, typeof type === 'string' && type.length);\n assert(`No model was found for '${type}' and no schema handles the type`, this.schema.hasResource({ type }));\n\n return getShimClass<T>(this, type);\n };\n\n StoreKlass.prototype.saveRecord = function <T>(record: T, options: Record<string, unknown> = {}): Promise<T> {\n assert(\n `Attempted to call store.saveRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`Unable to initiate save for a record in a disconnected state`, storeFor(record, true));\n const identifier = recordIdentifierFor(record);\n const cache = this.cache;\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we reject here to prevent bad things.\n return Promise.reject(new Error(`Record Is Disconnected`));\n }\n assertPrivateStore(this);\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n this._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(this._instanceCache, identifier)) {\n return Promise.resolve(record);\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n const request = {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n\n return this.request<T>(request).then((document) => document.content);\n };\n}\n\nexport type { Store };\n\ntype Caches = PrivateStore['_instanceCache']['__instances'];\nfunction upgradeInstanceCaches(cache: Caches): Caches & { reference: WeakMap<ResourceKey, RecordReference> } {\n const withReferences = cache as Caches & { reference: WeakMap<ResourceKey, RecordReference> };\n if (!withReferences.reference) {\n withReferences.reference = new WeakMap();\n }\n\n return withReferences;\n}\n"],"mappings":";;;;;;;;;AAwCA,SAAgBO,YAAYC,OAAcC,YAA4BC,SAAsC;CAC1G,MAAMC,cAA+C,CAAC;CAGtD,MAAMG,SADUN,MAAMK,OACCC,OAAOL,UAAU;CACxCM,OAAOC,KAAKN,OAAO,CAAC,CAACO,SAASC,QAAQ;EACpC,MAAMC,eAAeT,QAAQQ;EAE7B,MAAME,QAAQN,OAAOO,IAAIH,GAAG;EAC5B,IAAIE,UAAUA,MAAME,SAAS,aAAaF,MAAME,SAAS,cAAc;GACrE,IAAI,CAACX,YAAYY,eACfZ,YAAYY,gBAAgB,CAAC;GAE/BZ,YAAYY,cAAcL,OAAOM,oBAAoBJ,OAAOD,YAAY;EAC1E,OAAO;GACL,IAAI,CAACR,YAAYc,YACfd,YAAYc,aAAa,CAAC;GAE5Bd,YAAYc,WAAWP,OAAOC;EAChC;CACF,CAAC;CACD,MAAMO,QAAQlB,MAAMkB;CACpBzB,mBAAmBO,KAAK;CACxB,MAAMmB,YAAYC,QAAQpB,MAAMqB,eAAeC,KAAKrB,UAAU,CAAC;CAC/DiB,MAAMK,OAAOtB,YAAYE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UAAU,CAAC;EAEb,IAAIgD,YAA8D;EAElE,IAAId,MAAMe,MAAMvC,UAAU,GACxBsC,YAAY;OACP,IAAId,MAAMgB,UAAUxC,UAAU,GACnCsC,YAAY;EAGd,MAAM7B,UAAU;GACdC,IAAI4B;GACJ3B,MAAM;IACJrB;IACAsB,QAAQZ;GACV;GACAyC,SAAS,CAACzC,UAAU;GACpBa,cAAc,GAAGtC,YAAY,KAAK;EACpC;EAEA,OAAO,KAAKkC,QAAWA,OAAO,CAAC,CAACK,MAAMC,aAAaA,SAASC,OAAO;CACrE;AACF;AAKA,SAASS,sBAAsBD,OAA8E;CAC3G,MAAMkB,iBAAiBlB;CACvB,IAAI,CAACkB,eAAef,WAClBe,eAAef,4BAAY,IAAIgB,QAAQ;CAGzC,OAAOD;AACT"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @summary Legacy `restoreDeprecatedStoreBehaviors`, which restores the adapter-based `findRecord`, `findAll`, `query`,
|
|
4
|
+
* `saveRecord` and related methods onto a `Store` class.
|
|
5
|
+
*/
|
|
1
6
|
import { Store } from "@warp-drive/core";
|
|
2
7
|
/**
|
|
3
8
|
* Restores the deprecated `findRecord`/`findAll`/`query`/`queryRecord`/
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","names":[],"sources":["../src/store.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","names":[],"sources":["../src/store.ts"],"mappings":";;;;;;;;;;;;;;;;wBA0CgB,gCAAgC,mBAAmB"}
|
package/dist/store.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as decorateMethodV2 } from "../runtime--fcdnjmJ-5yaSpa-d.js";
|
|
2
1
|
import { n as BuildURLMixin, t as Adapter } from "../adapter-BAn4SeUA.js";
|
|
3
|
-
import { AbortError, AdapterError, ConflictError, ForbiddenError, InvalidError, NotFoundError, ServerError, TimeoutError, UnauthorizedError } from "./error.js";
|
|
4
2
|
import { a as determineBodyPromise, i as serializeQueryParams, n as getFetchFunction, o as parseResponseHeaders, t as serializeIntoHash } from "../-private-BprUAEe_.js";
|
|
3
|
+
import { AbortError, AdapterError, ConflictError, ForbiddenError, InvalidError, NotFoundError, ServerError, TimeoutError, UnauthorizedError } from "./error.js";
|
|
4
|
+
import { n as decorateMethodV2 } from "../runtime--fcdnjmJ-5yaSpa-d.js";
|
|
5
5
|
import { getOwner } from "@ember/application";
|
|
6
6
|
import { computed } from "@ember/object";
|
|
7
7
|
|
package/dist/unpkg/dev/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as serializeRecord, i as pushPayload, n as cleanup, o as serializerFor, r as normalize, s as LegacyNetworkHandler, t as adapterFor } from "./compat-BdovRRzQ.js";
|
|
2
2
|
import { EmberArrayLikeExtension, EmberObjectArrayExtension, EmberObjectExtension } from "./compat/extensions.js";
|
|
3
|
-
import { n as modelFor, r as teardownRecord$1, t as instantiateRecord$1 } from "./model-
|
|
3
|
+
import { n as modelFor, r as teardownRecord$1, t as instantiateRecord$1 } from "./model-BRhfRvm7.js";
|
|
4
|
+
import { a as FragmentExtension, s as FragmentArrayExtension, t as fragmentsModelFor } from "./model-fragments-bM9vucwt.js";
|
|
4
5
|
import { i as releaseLegacySupport } from "./errors-CGvbM6WH.js";
|
|
5
|
-
import { a as FragmentExtension, s as FragmentArrayExtension, t as fragmentsModelFor } from "./model-fragments-DCHMDr5f.js";
|
|
6
6
|
import { DelegatingSchemaService, registerDerivations as registerDerivations$1 } from "./model/migration-support.js";
|
|
7
|
-
import { t as restoreDeprecatedStoreBehaviors } from "./store-
|
|
7
|
+
import { t as restoreDeprecatedStoreBehaviors } from "./store-DwneLtlP.js";
|
|
8
8
|
import { CacheHandler, Fetch, RequestManager, Store, recordIdentifierFor } from "@warp-drive/core";
|
|
9
9
|
import { SchemaService, instantiateRecord, registerDerivations, teardownRecord } from "@warp-drive/core/reactive";
|
|
10
10
|
import { DefaultCachePolicy } from "@warp-drive/core/store";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as lookupLegacySupport, t as Errors } from "../errors-CGvbM6WH.js";
|
|
2
|
-
import { _ as save, a as RecordState, c as _save, d as createSnapshot, f as deleteRecord, g as rollbackAttributes, h as reload, l as belongsTo, m as hasMany, o as _destroyRecord, p as destroyRecord, s as _reload, t as buildSchema, u as changedAttributes, v as serialize, y as unloadRecord } from "../schema-provider-IMFO9Kgw.js";
|
|
3
2
|
import "./-private.js";
|
|
3
|
+
import { _ as save, a as RecordState, c as _save, d as createSnapshot, f as deleteRecord, g as rollbackAttributes, h as reload, l as belongsTo, m as hasMany, o as _destroyRecord, p as destroyRecord, s as _reload, t as buildSchema, u as changedAttributes, v as serialize, y as unloadRecord } from "../schema-provider-KpRvBrnz.js";
|
|
4
4
|
import { recordIdentifierFor } from "@warp-drive/core";
|
|
5
5
|
import { assertPrivateStore } from "@warp-drive/core/store/-private";
|
|
6
6
|
import { Context } from "@warp-drive/core/reactive/-private";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as normalizeModelName, t as isElementDescriptor } from "./util-CI7b4vAE.js";
|
|
2
2
|
import { r as lookupLegacySupport } from "./errors-CGvbM6WH.js";
|
|
3
|
-
import { n as getModelFactory } from "./schema-provider-
|
|
3
|
+
import { n as getModelFactory } from "./schema-provider-KpRvBrnz.js";
|
|
4
4
|
import { recordIdentifierFor } from "@warp-drive/core";
|
|
5
5
|
import { getOwner, setOwner } from "@ember/application";
|
|
6
6
|
import { StoreMap, assertPrivateStore, setRecordIdentifier } from "@warp-drive/core/store/-private";
|
|
@@ -659,4 +659,4 @@ function secretInit(record, identifier, store) {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
export { belongsTo as a, hasMany as i, modelFor as n, attr as o, teardownRecord as r, instantiateRecord as t };
|
|
662
|
-
//# sourceMappingURL=model-
|
|
662
|
+
//# sourceMappingURL=model-BRhfRvm7.js.map
|