@ember-data/store 5.5.0-alpha.11 → 5.5.0-alpha.13
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 +21 -12
- package/addon-main.cjs +5 -0
- package/dist/-private.js +1 -0
- package/{addon → dist}/index.js +4 -1
- package/{addon/store-service-b98547c2.js → dist/many-array-BwVo-2vv.js} +2757 -1384
- package/dist/many-array-BwVo-2vv.js.map +1 -0
- package/dist/types.js +0 -0
- package/dist/types.js.map +1 -0
- 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 +58 -51
- 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/types.d.ts +107 -0
- 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/cache-utils.d.ts +11 -0
- package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +1 -0
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts +180 -0
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +1 -0
- package/unstable-preview-types/-private/caches/instance-cache.d.ts +64 -0
- package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +1 -0
- package/unstable-preview-types/-private/caches/resource-utils.d.ts +12 -0
- package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +1 -0
- 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 +155 -0
- package/unstable-preview-types/-private/document.d.ts.map +1 -0
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +179 -0
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +1 -0
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +19 -0
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +1 -0
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +31 -0
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +1 -0
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +463 -0
- package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +1 -0
- package/unstable-preview-types/-private/managers/notification-manager.d.ts +101 -0
- package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -0
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts +101 -0
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +1 -0
- package/unstable-preview-types/-private/network/request-cache.d.ts +109 -0
- package/unstable-preview-types/-private/network/request-cache.d.ts.map +1 -0
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +150 -0
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -0
- 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 +118 -0
- package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts.map +1 -0
- package/unstable-preview-types/-private/store-service.d.ts +1595 -0
- package/unstable-preview-types/-private/store-service.d.ts.map +1 -0
- package/unstable-preview-types/-private/store-service.type-test.d.ts +4 -0
- package/unstable-preview-types/-private/store-service.type-test.d.ts.map +1 -0
- package/unstable-preview-types/-private/utils/coerce-id.d.ts +10 -0
- package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +1 -0
- package/unstable-preview-types/-private/utils/construct-resource.d.ts +9 -0
- package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +1 -0
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +4 -0
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +1 -0
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +4 -0
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +1 -0
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +4 -0
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +1 -0
- package/unstable-preview-types/-private.d.ts +28 -0
- package/unstable-preview-types/-private.d.ts.map +1 -0
- package/unstable-preview-types/-types/overview.d.ts +21 -0
- package/unstable-preview-types/-types/overview.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +109 -0
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/ds-model.d.ts +25 -0
- package/unstable-preview-types/-types/q/ds-model.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/identifier.d.ts +193 -0
- package/unstable-preview-types/-types/q/identifier.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/promise-proxies.d.ts +4 -0
- package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts +36 -0
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/record-instance.d.ts +29 -0
- package/unstable-preview-types/-types/q/record-instance.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/schema-service.d.ts +366 -0
- package/unstable-preview-types/-types/q/schema-service.d.ts.map +1 -0
- package/unstable-preview-types/-types/q/store.d.ts +38 -0
- package/unstable-preview-types/-types/q/store.d.ts.map +1 -0
- package/unstable-preview-types/index.d.ts +223 -0
- package/unstable-preview-types/index.d.ts.map +1 -0
- package/unstable-preview-types/types.d.ts +7 -0
- package/unstable-preview-types/types.d.ts.map +1 -0
- package/addon/-private.js +0 -1
- package/addon/store-service-b98547c2.js.map +0 -1
- package/addon-main.js +0 -93
- /package/{addon → dist}/-private.js.map +0 -0
- /package/{addon → dist}/index.js.map +0 -0
- /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
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAA0C,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAIvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,QAUnD;AAED,KAAK,SAAS,GAAG,GAAG,CAAC,sBAAsB,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;AAE5D;;;EAGE;AACF,qBAAa,kBAAkB;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,OAAO,C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,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"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
declare module '@ember-data/store/-private/network/request-cache' {
|
|
2
|
+
import type { StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
3
|
+
import type { FindRecordOptions } from '@ember-data/store/-types/q/store';
|
|
4
|
+
import type { Store } from '@ember-data/store/-private/store-service';
|
|
5
|
+
const Touching: "___(unique) Symbol(Touching)";
|
|
6
|
+
export const RequestPromise: "___(unique) Symbol(RequestPromise)";
|
|
7
|
+
export interface Operation {
|
|
8
|
+
op: string;
|
|
9
|
+
options: FindRecordOptions | undefined;
|
|
10
|
+
recordIdentifier: StableRecordIdentifier;
|
|
11
|
+
}
|
|
12
|
+
export interface FindRecordQuery extends Operation {
|
|
13
|
+
op: 'findRecord';
|
|
14
|
+
}
|
|
15
|
+
export interface SaveRecordMutation extends Operation {
|
|
16
|
+
op: 'saveRecord';
|
|
17
|
+
}
|
|
18
|
+
export interface Request {
|
|
19
|
+
data: Operation[];
|
|
20
|
+
options?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export type RequestStates = 'pending' | 'fulfilled' | 'rejected';
|
|
23
|
+
export interface RequestState {
|
|
24
|
+
state: RequestStates;
|
|
25
|
+
type: 'query' | 'mutation';
|
|
26
|
+
request: Request;
|
|
27
|
+
response?: Response;
|
|
28
|
+
}
|
|
29
|
+
export interface Response {
|
|
30
|
+
data: unknown;
|
|
31
|
+
}
|
|
32
|
+
interface InternalRequest extends RequestState {
|
|
33
|
+
[Touching]: StableRecordIdentifier[];
|
|
34
|
+
[RequestPromise]?: Promise<unknown>;
|
|
35
|
+
}
|
|
36
|
+
export type RequestSubscription = (requestState: RequestState) => void;
|
|
37
|
+
/**
|
|
38
|
+
* The RequestStateService is used to track the state of requests
|
|
39
|
+
* for fetching or updating known resource identifies that are inflight.
|
|
40
|
+
*
|
|
41
|
+
* @class RequestStateService
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export class RequestStateService {
|
|
45
|
+
_pending: Map<StableRecordIdentifier, InternalRequest[]>;
|
|
46
|
+
_done: Map<StableRecordIdentifier, InternalRequest[]>;
|
|
47
|
+
_subscriptions: Map<StableRecordIdentifier, RequestSubscription[]>;
|
|
48
|
+
_toFlush: InternalRequest[];
|
|
49
|
+
_store: Store;
|
|
50
|
+
constructor(store: Store);
|
|
51
|
+
_clearEntries(identifier: StableRecordIdentifier): void;
|
|
52
|
+
_enqueue<T>(promise: Promise<T>, queryRequest: Request): Promise<T>;
|
|
53
|
+
_triggerSubscriptions(req: InternalRequest): void;
|
|
54
|
+
_flush(): void;
|
|
55
|
+
_flushRequest(req: InternalRequest): void;
|
|
56
|
+
_dequeue(identifier: StableRecordIdentifier, request: InternalRequest): void;
|
|
57
|
+
_addDone(request: InternalRequest): void;
|
|
58
|
+
/**
|
|
59
|
+
* Subscribe to requests for a given resource identity.
|
|
60
|
+
*
|
|
61
|
+
* The callback will receive the current state of the request.
|
|
62
|
+
*
|
|
63
|
+
* ```ts
|
|
64
|
+
* interface RequestState {
|
|
65
|
+
* state: 'pending' | 'fulfilled' | 'rejected';
|
|
66
|
+
* type: 'query' | 'mutation';
|
|
67
|
+
* request: Request;
|
|
68
|
+
* response?: { data: unknown };
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* Note: It should be considered dangerous to use this API for more than simple
|
|
73
|
+
* state derivation or debugging. The `request` and `response` properties are poorly
|
|
74
|
+
* spec'd and may change unexpectedly when shifting what Handlers are in use or how
|
|
75
|
+
* requests are issued from the Store.
|
|
76
|
+
*
|
|
77
|
+
* We expect to revisit this API in the near future as we continue to refine the
|
|
78
|
+
* RequestManager ergonomics, as a simpler but more powerful direct integration
|
|
79
|
+
* with the RequestManager for these purposes is likely to be a better long-term
|
|
80
|
+
* design.
|
|
81
|
+
*
|
|
82
|
+
* @method subscribeForRecord
|
|
83
|
+
* @public
|
|
84
|
+
* @param {StableRecordIdentifier} identifier
|
|
85
|
+
* @param {(state: RequestState) => void} callback
|
|
86
|
+
*/
|
|
87
|
+
subscribeForRecord(identifier: StableRecordIdentifier, callback: RequestSubscription): void;
|
|
88
|
+
/**
|
|
89
|
+
* Retrieve all active requests for a given resource identity.
|
|
90
|
+
*
|
|
91
|
+
* @method getPendingRequestsForRecord
|
|
92
|
+
* @public
|
|
93
|
+
* @param {StableRecordIdentifier} identifier
|
|
94
|
+
* @return {RequestState[]} an array of request states for any pending requests for the given identifier
|
|
95
|
+
*/
|
|
96
|
+
getPendingRequestsForRecord(identifier: StableRecordIdentifier): RequestState[];
|
|
97
|
+
/**
|
|
98
|
+
* Retrieve the last completed request for a given resource identity.
|
|
99
|
+
*
|
|
100
|
+
* @method getLastRequestForRecord
|
|
101
|
+
* @public
|
|
102
|
+
* @param {StableRecordIdentifier} identifier
|
|
103
|
+
* @return {RequestState | null} the state of the most recent request for the given identifier
|
|
104
|
+
*/
|
|
105
|
+
getLastRequestForRecord(identifier: StableRecordIdentifier): RequestState | null;
|
|
106
|
+
}
|
|
107
|
+
export {};
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=request-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-cache.d.ts","sourceRoot":"","sources":["../../../src/-private/network/request-cache.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,QAAA,MAAM,QAAQ,gCAAiD,CAAC;AAChE,eAAO,MAAM,cAAc,sCAAsD,CAAC;AAGlF,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACvC,gBAAgB,EAAE,sBAAsB,CAAC;CAC1C;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,EAAE,EAAE,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,EAAE,EAAE,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IAEvB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,UAAU,eAAgB,SAAQ,YAAY;IA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 +1,150 @@
|
|
|
1
|
+
declare module '@ember-data/store/-private/record-arrays/identifier-array' {
|
|
2
|
+
import type { Signal } from '@ember-data/tracking/-private';
|
|
3
|
+
import type { LocalRelationshipOperation } from '@warp-drive/core-types/graph';
|
|
4
|
+
import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
5
|
+
import type { TypeFromInstanceOrString } from '@warp-drive/core-types/record';
|
|
6
|
+
import type { ImmutableRequestInfo } from '@warp-drive/core-types/request';
|
|
7
|
+
import type { Links, PaginationLinks } from '@warp-drive/core-types/spec/json-api-raw';
|
|
8
|
+
import type { BaseFinderOptions } from '@ember-data/store/types';
|
|
9
|
+
import type { RecordArrayManager } from '@ember-data/store/-private/managers/record-array-manager';
|
|
10
|
+
import type { Store } from '@ember-data/store/-private/store-service';
|
|
11
|
+
import { NativeProxy } from '@ember-data/store/-private/record-arrays/native-proxy-type-fix';
|
|
12
|
+
export const ARRAY_SIGNAL: "___(unique) Symbol(#signal)";
|
|
13
|
+
export const SOURCE: "___(unique) Symbol(#source)";
|
|
14
|
+
export const MUTATE: "___(unique) Symbol(#update)";
|
|
15
|
+
export const NOTIFY: "___(unique) Symbol(#notify)";
|
|
16
|
+
const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
|
|
17
|
+
export function notifyArray(arr: IdentifierArray): void;
|
|
18
|
+
export type IdentifierArrayCreateOptions<T = unknown> = {
|
|
19
|
+
identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];
|
|
20
|
+
type?: TypeFromInstanceOrString<T>;
|
|
21
|
+
store: Store;
|
|
22
|
+
allowMutation: boolean;
|
|
23
|
+
manager: MinimumManager;
|
|
24
|
+
links?: Links | PaginationLinks | null;
|
|
25
|
+
meta?: Record<string, unknown> | null;
|
|
26
|
+
identifier?: StableDocumentIdentifier | null;
|
|
27
|
+
};
|
|
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 = {
|
|
35
|
+
_syncArray: (array: IdentifierArray) => void;
|
|
36
|
+
mutate?(mutation: LocalRelationshipOperation): void;
|
|
37
|
+
reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<IdentifierArray<T>> | PromiseManyArray<T>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
A record array is an array that contains records of a certain type (or modelName).
|
|
41
|
+
The record array materializes records as needed when they are retrieved for the first
|
|
42
|
+
time. You should not create record arrays yourself. Instead, an instance of
|
|
43
|
+
`RecordArray` or its subclasses will be returned by your application's store
|
|
44
|
+
in response to queries.
|
|
45
|
+
|
|
46
|
+
This class should not be imported and instantiated by consuming applications.
|
|
47
|
+
|
|
48
|
+
@class RecordArray
|
|
49
|
+
@public
|
|
50
|
+
*/
|
|
51
|
+
export interface IdentifierArray<T = unknown> extends Omit<Array<T>, '[]'> {
|
|
52
|
+
[MUTATE]?(target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>, prop: string, args: unknown[], _SIGNAL: Signal): unknown;
|
|
53
|
+
}
|
|
54
|
+
export class IdentifierArray<T = unknown> {
|
|
55
|
+
DEPRECATED_CLASS_NAME: string;
|
|
56
|
+
/**
|
|
57
|
+
The flag to signal a `RecordArray` is currently loading data.
|
|
58
|
+
Example
|
|
59
|
+
```javascript
|
|
60
|
+
let people = store.peekAll('person');
|
|
61
|
+
people.isUpdating; // false
|
|
62
|
+
people.update();
|
|
63
|
+
people.isUpdating; // true
|
|
64
|
+
```
|
|
65
|
+
@property isUpdating
|
|
66
|
+
@public
|
|
67
|
+
@type Boolean
|
|
68
|
+
*/
|
|
69
|
+
isUpdating: boolean;
|
|
70
|
+
isLoaded: boolean;
|
|
71
|
+
isDestroying: boolean;
|
|
72
|
+
isDestroyed: boolean;
|
|
73
|
+
_updatingPromise: Promise<IdentifierArray<T>> | null;
|
|
74
|
+
readonly identifier: StableDocumentIdentifier | null;
|
|
75
|
+
[IS_COLLECTION]: boolean;
|
|
76
|
+
[ARRAY_SIGNAL]: Signal;
|
|
77
|
+
[SOURCE]: StableRecordIdentifier[];
|
|
78
|
+
[NOTIFY](): void;
|
|
79
|
+
links: Links | PaginationLinks | null;
|
|
80
|
+
meta: Record<string, unknown> | null;
|
|
81
|
+
modelName?: TypeFromInstanceOrString<T>;
|
|
82
|
+
/**
|
|
83
|
+
The store that created this record array.
|
|
84
|
+
|
|
85
|
+
@property store
|
|
86
|
+
@private
|
|
87
|
+
@type Store
|
|
88
|
+
*/
|
|
89
|
+
store: Store;
|
|
90
|
+
_manager: MinimumManager;
|
|
91
|
+
destroy(clear: boolean): void;
|
|
92
|
+
get length(): number;
|
|
93
|
+
set length(value: number);
|
|
94
|
+
constructor(options: IdentifierArrayCreateOptions<T>);
|
|
95
|
+
/**
|
|
96
|
+
Used to get the latest version of all of the records in this array
|
|
97
|
+
from the adapter.
|
|
98
|
+
|
|
99
|
+
Example
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
let people = store.peekAll('person');
|
|
103
|
+
people.isUpdating; // false
|
|
104
|
+
|
|
105
|
+
people.update().then(function() {
|
|
106
|
+
people.isUpdating; // false
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
people.isUpdating; // true
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
@method update
|
|
113
|
+
@public
|
|
114
|
+
*/
|
|
115
|
+
update(): Promise<IdentifierArray<T>>;
|
|
116
|
+
_update(): Promise<IdentifierArray<T>>;
|
|
117
|
+
/**
|
|
118
|
+
Saves all of the records in the `RecordArray`.
|
|
119
|
+
|
|
120
|
+
Example
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
let messages = store.peekAll('message');
|
|
124
|
+
messages.forEach(function(message) {
|
|
125
|
+
message.hasBeenSeen = true;
|
|
126
|
+
});
|
|
127
|
+
messages.save();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
@method save
|
|
131
|
+
@public
|
|
132
|
+
@return {Promise<IdentifierArray>} promise
|
|
133
|
+
*/
|
|
134
|
+
save(): Promise<IdentifierArray>;
|
|
135
|
+
}
|
|
136
|
+
export type CollectionCreateOptions = IdentifierArrayCreateOptions & {
|
|
137
|
+
manager: RecordArrayManager;
|
|
138
|
+
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
139
|
+
isLoaded: boolean;
|
|
140
|
+
};
|
|
141
|
+
export class Collection<T = unknown> extends IdentifierArray<T> {
|
|
142
|
+
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
143
|
+
_manager: RecordArrayManager;
|
|
144
|
+
constructor(options: CollectionCreateOptions);
|
|
145
|
+
_update(): Promise<Collection<T>>;
|
|
146
|
+
destroy(clear: boolean): void;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=identifier-array.d.ts.map
|
|
@@ -0,0 +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;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,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 +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":["../../../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;;;;;;;;;;;MAoBE;IAEF;;;;;;;MAOE;IACF,YAAY,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC;IAShD,OAAO;CAGR"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
declare module '@ember-data/store/-private/record-arrays/native-proxy-type-fix' {
|
|
2
|
+
interface ProxyHandler<T extends object> {
|
|
3
|
+
/**
|
|
4
|
+
* A trap method for a function call.
|
|
5
|
+
* @param target The original callable object which is being proxied.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
apply?(target: T, thisArg: any, argArray: any[]): any;
|
|
9
|
+
/**
|
|
10
|
+
* A trap for the `new` operator.
|
|
11
|
+
* @param target The original object which is being proxied.
|
|
12
|
+
* @param newTarget The constructor that was originally called.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
construct?(target: T, argArray: any[], newTarget: Function): object;
|
|
16
|
+
/**
|
|
17
|
+
* A trap for `Object.defineProperty()`.
|
|
18
|
+
* @param target The original object which is being proxied.
|
|
19
|
+
* @return A `Boolean` indicating whether or not the property has been defined.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
defineProperty?(target: T, property: string | symbol, attributes: PropertyDescriptor): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A trap for the `delete` operator.
|
|
25
|
+
* @param target The original object which is being proxied.
|
|
26
|
+
* @param p The name or `Symbol` of the property to delete.
|
|
27
|
+
* @return A `Boolean` indicating whether or not the property was deleted.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
deleteProperty?(target: T, p: string | symbol): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* A trap for getting a property value.
|
|
33
|
+
* @param target The original object which is being proxied.
|
|
34
|
+
* @param p The name or `Symbol` of the property to get.
|
|
35
|
+
* @param receiver The proxy or an object that inherits from the proxy.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
get?(target: T, p: string | symbol, receiver: any): any;
|
|
39
|
+
/**
|
|
40
|
+
* A trap for `Object.getOwnPropertyDescriptor()`.
|
|
41
|
+
* @param target The original object which is being proxied.
|
|
42
|
+
* @param p The name of the property whose description should be retrieved.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
getOwnPropertyDescriptor?(target: T, p: string | symbol): PropertyDescriptor | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* A trap for the `[[GetPrototypeOf]]` internal method.
|
|
48
|
+
* @param target The original object which is being proxied.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
getPrototypeOf?(target: T): object | null;
|
|
52
|
+
/**
|
|
53
|
+
* A trap for the `in` operator.
|
|
54
|
+
* @param target The original object which is being proxied.
|
|
55
|
+
* @param p The name or `Symbol` of the property to check for existence.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
has?(target: T, p: string | symbol): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* A trap for `Object.isExtensible()`.
|
|
61
|
+
* @param target The original object which is being proxied.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
isExtensible?(target: T): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* A trap for `Reflect.ownKeys()`.
|
|
67
|
+
* @param target The original object which is being proxied.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
ownKeys?(target: T): ArrayLike<string | symbol>;
|
|
71
|
+
/**
|
|
72
|
+
* A trap for `Object.preventExtensions()`.
|
|
73
|
+
* @param target The original object which is being proxied.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
preventExtensions?(target: T): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* A trap for setting a property value.
|
|
79
|
+
* @param target The original object which is being proxied.
|
|
80
|
+
* @param p The name or `Symbol` of the property to set.
|
|
81
|
+
* @param receiver The object to which the assignment was originally directed.
|
|
82
|
+
* @return A `Boolean` indicating whether or not the property was set.
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* A trap for `Object.setPrototypeOf()`.
|
|
88
|
+
* @param target The original object which is being proxied.
|
|
89
|
+
* @param newPrototype The object's new prototype or `null`.
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
setPrototypeOf?(target: T, v: object | null): boolean;
|
|
93
|
+
}
|
|
94
|
+
interface ProxyConstructor {
|
|
95
|
+
/**
|
|
96
|
+
* Creates a revocable Proxy object.
|
|
97
|
+
* @param target A target object to wrap with Proxy.
|
|
98
|
+
* @param handler An object whose properties define the behavior of Proxy when an operation is attempted on it.
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
revocable<T extends object>(target: T, handler: ProxyHandler<T>): {
|
|
102
|
+
proxy: T;
|
|
103
|
+
revoke: () => void;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the
|
|
107
|
+
* original object, but which may redefine fundamental Object operations like getting, setting, and defining
|
|
108
|
+
* properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.
|
|
109
|
+
* @param target A target object to wrap with Proxy.
|
|
110
|
+
* @param handler An object whose properties define the behavior of Proxy when an operation is attempted on it.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
new <TSource extends object, TTarget extends object>(target: TSource, handler: ProxyHandler<TSource>): TTarget;
|
|
114
|
+
}
|
|
115
|
+
export const NativeProxy: ProxyConstructor;
|
|
116
|
+
export {};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=native-proxy-type-fix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-proxy-type-fix.d.ts","sourceRoot":"","sources":["../../../src/-private/record-arrays/native-proxy-type-fix.ts"],"names":[],"mappings":"AAOA,UAAU,YAAY,CAAC,CAAC,SAAS,MAAM;IACrC;;;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