@ember-data-types/store 5.6.0-alpha.1 → 5.6.0-alpha.12
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/README.md +5 -5
- package/package.json +1 -1
- package/unstable-preview-types/-private.d.ts +1 -30
- package/unstable-preview-types/-private.d.ts.map +1 -1
- package/unstable-preview-types/configure.d.ts +2 -6
- package/unstable-preview-types/configure.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +2 -224
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/unstable-preview-types/types.d.ts +1 -4
- package/unstable-preview-types/types.d.ts.map +1 -1
- package/unstable-preview-types/-private/cache-handler/handler.d.ts +0 -62
- package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +0 -1
- package/unstable-preview-types/-private/cache-handler/types.d.ts +0 -107
- package/unstable-preview-types/-private/cache-handler/types.d.ts.map +0 -1
- package/unstable-preview-types/-private/cache-handler/utils.d.ts +0 -34
- package/unstable-preview-types/-private/cache-handler/utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/cache-utils.d.ts +0 -11
- package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts +0 -180
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/instance-cache.d.ts +0 -64
- package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +0 -1
- package/unstable-preview-types/-private/caches/resource-utils.d.ts +0 -12
- package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/debug/utils.d.ts +0 -9
- package/unstable-preview-types/-private/debug/utils.d.ts.map +0 -1
- package/unstable-preview-types/-private/document.d.ts +0 -155
- package/unstable-preview-types/-private/document.d.ts.map +0 -1
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +0 -179
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +0 -1
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +0 -19
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +0 -31
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +0 -463
- package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/notification-manager.d.ts +0 -101
- package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts +0 -101
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +0 -1
- package/unstable-preview-types/-private/network/request-cache.d.ts +0 -109
- package/unstable-preview-types/-private/network/request-cache.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts +0 -289
- package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts +0 -92
- package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts +0 -172
- package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts +0 -32
- package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
- package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts +0 -276
- package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts.map +0 -1
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +0 -145
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +0 -1
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts +0 -203
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +0 -1
- package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +0 -118
- package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
- package/unstable-preview-types/-private/store-service.d.ts +0 -1601
- package/unstable-preview-types/-private/store-service.d.ts.map +0 -1
- package/unstable-preview-types/-private/store-service.type-test.d.ts +0 -4
- package/unstable-preview-types/-private/store-service.type-test.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/coerce-id.d.ts +0 -10
- package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/construct-resource.d.ts +0 -9
- package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +0 -4
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +0 -4
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +0 -4
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +0 -1
- package/unstable-preview-types/-types/overview.d.ts +0 -21
- package/unstable-preview-types/-types/overview.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +0 -110
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/ds-model.d.ts +0 -25
- package/unstable-preview-types/-types/q/ds-model.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/identifier.d.ts +0 -193
- package/unstable-preview-types/-types/q/identifier.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/promise-proxies.d.ts +0 -4
- package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts +0 -36
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/record-instance.d.ts +0 -29
- package/unstable-preview-types/-types/q/record-instance.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/schema-service.d.ts +0 -354
- package/unstable-preview-types/-types/q/schema-service.d.ts.map +0 -1
- package/unstable-preview-types/-types/q/store.d.ts +0 -38
- package/unstable-preview-types/-types/q/store.d.ts.map +0 -1
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
declare module '@ember-data/store/-private/new-core-tmp/reactivity/internal' {
|
|
2
|
-
import { ARRAY_SIGNAL, OBJECT_SIGNAL, type SignalRef } from '@ember-data/store/-private/new-core-tmp/reactivity/configure';
|
|
3
|
-
export type { SignalRef };
|
|
4
|
-
export { ARRAY_SIGNAL, OBJECT_SIGNAL };
|
|
5
|
-
/**
|
|
6
|
-
* A WarpDriveSignal is a wrapper around a framework specific or TC39 signal
|
|
7
|
-
* that enables us to store and manage the signal in a universal way.
|
|
8
|
-
*
|
|
9
|
-
* WarpDrive uses signals to manage three separate concepts:
|
|
10
|
-
*
|
|
11
|
-
* - as a `storage` for a value local to the object that we want to be reactive
|
|
12
|
-
* (see `@local` schema field for an example)
|
|
13
|
-
* - as a `gate` for a memoized getter that we want to act as a reactive property
|
|
14
|
-
* but whose value is computed/pulled from a non-reactive source elsewhere
|
|
15
|
-
* and whose latest value is stored in the signal
|
|
16
|
-
* (see `field` schema field for an example)
|
|
17
|
-
* - as a `gate` with a manually managed value updated on pull when `isStale` is true
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* It offers
|
|
21
|
-
*
|
|
22
|
-
* - a non-reactive way to access/update the current value
|
|
23
|
-
* - a non-reactive way to mark the signal as dirtied
|
|
24
|
-
* - a non-reactive way to store content for why the signal was dirtied
|
|
25
|
-
* - access to the underlying Signal(s) in-use
|
|
26
|
-
*
|
|
27
|
-
* For debugging:
|
|
28
|
-
* - the "key" or "name" of the signal
|
|
29
|
-
* - the "object identity" or "context" to which the signal is attached
|
|
30
|
-
*
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
export interface WarpDriveSignal {
|
|
34
|
-
/**
|
|
35
|
-
* The "key" or "name" of the signal.
|
|
36
|
-
* This is usually (but not always) the name of a property
|
|
37
|
-
* on the object to which the signal is attached.
|
|
38
|
-
*
|
|
39
|
-
* This is used for debugging purposes.
|
|
40
|
-
* It is not used for any other purpose.
|
|
41
|
-
*
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
key: string | symbol;
|
|
45
|
-
/**
|
|
46
|
-
* The "object identity" or "context" to which the
|
|
47
|
-
* signal is attached.
|
|
48
|
-
*
|
|
49
|
-
* This is used for debugging purposes.
|
|
50
|
-
* It is not used for any other purpose.
|
|
51
|
-
*
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
context: object;
|
|
55
|
-
/**
|
|
56
|
-
* The underlying signal(s) in-use.
|
|
57
|
-
*
|
|
58
|
-
* Generally, this is a single signal.
|
|
59
|
-
*
|
|
60
|
-
* In some cases multiple signals need to be condensed,
|
|
61
|
-
* such as to support legacy Ember Array APIs or to
|
|
62
|
-
* support reactive-objects shared between the code of
|
|
63
|
-
* multiple frameworks.
|
|
64
|
-
*
|
|
65
|
-
* In such cases, this value may be an array.
|
|
66
|
-
*
|
|
67
|
-
* e.g. (pseudo-code for Ember):
|
|
68
|
-
*
|
|
69
|
-
* setupSignals({
|
|
70
|
-
* createSignal: (obj, key, initialValue) => {
|
|
71
|
-
* if (isArraySignal(key)) {
|
|
72
|
-
* return [
|
|
73
|
-
* tagForProperty(obj, key),
|
|
74
|
-
* tagForProperty(obj, '[]'),
|
|
75
|
-
* tagForProperty(obj, 'length'),
|
|
76
|
-
* ];
|
|
77
|
-
* }
|
|
78
|
-
* return tagForProperty(obj, key);
|
|
79
|
-
* },
|
|
80
|
-
*
|
|
81
|
-
* consumeSignal: (signal) => {
|
|
82
|
-
* if (Array.isArray(signal)) {
|
|
83
|
-
* signal.forEach((s) => consumeTag(s));
|
|
84
|
-
* } else {
|
|
85
|
-
* consumeTag(signal);
|
|
86
|
-
* }
|
|
87
|
-
* },
|
|
88
|
-
*
|
|
89
|
-
* dirtySignal: (signal) => {
|
|
90
|
-
* if (Array.isArray(signal)) {
|
|
91
|
-
* signal.forEach((s) => dirtyTag(s));
|
|
92
|
-
* } else {
|
|
93
|
-
* dirtyTag(signal);
|
|
94
|
-
* }
|
|
95
|
-
* },
|
|
96
|
-
* });
|
|
97
|
-
*
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
signal: SignalRef;
|
|
101
|
-
/**
|
|
102
|
-
* The last "value" computed for this signal when
|
|
103
|
-
* a signal is also used for storage.
|
|
104
|
-
*
|
|
105
|
-
* @internal
|
|
106
|
-
*/
|
|
107
|
-
value: unknown;
|
|
108
|
-
/**
|
|
109
|
-
* Whether ths signal is known to have been dirtied.
|
|
110
|
-
* This is useful *both* when manually managing the
|
|
111
|
-
* `value` cache and when using the signal as a
|
|
112
|
-
* "gate"
|
|
113
|
-
*
|
|
114
|
-
* @internal
|
|
115
|
-
*/
|
|
116
|
-
isStale: boolean;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* We attach signals to their context object via
|
|
120
|
-
* a Map attached to the object via this symbol.
|
|
121
|
-
*
|
|
122
|
-
* This allows us to store multiple signals
|
|
123
|
-
* on the same object with smaller memory
|
|
124
|
-
* overhead and no WeakMap lookups.
|
|
125
|
-
*
|
|
126
|
-
* Performance sensitive objects should
|
|
127
|
-
* pre-warm their shape by assigning this
|
|
128
|
-
* during initialization.
|
|
129
|
-
*
|
|
130
|
-
* ```ts
|
|
131
|
-
* initializeSignalStore(obj);
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* @internal
|
|
135
|
-
*/
|
|
136
|
-
export const Signals: "___(unique) Symbol(Signals)";
|
|
137
|
-
export type SignalStore = Map<string | symbol, WarpDriveSignal>;
|
|
138
|
-
/**
|
|
139
|
-
* A type util to recast the object as having a signal store.
|
|
140
|
-
*
|
|
141
|
-
* @internal
|
|
142
|
-
*/
|
|
143
|
-
export function upgradeWithSignals<T extends object>(obj: T): asserts obj is T & {
|
|
144
|
-
[Signals]: SignalStore;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* A util that will create a signal store on the object
|
|
148
|
-
* if it does not already exist and returns the associated
|
|
149
|
-
* signal store.
|
|
150
|
-
*
|
|
151
|
-
* @internal
|
|
152
|
-
*/
|
|
153
|
-
export function withSignalStore<T extends object>(obj: T): SignalStore;
|
|
154
|
-
/**
|
|
155
|
-
* A util that will create a signal store on the object
|
|
156
|
-
* if it does not already exist.
|
|
157
|
-
*
|
|
158
|
-
* Useful for pre-warming the shape of an object to ensure
|
|
159
|
-
* a key-transition to add it is not required later.
|
|
160
|
-
*
|
|
161
|
-
* @internal
|
|
162
|
-
*/
|
|
163
|
-
export function initializeSignalStore<T extends object>(obj: T): asserts obj is T & {
|
|
164
|
-
[Signals]: SignalStore;
|
|
165
|
-
};
|
|
166
|
-
export function createInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
|
|
167
|
-
export function getOrCreateInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
|
|
168
|
-
export function peekInternalSignal(signals: SignalStore | undefined, key: string | symbol): WarpDriveSignal | undefined;
|
|
169
|
-
export function consumeInternalSignal(signal: WarpDriveSignal): void;
|
|
170
|
-
export function notifyInternalSignal(signal: WarpDriveSignal | undefined): void;
|
|
171
|
-
}
|
|
172
|
-
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/-private/new-core-tmp/reactivity/internal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAA6C,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAErH,YAAY,EAAE,SAAS,EAAE,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;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e,CAMjB;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,GAAG,EAAE,MAAM,GAAG,MAAM,GACnB,eAAe,GAAG,SAAS,CAE7B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,QAE5D;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,QAKvE"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
declare module '@ember-data/store/-private/new-core-tmp/reactivity/signal' {
|
|
2
|
-
import type { SignalStore, WarpDriveSignal } from '@ember-data/store/-private/new-core-tmp/reactivity/internal';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a signal for the key/object pairing and subscribes to the signal.
|
|
5
|
-
*
|
|
6
|
-
* Use when you need to ensure a signal exists and is subscribed to.
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export function entangleSignal<T extends object>(signals: SignalStore, obj: T, key: string | symbol, initialValue: unknown): WarpDriveSignal;
|
|
11
|
-
/**
|
|
12
|
-
* define an enumerable signal property.
|
|
13
|
-
*
|
|
14
|
-
* Akin to Object.defineProperty.
|
|
15
|
-
*
|
|
16
|
-
* The signal will be lazily created when accessed and scoped to the
|
|
17
|
-
* instance of the object.
|
|
18
|
-
*
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export function defineSignal<T extends object>(obj: T, key: string, v?: unknown): void;
|
|
22
|
-
/**
|
|
23
|
-
* Define a non-enumerable signal property.
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export function defineNonEnumerableSignal<T extends object>(obj: T, key: string, v?: unknown): void;
|
|
28
|
-
export function memoized<T extends object, K extends keyof T & string>(target: T, key: K, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
29
|
-
export function gate<T extends object, K extends keyof T & string>(_target: T, key: K, desc: PropertyDescriptor): PropertyDescriptor;
|
|
30
|
-
export function defineGate<T extends object>(obj: T, key: string, desc: PropertyDescriptor): void;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=signal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../../src/-private/new-core-tmp/reactivity/signal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAW,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAUxE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,YAAY,EAAE,OAAO,GACpB,eAAe,CAQjB;AAsBD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,QAE9E;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,QAI3F;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EACnE,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,CAAC,EACN,UAAU,EAAE,kBAAkB,sBAoC/B;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,sBAqC9G;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,QAGzF"}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
declare module '@ember-data/store/-private/new-core-tmp/request-state' {
|
|
2
|
-
import type { Future, ImmutableRequestInfo, ResponseInfo, StructuredErrorDocument } from '@ember-data/request';
|
|
3
|
-
import type { PendingPromise, RejectedPromise, ResolvedPromise } from '@ember-data/store/-private/new-core-tmp/promise-state';
|
|
4
|
-
/**
|
|
5
|
-
* Lazily consumes the stream of a request, providing a number of
|
|
6
|
-
* reactive properties that can be used to build UIs that respond
|
|
7
|
-
* to the progress of a request.
|
|
8
|
-
*
|
|
9
|
-
* @typedoc
|
|
10
|
-
*/
|
|
11
|
-
export class RequestLoadingState {
|
|
12
|
-
_sizeHint: number;
|
|
13
|
-
_bytesLoaded: number;
|
|
14
|
-
_startTime: number;
|
|
15
|
-
_endTime: number;
|
|
16
|
-
_lastPacketTime: number;
|
|
17
|
-
_isPending: boolean;
|
|
18
|
-
_isStarted: boolean;
|
|
19
|
-
_isComplete: boolean;
|
|
20
|
-
_isCancelled: boolean;
|
|
21
|
-
_isErrored: boolean;
|
|
22
|
-
_error: Error | null;
|
|
23
|
-
_stream: TransformStream | null;
|
|
24
|
-
_future: Future<unknown>;
|
|
25
|
-
_triggered: boolean;
|
|
26
|
-
_trigger(): void;
|
|
27
|
-
promise: Promise<void> | null;
|
|
28
|
-
get isPending(): boolean;
|
|
29
|
-
get sizeHint(): number;
|
|
30
|
-
get stream(): ReadableStream | null;
|
|
31
|
-
get isStarted(): boolean;
|
|
32
|
-
get bytesLoaded(): number;
|
|
33
|
-
get startTime(): number;
|
|
34
|
-
get endTime(): number;
|
|
35
|
-
get lastPacketTime(): number;
|
|
36
|
-
get isComplete(): boolean;
|
|
37
|
-
get isCancelled(): boolean;
|
|
38
|
-
get isErrored(): boolean;
|
|
39
|
-
get error(): Error | null;
|
|
40
|
-
get elapsedTime(): number;
|
|
41
|
-
get completedRatio(): number;
|
|
42
|
-
get remainingRatio(): number;
|
|
43
|
-
get duration(): number;
|
|
44
|
-
get speed(): number;
|
|
45
|
-
constructor(future: Future<unknown>);
|
|
46
|
-
abort: () => void;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* The state of a request in the "pending"
|
|
50
|
-
* state. This is the default initial state.
|
|
51
|
-
*
|
|
52
|
-
* Extends the {@link PendingPromise} interface.
|
|
53
|
-
*
|
|
54
|
-
* @typedoc
|
|
55
|
-
*/
|
|
56
|
-
export interface PendingRequest extends PendingPromise {
|
|
57
|
-
/**
|
|
58
|
-
* Whether the request is cancelled.
|
|
59
|
-
*
|
|
60
|
-
* @typedoc
|
|
61
|
-
*/
|
|
62
|
-
isCancelled: false;
|
|
63
|
-
loadingState: RequestLoadingState;
|
|
64
|
-
request: null;
|
|
65
|
-
response: null;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* The state of a request in the "fulfilled" state.
|
|
69
|
-
* This is the state of a request that has resolved
|
|
70
|
-
* successfully.
|
|
71
|
-
*
|
|
72
|
-
* Extends the {@link ResolvedPromise} interface.
|
|
73
|
-
*
|
|
74
|
-
* @typedoc
|
|
75
|
-
*/
|
|
76
|
-
export interface ResolvedRequest<T, RT> extends ResolvedPromise<RT> {
|
|
77
|
-
/**
|
|
78
|
-
* Whether the request is cancelled.
|
|
79
|
-
*
|
|
80
|
-
* @typedoc
|
|
81
|
-
*/
|
|
82
|
-
isCancelled: false;
|
|
83
|
-
loadingState: RequestLoadingState;
|
|
84
|
-
request: ImmutableRequestInfo<T, RT> | null;
|
|
85
|
-
response: Response | ResponseInfo | null;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* The state of a request in the "rejected" state.
|
|
89
|
-
* This is the state of a request that has rejected
|
|
90
|
-
* with an error.
|
|
91
|
-
*
|
|
92
|
-
* Extends the {@link RejectedPromise} interface.
|
|
93
|
-
*
|
|
94
|
-
* @typedoc
|
|
95
|
-
*/
|
|
96
|
-
export interface RejectedRequest<T, RT, E extends StructuredErrorDocument = StructuredErrorDocument> extends RejectedPromise<E> {
|
|
97
|
-
/**
|
|
98
|
-
* Whether the request is cancelled.
|
|
99
|
-
*
|
|
100
|
-
* @typedoc
|
|
101
|
-
*/
|
|
102
|
-
isCancelled: false;
|
|
103
|
-
loadingState: RequestLoadingState;
|
|
104
|
-
request: ImmutableRequestInfo<T, RT> | null;
|
|
105
|
-
response: Response | ResponseInfo | null;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* The state of a request in the "cancelled" state.
|
|
109
|
-
* This is the state of a promise that has been
|
|
110
|
-
* cancelled.
|
|
111
|
-
*
|
|
112
|
-
* @typedoc
|
|
113
|
-
*/
|
|
114
|
-
export interface CancelledRequest<T, RT, E extends StructuredErrorDocument = StructuredErrorDocument> {
|
|
115
|
-
/**
|
|
116
|
-
* The status of the request.
|
|
117
|
-
*
|
|
118
|
-
* @typedoc
|
|
119
|
-
*/
|
|
120
|
-
status: 'cancelled';
|
|
121
|
-
/**
|
|
122
|
-
* Whether the request is pending.
|
|
123
|
-
*
|
|
124
|
-
* @typedoc
|
|
125
|
-
*/
|
|
126
|
-
isPending: false;
|
|
127
|
-
/**
|
|
128
|
-
* Whether the request is pending.
|
|
129
|
-
*
|
|
130
|
-
* @typedoc
|
|
131
|
-
*/
|
|
132
|
-
isLoading: false;
|
|
133
|
-
/**
|
|
134
|
-
* Whether the request has resolved
|
|
135
|
-
* successfully.
|
|
136
|
-
*
|
|
137
|
-
* @typedoc
|
|
138
|
-
*/
|
|
139
|
-
isSuccess: false;
|
|
140
|
-
/**
|
|
141
|
-
* Whether the request has rejected
|
|
142
|
-
* with an error.
|
|
143
|
-
*
|
|
144
|
-
* @typedoc
|
|
145
|
-
*/
|
|
146
|
-
isError: true;
|
|
147
|
-
/**
|
|
148
|
-
* Once the request has resolved, this will
|
|
149
|
-
* be the value the request resolved to.
|
|
150
|
-
*
|
|
151
|
-
* @typedoc
|
|
152
|
-
*/
|
|
153
|
-
value: null;
|
|
154
|
-
/**
|
|
155
|
-
* Once the request has resolved, this will
|
|
156
|
-
* be the value the request resolved to.
|
|
157
|
-
*
|
|
158
|
-
* @deprecated use `value` instead
|
|
159
|
-
* @typedoc
|
|
160
|
-
*/
|
|
161
|
-
result: null;
|
|
162
|
-
/**
|
|
163
|
-
* Once the request has rejected, this will
|
|
164
|
-
* be the error the request rejected with.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* @deprecated use `reason` instead
|
|
168
|
-
* @typedoc
|
|
169
|
-
*/
|
|
170
|
-
error: E;
|
|
171
|
-
/**
|
|
172
|
-
* Once the request has rejected, this will
|
|
173
|
-
* be the error the request rejected with.
|
|
174
|
-
*
|
|
175
|
-
* @typedoc
|
|
176
|
-
*/
|
|
177
|
-
reason: E;
|
|
178
|
-
/**
|
|
179
|
-
* Whether the request is cancelled.
|
|
180
|
-
*
|
|
181
|
-
* @typedoc
|
|
182
|
-
*/
|
|
183
|
-
isCancelled: true;
|
|
184
|
-
loadingState: RequestLoadingState;
|
|
185
|
-
request: ImmutableRequestInfo<T, RT> | null;
|
|
186
|
-
response: Response | ResponseInfo | null;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* RequestState extends the concept of PromiseState to provide a reactive
|
|
190
|
-
* wrapper for a request `Future` which allows you write declarative code
|
|
191
|
-
* around a Future's control flow.
|
|
192
|
-
*
|
|
193
|
-
* It is useful in both Template and JavaScript contexts, allowing you
|
|
194
|
-
* to quickly derive behaviors and data from pending, error and success
|
|
195
|
-
* states.
|
|
196
|
-
*
|
|
197
|
-
* The key difference between a Promise and a Future is that Futures provide
|
|
198
|
-
* access to a stream of their content, the identity of the request (if any)
|
|
199
|
-
* as well as the ability to attempt to abort the request.
|
|
200
|
-
*
|
|
201
|
-
* ```ts
|
|
202
|
-
* interface Future<T> extends Promise<T>> {
|
|
203
|
-
* getStream(): Promise<ReadableStream>;
|
|
204
|
-
* abort(): void;
|
|
205
|
-
* lid: StableDocumentIdentifier | null;
|
|
206
|
-
* }
|
|
207
|
-
* ```
|
|
208
|
-
*
|
|
209
|
-
* These additional APIs allow us to craft even richer state experiences.
|
|
210
|
-
*
|
|
211
|
-
* To get the state of a request, use `getRequestState`.
|
|
212
|
-
*
|
|
213
|
-
* See also:
|
|
214
|
-
* - {@link PendingRequest}
|
|
215
|
-
* - {@link ResolvedRequest}
|
|
216
|
-
* - {@link RejectedRequest}
|
|
217
|
-
* - {@link CancelledRequest}
|
|
218
|
-
*
|
|
219
|
-
* @typedoc
|
|
220
|
-
*/
|
|
221
|
-
export type RequestCacheRequestState<T = unknown, RT = unknown, E extends StructuredErrorDocument = StructuredErrorDocument> = PendingRequest | ResolvedRequest<T, RT> | RejectedRequest<T, RT, E> | CancelledRequest<T, RT, E>;
|
|
222
|
-
export function createRequestState<T, RT, E>(future: Future<RT>): Readonly<RequestCacheRequestState<T, RT, StructuredErrorDocument<E>>>;
|
|
223
|
-
/**
|
|
224
|
-
* `getRequestState` can be used in both JavaScript and Template contexts.
|
|
225
|
-
*
|
|
226
|
-
* ```ts
|
|
227
|
-
* import { getRequestState } from '@warp-drive/ember';
|
|
228
|
-
*
|
|
229
|
-
* const state = getRequestState(future);
|
|
230
|
-
* ```
|
|
231
|
-
*
|
|
232
|
-
* For instance, we could write a getter on a component that updates whenever
|
|
233
|
-
* the request state advances or the future changes, by combining the function
|
|
234
|
-
* with the use of `@cached`
|
|
235
|
-
*
|
|
236
|
-
* ```ts
|
|
237
|
-
* class Component {
|
|
238
|
-
* @cached
|
|
239
|
-
* get title() {
|
|
240
|
-
* const state = getRequestState(this.args.request);
|
|
241
|
-
* if (state.isPending) {
|
|
242
|
-
* return 'loading...';
|
|
243
|
-
* }
|
|
244
|
-
* if (state.isError) { return null; }
|
|
245
|
-
* return state.result.title;
|
|
246
|
-
* }
|
|
247
|
-
* }
|
|
248
|
-
* ```
|
|
249
|
-
*
|
|
250
|
-
* Or in a template as a helper:
|
|
251
|
-
*
|
|
252
|
-
* ```gjs
|
|
253
|
-
* import { getRequestState } from '@warp-drive/ember';
|
|
254
|
-
*
|
|
255
|
-
* <template>
|
|
256
|
-
* {{#let (getRequestState @request) as |state|}}
|
|
257
|
-
* {{#if state.isPending}}
|
|
258
|
-
* <Spinner />
|
|
259
|
-
* {{else if state.isError}}
|
|
260
|
-
* <ErrorForm @error={{state.error}} />
|
|
261
|
-
* {{else}}
|
|
262
|
-
* <h1>{{state.result.title}}</h1>
|
|
263
|
-
* {{/if}}
|
|
264
|
-
* {{/let}}
|
|
265
|
-
* </template>
|
|
266
|
-
* ```
|
|
267
|
-
*
|
|
268
|
-
* If looking to use in a template, consider also the `<Request />` component
|
|
269
|
-
* which offers a numbe of additional capabilities for requests *beyond* what
|
|
270
|
-
* `RequestState` provides.
|
|
271
|
-
*
|
|
272
|
-
* @typedoc
|
|
273
|
-
*/
|
|
274
|
-
export function getRequestState<RT, T, E>(future: Future<RT>): Readonly<RequestCacheRequestState<T, RT, StructuredErrorDocument<E>>>;
|
|
275
|
-
}
|
|
276
|
-
//# sourceMappingURL=request-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-state.d.ts","sourceRoot":"","sources":["../../../src/-private/new-core-tmp/request-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,MAAM,EACN,oBAAoB,EACpB,YAAY,EAEZ,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAiExF;;;;;;GAMG;AACH,qBAAa,mBAAmB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU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,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC;IAC5C,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,IAAI,CAAC;CAC1C;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,wBAAwB,CAClC,CAAC,GAAG,OAAO,EACX,EAAE,GAAG,OAAO,EACZ,CAAC,SAAS,uBAAuB,GAAG,uBAAuB,IACzD,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAiCrG,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EACzC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GACjB,QAAQ,CAAC,wBAAwB,CAAC,CAAC,EAAE,EAAE,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAwDvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EACtC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GACjB,QAAQ,CAAC,wBAAwB,CAAC,CAAC,EAAE,EAAE,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CASvE"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
declare module '@ember-data/store/-private/record-arrays/identifier-array' {
|
|
2
|
-
import type { LocalRelationshipOperation } from '@warp-drive/core-types/graph';
|
|
3
|
-
import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
4
|
-
import type { TypeFromInstanceOrString } from '@warp-drive/core-types/record';
|
|
5
|
-
import type { ImmutableRequestInfo } from '@warp-drive/core-types/request';
|
|
6
|
-
import type { Links, PaginationLinks } from '@warp-drive/core-types/spec/json-api-raw';
|
|
7
|
-
import type { BaseFinderOptions } from '@ember-data/store/types';
|
|
8
|
-
import type { RecordArrayManager } from '@ember-data/store/-private/managers/record-array-manager';
|
|
9
|
-
import type { WarpDriveSignal } from '@ember-data/store/-private/new-core-tmp/reactivity/internal';
|
|
10
|
-
import { ARRAY_SIGNAL } from '@ember-data/store/-private/new-core-tmp/reactivity/internal';
|
|
11
|
-
import type { Store } from '@ember-data/store/-private/store-service';
|
|
12
|
-
import { NativeProxy } from '@ember-data/store/-private/record-arrays/native-proxy-type-fix';
|
|
13
|
-
export const SOURCE: "___(unique) Symbol(#source)";
|
|
14
|
-
export const MUTATE: "___(unique) Symbol(#update)";
|
|
15
|
-
const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
|
|
16
|
-
export type IdentifierArrayCreateOptions<T = unknown> = {
|
|
17
|
-
identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];
|
|
18
|
-
type?: TypeFromInstanceOrString<T>;
|
|
19
|
-
store: Store;
|
|
20
|
-
allowMutation: boolean;
|
|
21
|
-
manager: MinimumManager;
|
|
22
|
-
links?: Links | PaginationLinks | null;
|
|
23
|
-
meta?: Record<string, unknown> | null;
|
|
24
|
-
identifier?: StableDocumentIdentifier | null;
|
|
25
|
-
};
|
|
26
|
-
type PromiseTo<T> = Omit<Promise<T>, typeof Symbol.toStringTag>;
|
|
27
|
-
type PromiseManyArray<T> = {
|
|
28
|
-
length: number;
|
|
29
|
-
content: IdentifierArray<T> | null;
|
|
30
|
-
promise: Promise<IdentifierArray<T>> | null;
|
|
31
|
-
} & PromiseTo<IdentifierArray<T>>;
|
|
32
|
-
export type MinimumManager = {
|
|
33
|
-
_syncArray: (array: IdentifierArray) => void;
|
|
34
|
-
mutate?(mutation: LocalRelationshipOperation): void;
|
|
35
|
-
reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<IdentifierArray<T>> | PromiseManyArray<T>;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
A record array is an array that contains records of a certain type (or modelName).
|
|
39
|
-
The record array materializes records as needed when they are retrieved for the first
|
|
40
|
-
time. You should not create record arrays yourself. Instead, an instance of
|
|
41
|
-
`RecordArray` or its subclasses will be returned by your application's store
|
|
42
|
-
in response to queries.
|
|
43
|
-
|
|
44
|
-
This class should not be imported and instantiated by consuming applications.
|
|
45
|
-
|
|
46
|
-
@class RecordArray
|
|
47
|
-
@public
|
|
48
|
-
*/
|
|
49
|
-
export interface IdentifierArray<T = unknown> extends Omit<Array<T>, '[]'> {
|
|
50
|
-
[MUTATE]?(target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal): unknown;
|
|
51
|
-
}
|
|
52
|
-
export class IdentifierArray<T = unknown> {
|
|
53
|
-
DEPRECATED_CLASS_NAME: string;
|
|
54
|
-
/**
|
|
55
|
-
The flag to signal a `RecordArray` is currently loading data.
|
|
56
|
-
Example
|
|
57
|
-
```javascript
|
|
58
|
-
let people = store.peekAll('person');
|
|
59
|
-
people.isUpdating; // false
|
|
60
|
-
people.update();
|
|
61
|
-
people.isUpdating; // true
|
|
62
|
-
```
|
|
63
|
-
@property isUpdating
|
|
64
|
-
@public
|
|
65
|
-
@type Boolean
|
|
66
|
-
*/
|
|
67
|
-
isUpdating: boolean;
|
|
68
|
-
isLoaded: boolean;
|
|
69
|
-
isDestroying: boolean;
|
|
70
|
-
isDestroyed: boolean;
|
|
71
|
-
_updatingPromise: Promise<IdentifierArray<T>> | null;
|
|
72
|
-
readonly identifier: StableDocumentIdentifier | null;
|
|
73
|
-
[IS_COLLECTION]: boolean;
|
|
74
|
-
[ARRAY_SIGNAL]: WarpDriveSignal;
|
|
75
|
-
[SOURCE]: StableRecordIdentifier[];
|
|
76
|
-
links: Links | PaginationLinks | null;
|
|
77
|
-
meta: Record<string, unknown> | null;
|
|
78
|
-
modelName?: TypeFromInstanceOrString<T>;
|
|
79
|
-
/**
|
|
80
|
-
The store that created this record array.
|
|
81
|
-
|
|
82
|
-
@property store
|
|
83
|
-
@private
|
|
84
|
-
@type Store
|
|
85
|
-
*/
|
|
86
|
-
store: Store;
|
|
87
|
-
_manager: MinimumManager;
|
|
88
|
-
destroy(clear: boolean): void;
|
|
89
|
-
constructor(options: IdentifierArrayCreateOptions<T>);
|
|
90
|
-
/**
|
|
91
|
-
Used to get the latest version of all of the records in this array
|
|
92
|
-
from the adapter.
|
|
93
|
-
|
|
94
|
-
Example
|
|
95
|
-
|
|
96
|
-
```javascript
|
|
97
|
-
let people = store.peekAll('person');
|
|
98
|
-
people.isUpdating; // false
|
|
99
|
-
|
|
100
|
-
people.update().then(function() {
|
|
101
|
-
people.isUpdating; // false
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
people.isUpdating; // true
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
@method update
|
|
108
|
-
@public
|
|
109
|
-
*/
|
|
110
|
-
update(): Promise<IdentifierArray<T>>;
|
|
111
|
-
_update(): Promise<IdentifierArray<T>>;
|
|
112
|
-
/**
|
|
113
|
-
Saves all of the records in the `RecordArray`.
|
|
114
|
-
|
|
115
|
-
Example
|
|
116
|
-
|
|
117
|
-
```javascript
|
|
118
|
-
let messages = store.peekAll('message');
|
|
119
|
-
messages.forEach(function(message) {
|
|
120
|
-
message.hasBeenSeen = true;
|
|
121
|
-
});
|
|
122
|
-
messages.save();
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
@method save
|
|
126
|
-
@public
|
|
127
|
-
@return {Promise<IdentifierArray>} promise
|
|
128
|
-
*/
|
|
129
|
-
save(): Promise<IdentifierArray>;
|
|
130
|
-
}
|
|
131
|
-
export type CollectionCreateOptions = IdentifierArrayCreateOptions & {
|
|
132
|
-
manager: RecordArrayManager;
|
|
133
|
-
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
134
|
-
isLoaded: boolean;
|
|
135
|
-
};
|
|
136
|
-
export class Collection<T = unknown> extends IdentifierArray<T> {
|
|
137
|
-
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
138
|
-
_manager: RecordArrayManager;
|
|
139
|
-
constructor(options: CollectionCreateOptions);
|
|
140
|
-
_update(): Promise<Collection<T>>;
|
|
141
|
-
destroy(clear: boolean): void;
|
|
142
|
-
}
|
|
143
|
-
export {};
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=identifier-array.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier-array.d.ts","sourceRoot":"","sources":["../../../src/-private/record-arrays/identifier-array.ts"],"names":[],"mappings":"AAOA,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,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACL,YAAY,EAIb,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAuCtD,eAAO,MAAM,MAAM,+BAA+C,CAAC;AACnE,eAAO,MAAM,MAAM,+BAA+C,CAAC;AACnE,QAAA,MAAM,aAAa,qCAA4D,CAAC;AAchF,MAAM,MAAM,4BAA4B,CAAC,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