@ember-data/store 5.4.0-alpha.31 → 5.4.0-alpha.33
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/package.json +9 -9
- package/unstable-preview-types/-private/cache-handler.d.ts +101 -99
- package/unstable-preview-types/-private/caches/cache-utils.d.ts +11 -9
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts +181 -179
- package/unstable-preview-types/-private/caches/instance-cache.d.ts +63 -61
- package/unstable-preview-types/-private/caches/resource-utils.d.ts +12 -10
- package/unstable-preview-types/-private/document.d.ts +146 -144
- package/unstable-preview-types/-private/index.d.ts +18 -16
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +178 -176
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +19 -17
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +29 -27
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +442 -440
- package/unstable-preview-types/-private/managers/notification-manager.d.ts +98 -96
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts +97 -95
- package/unstable-preview-types/-private/network/request-cache.d.ts +109 -107
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +134 -132
- package/unstable-preview-types/-private/store-service.d.ts +1503 -1501
- package/unstable-preview-types/-private/utils/coerce-id.d.ts +10 -8
- package/unstable-preview-types/-private/utils/construct-resource.d.ts +10 -8
- package/unstable-preview-types/-private/utils/identifier-debug-consts.d.ts +7 -5
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +4 -2
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +4 -2
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +4 -2
- package/unstable-preview-types/-private.d.ts +4 -2
- package/unstable-preview-types/-types/overview.d.ts +21 -19
- package/unstable-preview-types/-types/q/cache-store-wrapper.d.ts +107 -105
- package/unstable-preview-types/-types/q/cache.d.ts +47 -45
- package/unstable-preview-types/-types/q/ds-model.d.ts +15 -13
- package/unstable-preview-types/-types/q/identifier.d.ts +169 -167
- package/unstable-preview-types/-types/q/promise-proxies.d.ts +4 -2
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts +36 -34
- package/unstable-preview-types/-types/q/record-instance.d.ts +29 -27
- package/unstable-preview-types/-types/q/schema-service.d.ts +214 -212
- package/unstable-preview-types/-types/q/store.d.ts +17 -15
- package/unstable-preview-types/index.d.ts +220 -185
|
@@ -1,177 +1,179 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
import type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
declare module '@ember-data/store/-private/legacy-model-support/record-reference' {
|
|
2
|
+
import type { StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
|
+
/**
|
|
4
|
+
@module @ember-data/store
|
|
5
|
+
*/
|
|
6
|
+
import type { SingleResourceDocument } from '@warp-drive/core-types/spec/raw';
|
|
7
|
+
import type { OpaqueRecordInstance } from '@ember-data/store/-types/q/record-instance';
|
|
8
|
+
import type Store from '@ember-data/store/-private/store-service';
|
|
9
|
+
/**
|
|
10
|
+
@module @ember-data/store
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
A `RecordReference` is a low-level API that allows users and
|
|
14
|
+
addon authors to perform meta-operations on a record.
|
|
15
|
+
|
|
16
|
+
@class RecordReference
|
|
17
|
+
@public
|
|
18
|
+
*/
|
|
19
|
+
export default class RecordReference {
|
|
20
|
+
store: Store;
|
|
21
|
+
___token: object;
|
|
22
|
+
___identifier: StableRecordIdentifier;
|
|
23
|
+
_ref: number;
|
|
24
|
+
constructor(store: Store, identifier: StableRecordIdentifier);
|
|
25
|
+
destroy(): void;
|
|
26
|
+
get type(): string;
|
|
27
|
+
/**
|
|
28
|
+
The `id` of the record that this reference refers to.
|
|
29
|
+
|
|
30
|
+
Together, the `type` and `id` properties form a composite key for
|
|
31
|
+
the identity map.
|
|
32
|
+
|
|
33
|
+
Example
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
let userRef = store.getReference('user', 1);
|
|
37
|
+
|
|
38
|
+
userRef.id(); // '1'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
@method id
|
|
42
|
+
@public
|
|
43
|
+
@return {String} The id of the record.
|
|
44
|
+
*/
|
|
45
|
+
id(): string | null;
|
|
46
|
+
/**
|
|
47
|
+
The `identifier` of the record that this reference refers to.
|
|
48
|
+
|
|
49
|
+
Together, the `type` and `id` properties form a composite key for
|
|
50
|
+
the identity map.
|
|
51
|
+
|
|
52
|
+
Example
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
let userRef = store.getReference('user', 1);
|
|
56
|
+
|
|
57
|
+
userRef.identifier(); // '1'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
@method identifier
|
|
61
|
+
@public
|
|
62
|
+
@return {String} The identifier of the record.
|
|
63
|
+
*/
|
|
64
|
+
identifier(): StableRecordIdentifier;
|
|
65
|
+
/**
|
|
66
|
+
How the reference will be looked up when it is loaded. Currently
|
|
67
|
+
this always returns `identity` to signify that a record will be
|
|
68
|
+
loaded by its `type` and `id`.
|
|
69
|
+
|
|
70
|
+
Example
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
const userRef = store.getReference('user', 1);
|
|
74
|
+
|
|
75
|
+
userRef.remoteType(); // 'identity'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
@method remoteType
|
|
79
|
+
@public
|
|
80
|
+
@return {String} 'identity'
|
|
81
|
+
*/
|
|
82
|
+
remoteType(): 'identity';
|
|
83
|
+
/**
|
|
84
|
+
This API allows you to provide a reference with new data. The
|
|
85
|
+
simplest usage of this API is similar to `store.push`: you provide a
|
|
86
|
+
normalized hash of data and the object represented by the reference
|
|
87
|
+
will update.
|
|
88
|
+
|
|
89
|
+
If you pass a promise to `push`, Ember Data will not ask the adapter
|
|
90
|
+
for the data if another attempt to fetch it is made in the
|
|
91
|
+
interim. When the promise resolves, the underlying object is updated
|
|
92
|
+
with the new data, and the promise returned by *this function* is resolved
|
|
93
|
+
with that object.
|
|
94
|
+
|
|
95
|
+
For example, `recordReference.push(promise)` will be resolved with a
|
|
96
|
+
record.
|
|
97
|
+
|
|
98
|
+
Example
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
let userRef = store.getReference('user', 1);
|
|
102
|
+
|
|
103
|
+
// provide data for reference
|
|
104
|
+
userRef.push({
|
|
105
|
+
data: {
|
|
106
|
+
id: "1",
|
|
107
|
+
type: "user",
|
|
108
|
+
attributes: {
|
|
109
|
+
username: "@user"
|
|
110
|
+
}
|
|
109
111
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
112
|
+
}).then(function(user) {
|
|
113
|
+
userRef.value() === user;
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
@method push
|
|
118
|
+
@public
|
|
119
|
+
@param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one
|
|
120
|
+
@return a promise for the value (record or relationship)
|
|
121
|
+
*/
|
|
122
|
+
push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance>;
|
|
123
|
+
/**
|
|
124
|
+
If the entity referred to by the reference is already loaded, it is
|
|
125
|
+
present as `reference.value`. Otherwise the value returned by this function
|
|
126
|
+
is `null`.
|
|
127
|
+
|
|
128
|
+
Example
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
let userRef = store.getReference('user', 1);
|
|
132
|
+
|
|
133
|
+
userRef.value(); // user
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
@method value
|
|
137
|
+
@public
|
|
138
|
+
@return {Model} the record for this RecordReference
|
|
139
|
+
*/
|
|
140
|
+
value(): OpaqueRecordInstance | null;
|
|
141
|
+
/**
|
|
142
|
+
Triggers a fetch for the backing entity based on its `remoteType`
|
|
143
|
+
(see `remoteType` definitions per reference type).
|
|
144
|
+
|
|
145
|
+
Example
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
let userRef = store.getReference('user', 1);
|
|
149
|
+
|
|
150
|
+
// load user (via store.find)
|
|
151
|
+
userRef.load().then(...)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
@method load
|
|
155
|
+
@public
|
|
156
|
+
@return {Promise<record>} the record for this RecordReference
|
|
157
|
+
*/
|
|
158
|
+
load(): Promise<unknown>;
|
|
159
|
+
/**
|
|
160
|
+
Reloads the record if it is already loaded. If the record is not
|
|
161
|
+
loaded it will load the record via `store.findRecord`
|
|
162
|
+
|
|
163
|
+
Example
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
let userRef = store.getReference('user', 1);
|
|
167
|
+
|
|
168
|
+
// or trigger a reload
|
|
169
|
+
userRef.reload().then(...)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
@method reload
|
|
173
|
+
@public
|
|
174
|
+
@return {Promise<record>} the record for this RecordReference
|
|
175
|
+
*/
|
|
176
|
+
reload(): Promise<unknown>;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=record-reference.d.ts.map
|
|
179
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
declare module '@ember-data/store/-private/legacy-model-support/shim-model-class' {
|
|
2
|
+
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
3
|
+
import type { AttributeSchema, RelationshipSchema } from '@warp-drive/core-types/schema';
|
|
4
|
+
import type { KeyOrString, ModelSchema } from '@ember-data/store/-types/q/ds-model';
|
|
5
|
+
import type Store from '@ember-data/store/-private/store-service';
|
|
6
|
+
export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
|
|
7
|
+
export default class ShimModelClass<T = unknown> implements ModelSchema<T> {
|
|
8
|
+
__store: Store;
|
|
9
|
+
modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
|
|
10
|
+
constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string);
|
|
11
|
+
get fields(): Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>;
|
|
12
|
+
get attributes(): Map<KeyOrString<T>, AttributeSchema>;
|
|
13
|
+
get relationshipsByName(): Map<KeyOrString<T>, RelationshipSchema>;
|
|
14
|
+
eachAttribute<K extends KeyOrString<T>>(callback: (key: K, attribute: AttributeSchema) => void, binding?: T): void;
|
|
15
|
+
eachRelationship<K extends KeyOrString<T>>(callback: (key: K, relationship: RelationshipSchema) => void, binding?: T): void;
|
|
16
|
+
eachTransformedAttribute<K extends KeyOrString<T>>(callback: (key: K, type: string | null) => void, binding?: T): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=shim-model-class.d.ts.map
|
|
19
|
+
}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
declare module '@ember-data/store/-private/managers/cache-capabilities-manager' {
|
|
2
|
+
import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
|
+
import type { CacheCapabilitiesManager as StoreWrapper } from '@ember-data/store/-types/q/cache-store-wrapper';
|
|
4
|
+
import type { SchemaService } from '@ember-data/store/-types/q/schema-service';
|
|
5
|
+
import type { IdentifierCache } from '@ember-data/store/-private/caches/identifier-cache';
|
|
6
|
+
import type Store from '@ember-data/store/-private/store-service';
|
|
7
|
+
import type { NotificationType } from '@ember-data/store/-private/managers/notification-manager';
|
|
8
|
+
/**
|
|
9
|
+
@module @ember-data/store
|
|
10
|
+
*/
|
|
11
|
+
export declare class CacheCapabilitiesManager implements StoreWrapper {
|
|
12
|
+
_willNotify: boolean;
|
|
13
|
+
_pendingNotifies: Map<StableRecordIdentifier, Set<string>>;
|
|
14
|
+
_store: Store;
|
|
15
|
+
constructor(_store: Store);
|
|
16
|
+
get identifierCache(): IdentifierCache;
|
|
17
|
+
_scheduleNotification(identifier: StableRecordIdentifier, key: string): void;
|
|
18
|
+
_flushNotifications(): void;
|
|
19
|
+
notifyChange(identifier: StableRecordIdentifier, namespace: 'added' | 'removed'): void;
|
|
20
|
+
notifyChange(identifier: StableDocumentIdentifier, namespace: 'added' | 'updated' | 'removed'): void;
|
|
21
|
+
notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key?: string): void;
|
|
22
|
+
getSchemaDefinitionService(): SchemaService;
|
|
23
|
+
get schema(): SchemaService;
|
|
24
|
+
setRecordId(identifier: StableRecordIdentifier, id: string): void;
|
|
25
|
+
hasRecord(identifier: StableRecordIdentifier): boolean;
|
|
26
|
+
disconnectRecord(identifier: StableRecordIdentifier): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=cache-capabilities-manager.d.ts.map
|
|
29
|
+
}
|