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