@ember-data/store 5.4.0-alpha.32 → 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,61 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import type {
|
|
10
|
-
import type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export declare function recordIdentifierFor(record:
|
|
33
|
-
export declare function
|
|
34
|
-
export declare
|
|
35
|
-
export declare
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export declare function
|
|
59
|
-
export declare function
|
|
60
|
-
export
|
|
61
|
-
|
|
1
|
+
declare module '@ember-data/store/-private/caches/instance-cache' {
|
|
2
|
+
import type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
|
+
import type { Value } from '@warp-drive/core-types/json/raw';
|
|
4
|
+
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
5
|
+
import type { Cache } from '@ember-data/store/-types/q/cache';
|
|
6
|
+
import type { OpaqueRecordInstance } from '@ember-data/store/-types/q/record-instance';
|
|
7
|
+
import RecordReference from '@ember-data/store/-private/legacy-model-support/record-reference';
|
|
8
|
+
import { CacheCapabilitiesManager } from '@ember-data/store/-private/managers/cache-capabilities-manager';
|
|
9
|
+
import type { CacheManager } from '@ember-data/store/-private/managers/cache-manager';
|
|
10
|
+
import type { CreateRecordProperties } from '@ember-data/store/-private/store-service';
|
|
11
|
+
import type Store from '@ember-data/store/-private/store-service';
|
|
12
|
+
export declare function peekRecordIdentifier(record: OpaqueRecordInstance): StableRecordIdentifier | undefined;
|
|
13
|
+
/**
|
|
14
|
+
Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/StableRecordIdentifier)
|
|
15
|
+
assigned to the given record instance.
|
|
16
|
+
```js
|
|
17
|
+
import { recordIdentifierFor } from "@ember-data/store";
|
|
18
|
+
// ... gain access to a record, for instance with peekRecord or findRecord
|
|
19
|
+
const record = store.peekRecord("user", "1");
|
|
20
|
+
// get the identifier for the record (see docs for StableRecordIdentifier)
|
|
21
|
+
const identifier = recordIdentifierFor(record);
|
|
22
|
+
// access the identifier's properties.
|
|
23
|
+
const { id, type, lid } = identifier;
|
|
24
|
+
```
|
|
25
|
+
@method recordIdentifierFor
|
|
26
|
+
@public
|
|
27
|
+
@static
|
|
28
|
+
@for @ember-data/store
|
|
29
|
+
@param {Object} record a record instance previously obstained from the store.
|
|
30
|
+
@return {StableRecordIdentifier}
|
|
31
|
+
*/
|
|
32
|
+
export declare function recordIdentifierFor<T extends TypedRecordInstance>(record: T): StableRecordIdentifier<TypeFromInstance<T>>;
|
|
33
|
+
export declare function recordIdentifierFor(record: OpaqueRecordInstance): StableRecordIdentifier;
|
|
34
|
+
export declare function setRecordIdentifier(record: OpaqueRecordInstance, identifier: StableRecordIdentifier): void;
|
|
35
|
+
export declare const StoreMap: Map<unknown, Store>;
|
|
36
|
+
export declare function storeFor(record: OpaqueRecordInstance): Store | undefined;
|
|
37
|
+
type Caches = {
|
|
38
|
+
record: Map<StableRecordIdentifier, OpaqueRecordInstance>;
|
|
39
|
+
reference: WeakMap<StableRecordIdentifier, RecordReference>;
|
|
40
|
+
};
|
|
41
|
+
export declare class InstanceCache {
|
|
42
|
+
store: Store;
|
|
43
|
+
cache: Cache;
|
|
44
|
+
_storeWrapper: CacheCapabilitiesManager;
|
|
45
|
+
__cacheFor: (resource: RecordIdentifier) => Cache;
|
|
46
|
+
__cacheManager: CacheManager;
|
|
47
|
+
__instances: Caches;
|
|
48
|
+
constructor(store: Store);
|
|
49
|
+
peek(identifier: StableRecordIdentifier): Cache | OpaqueRecordInstance | undefined;
|
|
50
|
+
getRecord(identifier: StableRecordIdentifier, properties?: CreateRecordProperties): OpaqueRecordInstance;
|
|
51
|
+
getReference(identifier: StableRecordIdentifier): RecordReference;
|
|
52
|
+
recordIsLoaded(identifier: StableRecordIdentifier, filterDeleted?: boolean): boolean;
|
|
53
|
+
disconnect(identifier: StableRecordIdentifier): void;
|
|
54
|
+
unloadRecord(identifier: StableRecordIdentifier): void;
|
|
55
|
+
clear(type?: string): void;
|
|
56
|
+
setRecordId(identifier: StableRecordIdentifier, id: string): void;
|
|
57
|
+
}
|
|
58
|
+
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean;
|
|
59
|
+
export declare function preloadData(store: Store, identifier: StableRecordIdentifier, preload: Record<string, Value>): void;
|
|
60
|
+
export declare function _clearCaches(): void;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=instance-cache.d.ts.map
|
|
63
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
declare module '@ember-data/store/-private/caches/resource-utils' {
|
|
2
|
+
export declare function hasLid(resource: unknown): resource is {
|
|
3
|
+
lid: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function hasId(resource: unknown): resource is {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function hasType(resource: unknown): resource is {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=resource-utils.d.ts.map
|
|
12
|
+
}
|
|
@@ -1,144 +1,146 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
109
|
-
|
|
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
|
-
|
|
1
|
+
declare module '@ember-data/store/-private/document' {
|
|
2
|
+
import type { StableDocumentIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
|
+
import type { RequestInfo } from '@warp-drive/core-types/request';
|
|
4
|
+
import type { Meta, PaginationLinks } from '@warp-drive/core-types/spec/raw';
|
|
5
|
+
import type Store from '@ember-data/store/-private/store-service';
|
|
6
|
+
/**
|
|
7
|
+
* A Document is a class that wraps the response content from a request to the API
|
|
8
|
+
* returned by `Cache.put` or `Cache.peek`, converting resource-identifiers into
|
|
9
|
+
* record instances.
|
|
10
|
+
*
|
|
11
|
+
* It is not directly instantiated by the user, and its properties should not
|
|
12
|
+
* be directly modified. Whether individual properties are mutable or not is
|
|
13
|
+
* determined by the record instance itself.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* @class Document
|
|
17
|
+
*/
|
|
18
|
+
export declare class Document<T> {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* The links object for this document, if any
|
|
22
|
+
*
|
|
23
|
+
* e.g.
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* {
|
|
27
|
+
* self: '/articles?page[number]=3',
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @property links
|
|
32
|
+
* @type {object|undefined} - a links object
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
links?: PaginationLinks;
|
|
36
|
+
/**
|
|
37
|
+
* The primary data for this document, if any.
|
|
38
|
+
*
|
|
39
|
+
* If this document has no primary data (e.g. because it is an error document)
|
|
40
|
+
* this property will be `undefined`.
|
|
41
|
+
*
|
|
42
|
+
* For collections this will be an array of record instances,
|
|
43
|
+
* for single resource requests it will be a single record instance or null.
|
|
44
|
+
*
|
|
45
|
+
* @property data
|
|
46
|
+
* @public
|
|
47
|
+
* @type {object|Array<object>|null|undefined} - a data object
|
|
48
|
+
*/
|
|
49
|
+
data?: T;
|
|
50
|
+
/**
|
|
51
|
+
* The errors returned by the API for this request, if any
|
|
52
|
+
*
|
|
53
|
+
* @property errors
|
|
54
|
+
* @public
|
|
55
|
+
* @type {object|undefined} - an errors object
|
|
56
|
+
*/
|
|
57
|
+
errors?: object[];
|
|
58
|
+
/**
|
|
59
|
+
* The meta object for this document, if any
|
|
60
|
+
*
|
|
61
|
+
* @property meta
|
|
62
|
+
* @public
|
|
63
|
+
* @type {object|undefined} - a meta object
|
|
64
|
+
*/
|
|
65
|
+
meta?: Meta;
|
|
66
|
+
/**
|
|
67
|
+
* The identifier associated with this document, if any
|
|
68
|
+
*
|
|
69
|
+
* @property identifier
|
|
70
|
+
* @public
|
|
71
|
+
* @type {StableDocumentIdentifier|null}
|
|
72
|
+
*/
|
|
73
|
+
identifier: StableDocumentIdentifier | null;
|
|
74
|
+
constructor(store: Store, identifier: StableDocumentIdentifier | null);
|
|
75
|
+
/**
|
|
76
|
+
* Fetches the related link for this document, returning a promise that resolves
|
|
77
|
+
* with the document when the request completes. If no related link is present,
|
|
78
|
+
* will fallback to the self link if present
|
|
79
|
+
*
|
|
80
|
+
* @method fetch
|
|
81
|
+
* @public
|
|
82
|
+
* @param {object} options
|
|
83
|
+
* @return Promise<Document>
|
|
84
|
+
*/
|
|
85
|
+
fetch(options?: Partial<RequestInfo>): Promise<Document<T>>;
|
|
86
|
+
/**
|
|
87
|
+
* Fetches the next link for this document, returning a promise that resolves
|
|
88
|
+
* with the new document when the request completes, or null if there is no
|
|
89
|
+
* next link.
|
|
90
|
+
*
|
|
91
|
+
* @method next
|
|
92
|
+
* @public
|
|
93
|
+
* @param {object} options
|
|
94
|
+
* @return Promise<Document | null>
|
|
95
|
+
*/
|
|
96
|
+
next(options?: Partial<RequestInfo>): Promise<Document<T> | null>;
|
|
97
|
+
/**
|
|
98
|
+
* Fetches the prev link for this document, returning a promise that resolves
|
|
99
|
+
* with the new document when the request completes, or null if there is no
|
|
100
|
+
* prev link.
|
|
101
|
+
*
|
|
102
|
+
* @method prev
|
|
103
|
+
* @public
|
|
104
|
+
* @param {object} options
|
|
105
|
+
* @return Promise<Document | null>
|
|
106
|
+
*/
|
|
107
|
+
prev(options?: Partial<RequestInfo>): Promise<Document<T> | null>;
|
|
108
|
+
/**
|
|
109
|
+
* Fetches the first link for this document, returning a promise that resolves
|
|
110
|
+
* with the new document when the request completes, or null if there is no
|
|
111
|
+
* first link.
|
|
112
|
+
*
|
|
113
|
+
* @method first
|
|
114
|
+
* @public
|
|
115
|
+
* @param {object} options
|
|
116
|
+
* @return Promise<Document | null>
|
|
117
|
+
*/
|
|
118
|
+
first(options?: Partial<RequestInfo>): Promise<Document<T> | null>;
|
|
119
|
+
/**
|
|
120
|
+
* Fetches the last link for this document, returning a promise that resolves
|
|
121
|
+
* with the new document when the request completes, or null if there is no
|
|
122
|
+
* last link.
|
|
123
|
+
*
|
|
124
|
+
* @method last
|
|
125
|
+
* @public
|
|
126
|
+
* @param {object} options
|
|
127
|
+
* @return Promise<Document | null>
|
|
128
|
+
*/
|
|
129
|
+
last(options?: Partial<RequestInfo>): Promise<Document<T> | null>;
|
|
130
|
+
/**
|
|
131
|
+
* Implemented for `JSON.stringify` support.
|
|
132
|
+
*
|
|
133
|
+
* Returns the JSON representation of the document wrapper.
|
|
134
|
+
*
|
|
135
|
+
* This is a shallow serialization, it does not deeply serialize
|
|
136
|
+
* the document's contents, leaving that to the individual record
|
|
137
|
+
* instances to determine how to do, if at all.
|
|
138
|
+
*
|
|
139
|
+
* @method toJSON
|
|
140
|
+
* @public
|
|
141
|
+
* @return
|
|
142
|
+
*/
|
|
143
|
+
toJSON(): object;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=document.d.ts.map
|
|
146
|
+
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
|
|
1
|
+
declare module '@ember-data/store/-private/index' {
|
|
2
|
+
/**
|
|
3
|
+
@module @ember-data/store
|
|
4
|
+
*/
|
|
5
|
+
export { default as Store, storeFor } from '@ember-data/store/-private/store-service';
|
|
6
|
+
export { recordIdentifierFor } from '@ember-data/store/-private/caches/instance-cache';
|
|
7
|
+
export { CacheHandler, type LifetimesService } from '@ember-data/store/-private/cache-handler';
|
|
8
|
+
export { setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, isStableIdentifier, } from '@ember-data/store/-private/caches/identifier-cache';
|
|
9
|
+
export { default as coerceId } from '@ember-data/store/-private/utils/coerce-id';
|
|
10
|
+
export { default as RecordArray, default as IdentifierArray, Collection as AdapterPopulatedRecordArray, notifyArray, SOURCE, MUTATE, ARRAY_SIGNAL, } from '@ember-data/store/-private/record-arrays/identifier-array';
|
|
11
|
+
export { default as RecordArrayManager, fastPush } from '@ember-data/store/-private/managers/record-array-manager';
|
|
12
|
+
export { _clearCaches } from '@ember-data/store/-private/caches/instance-cache';
|
|
13
|
+
export { default as peekCache, removeRecordDataFor } from '@ember-data/store/-private/caches/cache-utils';
|
|
14
|
+
export { setRecordIdentifier, StoreMap } from '@ember-data/store/-private/caches/instance-cache';
|
|
15
|
+
export { setCacheFor } from '@ember-data/store/-private/caches/cache-utils';
|
|
16
|
+
export { default as _deprecatingNormalize } from '@ember-data/store/-private/utils/normalize-model-name';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
18
|
+
}
|