@ember-data/store 5.4.0-alpha.32 → 5.4.0-alpha.34

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