@ember-data-types/store 5.4.0-beta.9 → 5.4.1-beta.0
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/LICENSE.md +19 -7
- package/README.md +5 -8
- package/logos/NCC-1701-a-blue.svg +4 -0
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/NCC-1701-a.svg +4 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +2 -3
- package/unstable-preview-types/-private/cache-handler/handler.d.ts +62 -0
- package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +1 -0
- package/unstable-preview-types/-private/{cache-handler.d.ts → cache-handler/types.d.ts} +25 -62
- package/unstable-preview-types/-private/cache-handler/types.d.ts.map +1 -0
- package/unstable-preview-types/-private/cache-handler/utils.d.ts +34 -0
- package/unstable-preview-types/-private/cache-handler/utils.d.ts.map +1 -0
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts +7 -3
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +1 -1
- package/unstable-preview-types/-private/caches/instance-cache.d.ts +4 -1
- package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +1 -1
- package/unstable-preview-types/-private/debug/utils.d.ts +9 -0
- package/unstable-preview-types/-private/debug/utils.d.ts.map +1 -0
- package/unstable-preview-types/-private/document.d.ts +23 -14
- package/unstable-preview-types/-private/document.d.ts.map +1 -1
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +1 -1
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +3 -3
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +3 -3
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +23 -1
- package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/notification-manager.d.ts +11 -6
- package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts +9 -5
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +14 -2
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts +199 -0
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +1 -0
- package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +3 -3
- package/unstable-preview-types/-private/store-service.d.ts +92 -19
- package/unstable-preview-types/-private/store-service.d.ts.map +1 -1
- package/unstable-preview-types/-private.d.ts +7 -4
- package/unstable-preview-types/-private.d.ts.map +1 -1
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +4 -4
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +1 -1
- package/unstable-preview-types/-types/q/ds-model.d.ts +3 -3
- package/unstable-preview-types/-types/q/ds-model.d.ts.map +1 -1
- package/unstable-preview-types/-types/q/schema-service.d.ts +16 -8
- package/unstable-preview-types/-types/q/schema-service.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +24 -23
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/unstable-preview-types/-private/cache-handler.d.ts.map +0 -1
- /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
- /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/cache-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAC9G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC1G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACjG,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AACzG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/cache-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAC9G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE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IACH,SAAS,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;IAItD;;;;;;;;OAQG;IACH,mBAAmB,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;CAGjE"}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
declare module '@ember-data/store/-private/managers/notification-manager' {
|
|
2
|
+
/**
|
|
3
|
+
* @module @ember-data/store
|
|
4
|
+
*/
|
|
2
5
|
import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
6
|
import type { Store } from '@ember-data/store/-private/store-service';
|
|
4
7
|
export type UnsubscribeToken = object;
|
|
5
8
|
export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
|
|
6
|
-
export type
|
|
9
|
+
export type DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';
|
|
10
|
+
export type NotificationType = 'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | CacheOperation;
|
|
7
11
|
export interface NotificationCallback {
|
|
8
12
|
(identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;
|
|
9
13
|
(identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
|
|
14
|
+
(identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
|
|
10
15
|
}
|
|
11
16
|
export interface ResourceOperationCallback {
|
|
12
17
|
(identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
|
|
13
18
|
}
|
|
14
19
|
export interface DocumentOperationCallback {
|
|
15
|
-
(identifier: StableDocumentIdentifier, notificationType:
|
|
20
|
+
(identifier: StableDocumentIdentifier, notificationType: DocumentCacheOperation): void;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* The NotificationManager provides the ability to subscribe to
|
|
@@ -28,8 +33,7 @@ declare module '@ember-data/store/-private/managers/notification-manager' {
|
|
|
28
33
|
store: Store;
|
|
29
34
|
isDestroyed: boolean;
|
|
30
35
|
_buffered: Map<StableDocumentIdentifier | StableRecordIdentifier, [string, string | undefined][]>;
|
|
31
|
-
_cache: Map<StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document',
|
|
32
|
-
_tokens: Map<UnsubscribeToken, StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document'>;
|
|
36
|
+
_cache: Map<StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document', Array<NotificationCallback | ResourceOperationCallback | DocumentOperationCallback>>;
|
|
33
37
|
_hasFlush: boolean;
|
|
34
38
|
_onFlushCB?: () => void;
|
|
35
39
|
constructor(store: Store);
|
|
@@ -83,9 +87,10 @@ declare module '@ember-data/store/-private/managers/notification-manager' {
|
|
|
83
87
|
*/
|
|
84
88
|
notify(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;
|
|
85
89
|
notify(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;
|
|
86
|
-
notify(identifier: StableRecordIdentifier
|
|
90
|
+
notify(identifier: StableRecordIdentifier, value: CacheOperation): boolean;
|
|
91
|
+
notify(identifier: StableDocumentIdentifier, value: DocumentCacheOperation): boolean;
|
|
87
92
|
_onNextFlush(cb: () => void): void;
|
|
88
|
-
_scheduleNotify():
|
|
93
|
+
_scheduleNotify(): boolean;
|
|
89
94
|
_flush(): void;
|
|
90
95
|
_flushNotification(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;
|
|
91
96
|
_flushNotification(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/notification-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notification-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/notification-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAA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K,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO;IAChH,kBAAkB,CAAC,UAAU,EAAE,sBAAsB,GAAG,wBAAwB,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO;IAyCjH,OAAO;CAIR"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare module '@ember-data/store/-private/managers/record-array-manager' {
|
|
2
|
-
import type {
|
|
2
|
+
import type { LocalRelationshipOperation } from '@warp-drive/core-types/graph';
|
|
3
|
+
import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
4
|
import type { ImmutableRequestInfo } from '@warp-drive/core-types/request';
|
|
4
5
|
import type { CollectionResourceDocument } from '@warp-drive/core-types/spec/json-api-raw';
|
|
5
6
|
import { Collection, IdentifierArray } from '@ember-data/store/-private/record-arrays/identifier-array';
|
|
@@ -60,12 +61,14 @@ declare module '@ember-data/store/-private/managers/record-array-manager' {
|
|
|
60
61
|
_identifiers: Map<StableRecordIdentifier, Set<Collection>>;
|
|
61
62
|
_staged: Map<string, ChangeSet>;
|
|
62
63
|
_subscription: UnsubscribeToken;
|
|
64
|
+
_documentSubscription: UnsubscribeToken;
|
|
63
65
|
_keyedArrays: Map<string, Collection>;
|
|
64
66
|
_visibilitySet: Map<StableRecordIdentifier, boolean>;
|
|
65
67
|
constructor(options: {
|
|
66
68
|
store: Store;
|
|
67
69
|
});
|
|
68
|
-
_syncArray(array: IdentifierArray): void;
|
|
70
|
+
_syncArray(array: IdentifierArray | Collection): void;
|
|
71
|
+
mutate(mutation: LocalRelationshipOperation): void;
|
|
69
72
|
/**
|
|
70
73
|
Get the `RecordArray` for a modelName, which contains all loaded records of
|
|
71
74
|
given modelName.
|
|
@@ -76,15 +79,16 @@ declare module '@ember-data/store/-private/managers/record-array-manager' {
|
|
|
76
79
|
@return {RecordArray}
|
|
77
80
|
*/
|
|
78
81
|
liveArrayFor(type: string): IdentifierArray;
|
|
79
|
-
|
|
82
|
+
getCollection(config: {
|
|
80
83
|
type?: string;
|
|
81
84
|
query?: ImmutableRequestInfo | Record<string, unknown>;
|
|
82
85
|
identifiers?: StableRecordIdentifier[];
|
|
83
86
|
doc?: CollectionResourceDocument;
|
|
87
|
+
identifier?: StableDocumentIdentifier | null;
|
|
84
88
|
}): Collection;
|
|
85
|
-
dirtyArray(array: IdentifierArray, delta: number): void;
|
|
89
|
+
dirtyArray(array: IdentifierArray, delta: number, shouldSyncFromCache: boolean): void;
|
|
86
90
|
_getPendingFor(identifier: StableRecordIdentifier, includeManaged: boolean, isRemove?: boolean): Map<IdentifierArray, ChangeSet> | void;
|
|
87
|
-
populateManagedArray(array: Collection, identifiers: StableRecordIdentifier[], payload: CollectionResourceDocument): void;
|
|
91
|
+
populateManagedArray(array: Collection, identifiers: StableRecordIdentifier[], payload: CollectionResourceDocument | null): void;
|
|
88
92
|
identifierAdded(identifier: StableRecordIdentifier): void;
|
|
89
93
|
identifierRemoved(identifier: StableRecordIdentifier): void;
|
|
90
94
|
identifierChanged(identifier: StableRecordIdentifier): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-array-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/record-array-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record-array-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/record-array-manager.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC1G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAG3F,OAAO,EAEL,UAAU,EACV,eAAe,EAIhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EA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,IAAI,EAAE,MAAM,GAAG,eAAe;IA4B3C,aAAa,CAAC,MAAM,EAAE;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvD,WAAW,CAAC,EAAE,sBAAsB,EAAE,CAAC;QACvC,GAAG,CAAC,EAAE,0BAA0B,CAAC;QACjC,UAAU,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;KAC9C,GAAG,UAAU;IAgCd,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,GAAG,IAAI;IAgBrF,cAAc,CACZ,UAAU,EAAE,sBAAsB,EAClC,cAAc,EAAE,OAAO,EACvB,QAAQ,CAAC,EAAE,OAAO,GACjB,GAAG,CAAC,eAAe,EAAE,SAAS,CAAC,GAAG,IAAI;IAqDzC,oBAAoB,CAClB,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,sBAAsB,EAAE,EACrC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAsB5C,eAAe,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;IAgBzD,iBAAiB,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;IAgB3D,iBAAiB,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI;IAgB3D,KAAK,CAAC,OAAO,UAAO;IAUpB,OAAO;CAOR;AA4BD,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,EACzD,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,sBAAsB,QAMnC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
declare module '@ember-data/store/-private/record-arrays/identifier-array' {
|
|
2
2
|
import type { Signal } from '@ember-data/tracking/-private';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LocalRelationshipOperation } from '@warp-drive/core-types/graph';
|
|
4
|
+
import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
4
5
|
import type { TypeFromInstanceOrString } from '@warp-drive/core-types/record';
|
|
5
6
|
import type { ImmutableRequestInfo } from '@warp-drive/core-types/request';
|
|
6
7
|
import type { Links, PaginationLinks } from '@warp-drive/core-types/spec/json-api-raw';
|
|
8
|
+
import type { BaseFinderOptions } from '@ember-data/store/types';
|
|
7
9
|
import type { RecordArrayManager } from '@ember-data/store/-private/managers/record-array-manager';
|
|
8
10
|
import type { Store } from '@ember-data/store/-private/store-service';
|
|
9
11
|
import { NativeProxy } from '@ember-data/store/-private/record-arrays/native-proxy-type-fix';
|
|
@@ -21,9 +23,18 @@ declare module '@ember-data/store/-private/record-arrays/identifier-array' {
|
|
|
21
23
|
manager: MinimumManager;
|
|
22
24
|
links?: Links | PaginationLinks | null;
|
|
23
25
|
meta?: Record<string, unknown> | null;
|
|
26
|
+
identifier?: StableDocumentIdentifier | null;
|
|
24
27
|
};
|
|
25
|
-
type
|
|
28
|
+
type PromiseTo<T> = Omit<Promise<T>, typeof Symbol.toStringTag>;
|
|
29
|
+
type PromiseManyArray<T> = {
|
|
30
|
+
length: number;
|
|
31
|
+
content: IdentifierArray<T> | null;
|
|
32
|
+
promise: Promise<IdentifierArray<T>> | null;
|
|
33
|
+
} & PromiseTo<IdentifierArray<T>>;
|
|
34
|
+
export type MinimumManager = {
|
|
26
35
|
_syncArray: (array: IdentifierArray) => void;
|
|
36
|
+
mutate?(mutation: LocalRelationshipOperation): void;
|
|
37
|
+
reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<IdentifierArray<T>> | PromiseManyArray<T>;
|
|
27
38
|
};
|
|
28
39
|
/**
|
|
29
40
|
A record array is an array that contains records of a certain type (or modelName).
|
|
@@ -60,6 +71,7 @@ declare module '@ember-data/store/-private/record-arrays/identifier-array' {
|
|
|
60
71
|
isDestroying: boolean;
|
|
61
72
|
isDestroyed: boolean;
|
|
62
73
|
_updatingPromise: Promise<IdentifierArray<T>> | null;
|
|
74
|
+
readonly identifier: StableDocumentIdentifier | null;
|
|
63
75
|
[IS_COLLECTION]: boolean;
|
|
64
76
|
[ARRAY_SIGNAL]: Signal;
|
|
65
77
|
[SOURCE]: StableRecordIdentifier[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier-array.d.ts","sourceRoot":"","sources":["../../../src/-private/record-arrays/identifier-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"identifier-array.d.ts","sourceRoot":"","sources":["../../../src/-private/record-arrays/identifier-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAY5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC1G,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAGvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAuCtD,eAAO,MAAM,YAAY,+BAA+C,CAAC;AACzE,eAAO,MAAM,MAAM,+BAA+C,CAAC;AACnE,eAAO,MAAM,MAAM,+BAA+C,CAAC;AACnE,eAAO,MAAM,MAAM,+BAA+C,CAAC;AACn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AET;IACD,IAAI,MAAM,CAAC,KAAK,QAAA,EAEf;gBAEW,OAAO,EAAE,4BAA4B,CAAC,CAAC,CAAC;IAmPpD;;;;;;;;;;;;;;;;;;;MAmBE;IACF,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAyBrC,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAUtC;;;;;;;;;;;;;;;;MAgBE;IACF,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC;CAKjC;AAsBD,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,GAAG;IACnE,OAAO,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,qBAAa,UAAU,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IAC7D,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAQ;IAC5D,QAAQ,EAAE,kBAAkB,CAAC;gBAEzB,OAAO,EAAE,uBAAuB;IAM5C,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAejC,OAAO,CAAC,KAAK,EAAE,OAAO;CAKvB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
declare module '@ember-data/store/-private/record-arrays/many-array' {
|
|
2
|
+
import type { Signal } from '@ember-data/tracking/-private';
|
|
3
|
+
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
4
|
+
import type { Cache } from '@warp-drive/core-types/cache';
|
|
5
|
+
import type { TypedRecordInstance, TypeFromInstance, TypeFromInstanceOrString } from '@warp-drive/core-types/record';
|
|
6
|
+
import type { Links, PaginationLinks } from '@warp-drive/core-types/spec/json-api-raw';
|
|
7
|
+
import type { BaseFinderOptions, ModelSchema } from '@ember-data/store/types';
|
|
8
|
+
import type { CreateRecordProperties, Store } from '@ember-data/store/-private/store-service';
|
|
9
|
+
import type { MinimumManager } from '@ember-data/store/-private/record-arrays/identifier-array';
|
|
10
|
+
import { IdentifierArray, MUTATE } from '@ember-data/store/-private/record-arrays/identifier-array';
|
|
11
|
+
import type { NativeProxy } from '@ember-data/store/-private/record-arrays/native-proxy-type-fix';
|
|
12
|
+
export interface ManyArrayCreateArgs<T> {
|
|
13
|
+
identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];
|
|
14
|
+
type: TypeFromInstanceOrString<T>;
|
|
15
|
+
store: Store;
|
|
16
|
+
allowMutation: boolean;
|
|
17
|
+
manager: MinimumManager;
|
|
18
|
+
identifier: StableRecordIdentifier;
|
|
19
|
+
cache: Cache;
|
|
20
|
+
meta: Record<string, unknown> | null;
|
|
21
|
+
links: Links | PaginationLinks | null;
|
|
22
|
+
key: string;
|
|
23
|
+
isPolymorphic: boolean;
|
|
24
|
+
isAsync: boolean;
|
|
25
|
+
_inverseIsAsync: boolean;
|
|
26
|
+
isLoaded: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
|
30
|
+
relationship.
|
|
31
|
+
|
|
32
|
+
The `ManyArray` is instantiated lazily the first time the relationship is
|
|
33
|
+
requested.
|
|
34
|
+
|
|
35
|
+
This class is not intended to be directly instantiated by consuming applications.
|
|
36
|
+
|
|
37
|
+
### Inverses
|
|
38
|
+
|
|
39
|
+
Often, the relationships in Ember Data applications will have
|
|
40
|
+
an inverse. For example, imagine the following models are
|
|
41
|
+
defined:
|
|
42
|
+
|
|
43
|
+
```app/models/post.js
|
|
44
|
+
import Model, { hasMany } from '@ember-data/model';
|
|
45
|
+
|
|
46
|
+
export default class PostModel extends Model {
|
|
47
|
+
@hasMany('comment') comments;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```app/models/comment.js
|
|
52
|
+
import Model, { belongsTo } from '@ember-data/model';
|
|
53
|
+
|
|
54
|
+
export default class CommentModel extends Model {
|
|
55
|
+
@belongsTo('post') post;
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If you created a new instance of `Post` and added
|
|
60
|
+
a `Comment` record to its `comments` has-many
|
|
61
|
+
relationship, you would expect the comment's `post`
|
|
62
|
+
property to be set to the post that contained
|
|
63
|
+
the has-many.
|
|
64
|
+
|
|
65
|
+
We call the record to which a relationship belongs-to the
|
|
66
|
+
relationship's _owner_.
|
|
67
|
+
|
|
68
|
+
@class ManyArray
|
|
69
|
+
@public
|
|
70
|
+
*/
|
|
71
|
+
export class RelatedCollection<T = unknown> extends IdentifierArray<T> {
|
|
72
|
+
isAsync: boolean;
|
|
73
|
+
/**
|
|
74
|
+
The loading state of this array
|
|
75
|
+
|
|
76
|
+
@property {Boolean} isLoaded
|
|
77
|
+
@public
|
|
78
|
+
*/
|
|
79
|
+
isLoaded: boolean;
|
|
80
|
+
/**
|
|
81
|
+
`true` if the relationship is polymorphic, `false` otherwise.
|
|
82
|
+
|
|
83
|
+
@property {Boolean} isPolymorphic
|
|
84
|
+
@private
|
|
85
|
+
*/
|
|
86
|
+
isPolymorphic: boolean;
|
|
87
|
+
_inverseIsAsync: boolean;
|
|
88
|
+
/**
|
|
89
|
+
Metadata associated with the request for async hasMany relationships.
|
|
90
|
+
|
|
91
|
+
Example
|
|
92
|
+
|
|
93
|
+
Given that the server returns the following JSON payload when fetching a
|
|
94
|
+
hasMany relationship:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
{
|
|
98
|
+
"comments": [{
|
|
99
|
+
"id": 1,
|
|
100
|
+
"comment": "This is the first comment",
|
|
101
|
+
}, {
|
|
102
|
+
// ...
|
|
103
|
+
}],
|
|
104
|
+
|
|
105
|
+
"meta": {
|
|
106
|
+
"page": 1,
|
|
107
|
+
"total": 5
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
You can then access the meta data via the `meta` property:
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
let comments = await post.comments;
|
|
116
|
+
let meta = comments.meta;
|
|
117
|
+
|
|
118
|
+
// meta.page => 1
|
|
119
|
+
// meta.total => 5
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
@property {Object | null} meta
|
|
123
|
+
@public
|
|
124
|
+
*/
|
|
125
|
+
meta: Record<string, unknown> | null;
|
|
126
|
+
/**
|
|
127
|
+
* Retrieve the links for this relationship
|
|
128
|
+
*
|
|
129
|
+
@property {Object | null} links
|
|
130
|
+
@public
|
|
131
|
+
*/
|
|
132
|
+
links: Links | PaginationLinks | null;
|
|
133
|
+
identifier: StableRecordIdentifier;
|
|
134
|
+
cache: Cache;
|
|
135
|
+
_manager: MinimumManager;
|
|
136
|
+
store: Store;
|
|
137
|
+
key: string;
|
|
138
|
+
type: ModelSchema;
|
|
139
|
+
modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
|
|
140
|
+
constructor(options: ManyArrayCreateArgs<T>);
|
|
141
|
+
[MUTATE](target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>, prop: string, args: unknown[], _SIGNAL: Signal): unknown;
|
|
142
|
+
notify(): void;
|
|
143
|
+
/**
|
|
144
|
+
Reloads all of the records in the manyArray. If the manyArray
|
|
145
|
+
holds a relationship that was originally fetched using a links url
|
|
146
|
+
EmberData will revisit the original links url to repopulate the
|
|
147
|
+
relationship.
|
|
148
|
+
|
|
149
|
+
If the ManyArray holds the result of a `store.query()` reload will
|
|
150
|
+
re-run the original query.
|
|
151
|
+
|
|
152
|
+
Example
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
let user = store.peekRecord('user', '1')
|
|
156
|
+
await login(user);
|
|
157
|
+
|
|
158
|
+
let permissions = await user.permissions;
|
|
159
|
+
await permissions.reload();
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
@method reload
|
|
163
|
+
@public
|
|
164
|
+
*/
|
|
165
|
+
reload(options?: BaseFinderOptions): Promise<this>;
|
|
166
|
+
/**
|
|
167
|
+
Saves all of the records in the `ManyArray`.
|
|
168
|
+
|
|
169
|
+
Note: this API can only be used in legacy mode with a configured Adapter.
|
|
170
|
+
|
|
171
|
+
Example
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
const { content: { data: inbox } } = await store.request(findRecord({ type: 'inbox', id: '1' }));
|
|
175
|
+
|
|
176
|
+
let messages = await inbox.messages;
|
|
177
|
+
messages.forEach((message) => {
|
|
178
|
+
message.isRead = true;
|
|
179
|
+
});
|
|
180
|
+
messages.save();
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
@method save
|
|
184
|
+
@public
|
|
185
|
+
@return {PromiseArray} promise
|
|
186
|
+
*/
|
|
187
|
+
/**
|
|
188
|
+
Create a child record within the owner
|
|
189
|
+
|
|
190
|
+
@method createRecord
|
|
191
|
+
@public
|
|
192
|
+
@param {Object} hash
|
|
193
|
+
@return {Model} record
|
|
194
|
+
*/
|
|
195
|
+
createRecord(hash: CreateRecordProperties<T>): T;
|
|
196
|
+
destroy(): void;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=many-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"many-array.d.ts","sourceRoot":"","sources":["../../../src/-private/record-arrays/many-array.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAI5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAEV,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,e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e,EAAE,OAAO,CAAC;IACjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoCI;IACI,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7C;;;;;SAKK;IACG,KAAK,EAAE,KAAK,GAAG,eAAe,GAAG,IAAI,CAAC;IACtC,UAAU,EAAE,sBAAsB,CAAC;IACnC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,CAAC,SAAS,mBAAmB,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;gBAEpE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAS3C,CAAC,MAAM,CAAC,CACN,MAAM,EAAE,sBAAsB,EAAE,EAChC,QAAQ,EAAE,OAAO,WAAW,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC,EAC3D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,EAAE,MAAM,GACd,OAAO;IA4MV,MAAM;IAMN;;;;;;;;;;;;;;;;;;;;;MAqBE;IACF,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IASlD;;;;;;;;;;;;;;;;;;;;MAoBE;IAEF;;;;;;;MAOE;IACF,YAAY,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC;IAShD,OAAO;CAGR"}
|
|
@@ -16,7 +16,7 @@ declare module '@ember-data/store/-private/record-arrays/native-proxy-type-fix'
|
|
|
16
16
|
/**
|
|
17
17
|
* A trap for `Object.defineProperty()`.
|
|
18
18
|
* @param target The original object which is being proxied.
|
|
19
|
-
* @
|
|
19
|
+
* @return A `Boolean` indicating whether or not the property has been defined.
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
defineProperty?(target: T, property: string | symbol, attributes: PropertyDescriptor): boolean;
|
|
@@ -24,7 +24,7 @@ declare module '@ember-data/store/-private/record-arrays/native-proxy-type-fix'
|
|
|
24
24
|
* A trap for the `delete` operator.
|
|
25
25
|
* @param target The original object which is being proxied.
|
|
26
26
|
* @param p The name or `Symbol` of the property to delete.
|
|
27
|
-
* @
|
|
27
|
+
* @return A `Boolean` indicating whether or not the property was deleted.
|
|
28
28
|
* @internal
|
|
29
29
|
*/
|
|
30
30
|
deleteProperty?(target: T, p: string | symbol): boolean;
|
|
@@ -79,7 +79,7 @@ declare module '@ember-data/store/-private/record-arrays/native-proxy-type-fix'
|
|
|
79
79
|
* @param target The original object which is being proxied.
|
|
80
80
|
* @param p The name or `Symbol` of the property to set.
|
|
81
81
|
* @param receiver The object to which the assignment was originally directed.
|
|
82
|
-
* @
|
|
82
|
+
* @return A `Boolean` indicating whether or not the property was set.
|
|
83
83
|
* @internal
|
|
84
84
|
*/
|
|
85
85
|
set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean;
|
|
@@ -3,7 +3,7 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
3
3
|
import type { Future } from '@ember-data/request';
|
|
4
4
|
import type { Cache } from '@warp-drive/core-types/cache';
|
|
5
5
|
import type { Graph } from '@warp-drive/core-types/graph';
|
|
6
|
-
import type {
|
|
6
|
+
import type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
7
7
|
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
8
8
|
import type { CollectionResourceDocument, EmptyResourceDocument, JsonApiDocument, ResourceIdentifierObject, SingleResourceDocument } from '@warp-drive/core-types/spec/json-api-raw';
|
|
9
9
|
import type { Type } from '@warp-drive/core-types/symbols';
|
|
@@ -12,10 +12,10 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
12
12
|
import type { OpaqueRecordInstance } from '@ember-data/store/-types/q/record-instance';
|
|
13
13
|
import type { SchemaService } from '@ember-data/store/-types/q/schema-service';
|
|
14
14
|
import type { FindAllOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions } from '@ember-data/store/-types/q/store';
|
|
15
|
-
import type {
|
|
15
|
+
import type { StoreRequestInput } from '@ember-data/store/-private/cache-handler/handler';
|
|
16
|
+
import type { CachePolicy } from '@ember-data/store/-private/cache-handler/types';
|
|
16
17
|
import { IdentifierCache } from '@ember-data/store/-private/caches/identifier-cache';
|
|
17
18
|
import { InstanceCache, storeFor } from '@ember-data/store/-private/caches/instance-cache';
|
|
18
|
-
import type { Document } from '@ember-data/store/-private/document';
|
|
19
19
|
import type RecordReference from '@ember-data/store/-private/legacy-model-support/record-reference';
|
|
20
20
|
import NotificationManager from '@ember-data/store/-private/managers/notification-manager';
|
|
21
21
|
import { RecordArrayManager } from '@ember-data/store/-private/managers/record-array-manager';
|
|
@@ -59,6 +59,65 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
59
59
|
[key: string]: unknown;
|
|
60
60
|
}): OpaqueRecordInstance;
|
|
61
61
|
teardownRecord(record: OpaqueRecordInstance): void;
|
|
62
|
+
/**
|
|
63
|
+
* This hook enables an app to supply a SchemaService
|
|
64
|
+
* for use when information about a resource's schema needs
|
|
65
|
+
* to be queried.
|
|
66
|
+
*
|
|
67
|
+
* This method will only be called once to instantiate the singleton
|
|
68
|
+
* service, which can then be accessed via `store.schema`.
|
|
69
|
+
*
|
|
70
|
+
* For Example, to use the default SchemaService for SchemaRecord
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { SchemaService } from '@warp-drive/schema-record';
|
|
74
|
+
*
|
|
75
|
+
* class extends Store {
|
|
76
|
+
* createSchemaService() {
|
|
77
|
+
* return new SchemaService();
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* Or to use the SchemaService for @ember-data/model
|
|
83
|
+
*
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { buildSchema } from '@ember-data/model/hooks';
|
|
86
|
+
*
|
|
87
|
+
* class extends Store {
|
|
88
|
+
* createSchemaService() {
|
|
89
|
+
* return buildSchema(this);
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* If you wish to chain services, you must either
|
|
95
|
+
* instantiate each schema source directly or super to retrieve
|
|
96
|
+
* an existing service. For convenience, when migrating from
|
|
97
|
+
* `@ember-data/model` to `@warp-drive/schema-record` a
|
|
98
|
+
* SchemaService is provided that handles this transition
|
|
99
|
+
* for you:
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* import { DelegatingSchemaService } from '@ember-data/model/migration-support';
|
|
103
|
+
* import { SchemaService } from '@warp-drive/schema-record';
|
|
104
|
+
*
|
|
105
|
+
* class extends Store {
|
|
106
|
+
* createSchemaService() {
|
|
107
|
+
* const schema = new SchemaService();
|
|
108
|
+
* return new DelegatingSchemaService(this, schema);
|
|
109
|
+
* }
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* When using the DelegateSchemaService, the schema will first
|
|
114
|
+
* be sourced from directly registered schemas, then will fallback
|
|
115
|
+
* to sourcing a schema from available models if no schema is found.
|
|
116
|
+
*
|
|
117
|
+
* @method createSchemaService (hook)
|
|
118
|
+
* @return {SchemaService}
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
62
121
|
createSchemaService(): SchemaService;
|
|
63
122
|
/**
|
|
64
123
|
* DEPRECATED - Use the property `store.schema` instead.
|
|
@@ -236,12 +295,9 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
236
295
|
* import Fetch from '@ember-data/request/fetch';
|
|
237
296
|
*
|
|
238
297
|
* class extends Store {
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* this.requestManager.use([Fetch]);
|
|
243
|
-
* this.requestManager.useCache(CacheHandler);
|
|
244
|
-
* }
|
|
298
|
+
* requestManager = new RequestManager()
|
|
299
|
+
* .use([Fetch])
|
|
300
|
+
* .useCache(CacheHandler);
|
|
245
301
|
* }
|
|
246
302
|
* ```
|
|
247
303
|
*
|
|
@@ -282,13 +338,22 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
282
338
|
_graph?: Graph;
|
|
283
339
|
_requestCache: RequestStateService;
|
|
284
340
|
_instanceCache: InstanceCache;
|
|
285
|
-
_documentCache: Map<StableDocumentIdentifier, Document<OpaqueRecordInstance | OpaqueRecordInstance[] | null | undefined>>;
|
|
286
341
|
_cbs: {
|
|
287
342
|
coalesce?: () => void;
|
|
288
343
|
sync?: () => void;
|
|
289
344
|
notify?: () => void;
|
|
290
345
|
} | null;
|
|
291
346
|
_forceShim: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Async flush buffers notifications until flushed
|
|
349
|
+
* by finalization of a future configured by store.request
|
|
350
|
+
*
|
|
351
|
+
* This is useful for ensuring that notifications are delivered
|
|
352
|
+
* prior to the promise resolving but without risk of promise
|
|
353
|
+
* interleaving.
|
|
354
|
+
*
|
|
355
|
+
* @internal
|
|
356
|
+
*/
|
|
292
357
|
_enableAsyncFlush: boolean | null;
|
|
293
358
|
DISABLE_WAITER?: boolean;
|
|
294
359
|
_isDestroying: boolean;
|
|
@@ -303,6 +368,15 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
303
368
|
*/
|
|
304
369
|
constructor(createArgs?: unknown);
|
|
305
370
|
_run(cb: () => void): void;
|
|
371
|
+
/**
|
|
372
|
+
* Executes the callback, ensurng that any work that calls
|
|
373
|
+
* store._schedule is executed after in the right order.
|
|
374
|
+
*
|
|
375
|
+
* When queues already exist, scheduled callbacks will
|
|
376
|
+
* join the existing queue.
|
|
377
|
+
*
|
|
378
|
+
* @internal
|
|
379
|
+
*/
|
|
306
380
|
_join(cb: () => void): void;
|
|
307
381
|
_schedule(name: 'coalesce' | 'sync' | 'notify', cb: () => void): void;
|
|
308
382
|
/**
|
|
@@ -482,9 +556,8 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
482
556
|
Example
|
|
483
557
|
|
|
484
558
|
```javascript
|
|
485
|
-
store.findRecord('post', '1')
|
|
486
|
-
|
|
487
|
-
});
|
|
559
|
+
const { content: { data: post } } = await store.request(findRecord({ type: 'post', id: '1' }));
|
|
560
|
+
store.unloadRecord(post);
|
|
488
561
|
```
|
|
489
562
|
|
|
490
563
|
@method unloadRecord
|
|
@@ -753,7 +826,7 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
753
826
|
```app/routes/post.js
|
|
754
827
|
export default class PostRoute extends Route {
|
|
755
828
|
model(params) {
|
|
756
|
-
return this.store.findRecord('post', params.post_id, { include: 'comments' });
|
|
829
|
+
return this.store.findRecord('post', params.post_id, { include: ['comments'] });
|
|
757
830
|
}
|
|
758
831
|
}
|
|
759
832
|
```
|
|
@@ -781,14 +854,14 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
781
854
|
`model.comments`.
|
|
782
855
|
|
|
783
856
|
Multiple relationships can be requested using an `include` parameter consisting of a
|
|
784
|
-
|
|
857
|
+
list of relationship names, while nested relationships can be specified
|
|
785
858
|
using a dot-separated sequence of relationship names. So to request both the post's
|
|
786
859
|
comments and the authors of those comments the request would look like this:
|
|
787
860
|
|
|
788
861
|
```app/routes/post.js
|
|
789
862
|
export default class PostRoute extends Route {
|
|
790
863
|
model(params) {
|
|
791
|
-
return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });
|
|
864
|
+
return this.store.findRecord('post', params.post_id, { include: ['comments','comments.author'] });
|
|
792
865
|
}
|
|
793
866
|
}
|
|
794
867
|
```
|
|
@@ -1245,19 +1318,19 @@ declare module '@ember-data/store/-private/store-service' {
|
|
|
1245
1318
|
```app/routes/posts.js
|
|
1246
1319
|
export default class PostsRoute extends Route {
|
|
1247
1320
|
model() {
|
|
1248
|
-
return this.store.findAll('post', { include: 'comments' });
|
|
1321
|
+
return this.store.findAll('post', { include: ['comments'] });
|
|
1249
1322
|
}
|
|
1250
1323
|
}
|
|
1251
1324
|
```
|
|
1252
1325
|
Multiple relationships can be requested using an `include` parameter consisting of a
|
|
1253
|
-
|
|
1326
|
+
list or relationship names, while nested relationships can be specified
|
|
1254
1327
|
using a dot-separated sequence of relationship names. So to request both the posts'
|
|
1255
1328
|
comments and the authors of those comments the request would look like this:
|
|
1256
1329
|
|
|
1257
1330
|
```app/routes/posts.js
|
|
1258
1331
|
export default class PostsRoute extends Route {
|
|
1259
1332
|
model() {
|
|
1260
|
-
return this.store.findAll('post', { include: 'comments,comments.author' });
|
|
1333
|
+
return this.store.findAll('post', { include: ['comments','comments.author'] });
|
|
1261
1334
|
}
|
|
1262
1335
|
}
|
|
1263
1336
|
```
|