@warp-drive/core 5.7.0-alpha.26 → 5.7.0-alpha.28
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/declarations/graph/-private/-diff.d.ts +0 -13
- package/declarations/graph/-private/-edge-definition.d.ts +1 -10
- package/declarations/graph/-private/edges/resource.d.ts +1 -2
- package/declarations/reactive/-private/record.d.ts +2 -16
- package/declarations/reactive/-private/schema.d.ts +1 -67
- package/declarations/request/-private/context.d.ts +1 -1
- package/declarations/request/-private/manager.d.ts +21 -18
- package/declarations/request/-private/types.d.ts +1 -3
- package/declarations/store/-private/caches/instance-cache.d.ts +1 -1
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +13 -6
- package/declarations/store/-private/managers/cache-key-manager.d.ts +18 -35
- package/declarations/store/-private/managers/cache-manager.d.ts +1 -1
- package/declarations/store/-private/managers/notification-manager.d.ts +9 -17
- package/declarations/store/-private/managers/record-array-manager.d.ts +21 -68
- package/declarations/store/-private/network/request-cache.d.ts +12 -12
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +3 -41
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +8 -29
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +5 -3
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +3 -111
- package/declarations/store/-private/record-arrays/-utils.d.ts +0 -2
- package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +1 -9
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +5 -11
- package/declarations/store/-private/record-arrays/legacy-query.d.ts +1 -23
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +1 -124
- package/declarations/store/-private/record-arrays/resource-array.d.ts +3 -10
- package/declarations/store/-private/store-service.d.ts +77 -65
- package/declarations/store/-private.d.ts +4 -1
- package/declarations/store/-types/q/record-instance.d.ts +0 -1
- package/declarations/store/deprecated/-private.d.ts +0 -11
- package/declarations/types/identifier.d.ts +0 -8
- package/declarations/types/spec/json-api-raw.d.ts +6 -8
- package/declarations/utils/string.d.ts +2 -2
- package/dist/{configure-B48bFHOl.js → configure-CiFDHArV.js} +4 -4
- package/dist/configure.js +1 -1
- package/dist/{context-DbdT1mON.js → context-Bh-MA_tH.js} +5 -6
- package/dist/graph/-private.js +2 -5
- package/dist/index.js +17 -8
- package/dist/reactive.js +5 -5
- package/dist/{request-state-CqVrgUM0.js → request-state-B908BvPK.js} +219 -73
- package/dist/request.js +1 -1
- package/dist/store/-private.js +2 -2
- package/dist/types/-private.js +1 -1
- package/dist/utils/string.js +2 -2
- package/package.json +3 -3
|
@@ -12,19 +12,6 @@ type Diff<T> = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare function diffCollection(finalState: ResourceKey[], relationship: CollectionEdge, onAdd: (v: ResourceKey) => void, onDel: (v: ResourceKey) => void): Diff<ResourceKey>;
|
|
14
14
|
export declare function computeLocalState(storage: CollectionEdge): ResourceKey[];
|
|
15
|
-
/**
|
|
16
|
-
* A function which attempts to add a value to the local state of a collection
|
|
17
|
-
* relationship, and returns true if the value was added, or false if it was
|
|
18
|
-
* already present.
|
|
19
|
-
*
|
|
20
|
-
* It will not generate a notification, will not update the relationships to dirty,
|
|
21
|
-
* and will not update the inverse relationships, making it suitable for use as
|
|
22
|
-
* an internal util to perform the just the addition to a specific side of a
|
|
23
|
-
* relationship.
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export declare function _add(graph: Graph, record: ResourceKey, relationship: CollectionEdge, value: ResourceKey, index: number | null, isRemote: boolean): boolean;
|
|
28
15
|
export declare function _remove(graph: Graph, record: ResourceKey, relationship: CollectionEdge, value: ResourceKey, index: number | null, isRemote: boolean): boolean;
|
|
29
16
|
export declare function _removeLocal(relationship: CollectionEdge, value: ResourceKey): boolean;
|
|
30
17
|
export declare function _removeRemote(relationship: CollectionEdge, value: ResourceKey): boolean;
|
|
@@ -70,22 +70,17 @@ export declare function temporaryConvertToLegacy(field: ResourceField | Collecti
|
|
|
70
70
|
* }
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
73
|
-
*
|
|
74
|
-
* @class UpgradedMeta
|
|
75
|
-
* @internal
|
|
73
|
+
* @private
|
|
76
74
|
*/
|
|
77
75
|
export interface UpgradedMeta {
|
|
78
76
|
kind: "implicit" | RelationshipFieldKind;
|
|
79
77
|
/**
|
|
80
78
|
* The field name on `this` record
|
|
81
|
-
*
|
|
82
|
-
* @internal
|
|
83
79
|
*/
|
|
84
80
|
key: string;
|
|
85
81
|
/**
|
|
86
82
|
* The `type` of the related record
|
|
87
83
|
*
|
|
88
|
-
* @internal
|
|
89
84
|
*/
|
|
90
85
|
type: string;
|
|
91
86
|
isAsync: boolean;
|
|
@@ -97,12 +92,10 @@ export interface UpgradedMeta {
|
|
|
97
92
|
inverseKind: "implicit" | RelationshipFieldKind;
|
|
98
93
|
/**
|
|
99
94
|
* The field name on the opposing record
|
|
100
|
-
* @internal
|
|
101
95
|
*/
|
|
102
96
|
inverseKey: string;
|
|
103
97
|
/**
|
|
104
98
|
* The `type` of `this` record
|
|
105
|
-
* @internal
|
|
106
99
|
*/
|
|
107
100
|
inverseType: string;
|
|
108
101
|
inverseIsAsync: boolean;
|
|
@@ -131,7 +124,6 @@ export interface EdgeDefinition {
|
|
|
131
124
|
* If the relationship is polymorphic, this will be true if
|
|
132
125
|
* it points back at the same abstract type.
|
|
133
126
|
*
|
|
134
|
-
* @internal
|
|
135
127
|
*/
|
|
136
128
|
isSelfReferential: boolean;
|
|
137
129
|
/**
|
|
@@ -139,7 +131,6 @@ export interface EdgeDefinition {
|
|
|
139
131
|
* if the relationship also points back at the same
|
|
140
132
|
* field.
|
|
141
133
|
*
|
|
142
|
-
* @internal
|
|
143
134
|
*/
|
|
144
135
|
isReflexive: boolean;
|
|
145
136
|
}
|
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
import type { Store } from "../../store/-private.js";
|
|
2
|
-
import { RecordStore } from "../../types/symbols.js";
|
|
3
1
|
import type { ObjectContext, ResourceContext } from "./default-mode.js";
|
|
4
|
-
import { Checkout
|
|
2
|
+
import { Checkout } from "./symbols.js";
|
|
5
3
|
export interface ReactiveResource {
|
|
6
|
-
/** @internal */
|
|
7
|
-
[Symbol.toStringTag]: `ReactiveResource<${string}>`;
|
|
8
|
-
/** @internal */
|
|
9
|
-
[Context]: ObjectContext | ResourceContext;
|
|
10
|
-
/** @internal */
|
|
11
|
-
[RecordStore]: Store;
|
|
12
|
-
/** @internal */
|
|
13
|
-
___notifications: object;
|
|
14
|
-
/** @internal */
|
|
15
|
-
[Destroy](): void;
|
|
16
|
-
/** @internal */
|
|
17
|
-
[Commit](): Promise<void>;
|
|
18
4
|
/**
|
|
19
5
|
* Create an editable copy of the record
|
|
20
6
|
*
|
|
@@ -30,7 +16,7 @@ export interface ReactiveResource {
|
|
|
30
16
|
*
|
|
31
17
|
* @returns a promise that resolves to the editable record
|
|
32
18
|
* @throws if the record is already editable or if the record is embedded
|
|
33
|
-
* @
|
|
19
|
+
* @private
|
|
34
20
|
*/
|
|
35
21
|
[Checkout]<T>(): Promise<T>;
|
|
36
22
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Store } from "../../store/-private.js";
|
|
2
1
|
import type { SchemaService as SchemaServiceInterface } from "../../types.js";
|
|
3
2
|
import type { ResourceKey } from "../../types/identifier.js";
|
|
4
3
|
import type { ObjectValue, Value } from "../../types/json/raw.js";
|
|
5
4
|
import type { Derivation, HashFn } from "../../types/schema/concepts.js";
|
|
6
|
-
import { type ArrayField, type CacheableFieldSchema, type DerivedField, type FieldSchema, type GenericField, type HashField, type IdentityField, type LegacyAttributeField, type
|
|
5
|
+
import { type ArrayField, type CacheableFieldSchema, type DerivedField, type FieldSchema, type GenericField, type HashField, type IdentityField, type LegacyAttributeField, type LegacyRelationshipField, type ObjectField, type ObjectSchema, type PolarisResourceSchema, type ResourceSchema, type Trait } from "../../types/schema/fields.js";
|
|
7
6
|
import { Type } from "../../types/symbols.js";
|
|
8
7
|
import type { WithPartial } from "../../types/utils.js";
|
|
9
8
|
import type { ReactiveResource } from "./record.js";
|
|
@@ -133,7 +132,6 @@ export declare const fromIdentity: FromIdentityDerivation;
|
|
|
133
132
|
* ```
|
|
134
133
|
*
|
|
135
134
|
* @public
|
|
136
|
-
* @param {SchemaService} schema
|
|
137
135
|
*/
|
|
138
136
|
export declare function registerDerivations(schema: SchemaServiceInterface): void;
|
|
139
137
|
interface InternalSchema {
|
|
@@ -154,17 +152,6 @@ export type Transformation<
|
|
|
154
152
|
defaultValue?(options: Record<string, unknown> | null, identifier: ResourceKey): T;
|
|
155
153
|
[Type]: string;
|
|
156
154
|
};
|
|
157
|
-
interface KindFns {
|
|
158
|
-
belongsTo: {
|
|
159
|
-
get: (store: Store, record: object, resourceKey: ResourceKey, field: LegacyBelongsToField) => unknown;
|
|
160
|
-
set: (store: Store, record: object, cacheKey: ResourceKey, field: LegacyBelongsToField, value: unknown) => void;
|
|
161
|
-
};
|
|
162
|
-
hasMany: {
|
|
163
|
-
get: (store: Store, record: object, resourceKey: ResourceKey, field: LegacyHasManyField) => unknown;
|
|
164
|
-
set: (store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField, value: unknown) => void;
|
|
165
|
-
notify: (store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField) => boolean;
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
155
|
export interface SchemaService {
|
|
169
156
|
doesTypeExist(type: string): boolean;
|
|
170
157
|
attributesDefinitionFor(identifier: {
|
|
@@ -174,41 +161,12 @@ export interface SchemaService {
|
|
|
174
161
|
type: string;
|
|
175
162
|
}): InternalSchema["relationships"];
|
|
176
163
|
}
|
|
177
|
-
interface InternalTrait {
|
|
178
|
-
name: string;
|
|
179
|
-
mode: "legacy" | "polaris";
|
|
180
|
-
fields: Map<string, FieldSchema>;
|
|
181
|
-
traits: string[];
|
|
182
|
-
}
|
|
183
164
|
/**
|
|
184
165
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
185
166
|
*
|
|
186
|
-
* @class SchemaService
|
|
187
167
|
* @public
|
|
188
168
|
*/
|
|
189
169
|
export declare class SchemaService implements SchemaServiceInterface {
|
|
190
|
-
/** @internal */
|
|
191
|
-
_schemas: Map<string, InternalSchema>;
|
|
192
|
-
/** @internal */
|
|
193
|
-
_transforms: Map<string, Transformation>;
|
|
194
|
-
/** @internal */
|
|
195
|
-
_hashFns: Map<string, HashFn>;
|
|
196
|
-
/** @internal */
|
|
197
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
198
|
-
_derivations: Map<string, Derivation<any, any, any>>;
|
|
199
|
-
/** @internal */
|
|
200
|
-
_traits: Map<string, InternalTrait>;
|
|
201
|
-
/** @internal */
|
|
202
|
-
_modes: Map<string, KindFns>;
|
|
203
|
-
/** @internal */
|
|
204
|
-
_extensions: {
|
|
205
|
-
object: Map<string, ProcessedExtension>;
|
|
206
|
-
array: Map<string, ProcessedExtension>;
|
|
207
|
-
};
|
|
208
|
-
_cachedFieldExtensionsByField: {
|
|
209
|
-
object: Map<object, ProcessedExtension["features"] | null>;
|
|
210
|
-
array: Map<object, ProcessedExtension["features"] | null>;
|
|
211
|
-
};
|
|
212
170
|
constructor();
|
|
213
171
|
resourceTypes(): Readonly<string[]>;
|
|
214
172
|
hasTrait(type: string): boolean;
|
|
@@ -278,30 +236,6 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
278
236
|
name: string;
|
|
279
237
|
}): boolean;
|
|
280
238
|
/**
|
|
281
|
-
* This is an internal method used to register behaviors for legacy mode.
|
|
282
|
-
* It is not intended for public use.
|
|
283
|
-
*
|
|
284
|
-
* We do think a generalized `kind` registration system would be useful,
|
|
285
|
-
* but we have not yet designed it.
|
|
286
|
-
*
|
|
287
|
-
* See https://github.com/emberjs/data/issues/9534
|
|
288
|
-
*
|
|
289
|
-
* @internal
|
|
290
|
-
*/
|
|
291
|
-
_registerMode(mode: string, kinds: KindFns): void;
|
|
292
|
-
/**
|
|
293
|
-
* This is an internal method used to enable legacy behaviors for legacy mode.
|
|
294
|
-
* It is not intended for public use.
|
|
295
|
-
*
|
|
296
|
-
* We do think a generalized `kind` registration system would be useful,
|
|
297
|
-
* but we have not yet designed it.
|
|
298
|
-
*
|
|
299
|
-
* See https://github.com/emberjs/data/issues/9534
|
|
300
|
-
*
|
|
301
|
-
* @internal
|
|
302
|
-
*/
|
|
303
|
-
_kind<T extends keyof KindFns>(mode: string, kind: T): KindFns[T];
|
|
304
|
-
/**
|
|
305
239
|
* Registers a {@link HashFn} for use with a {@link HashField} for
|
|
306
240
|
* either {@link ObjectSchema} identity or polymorphic type calculation.
|
|
307
241
|
*
|
|
@@ -90,27 +90,9 @@ import { IS_CACHE_HANDLER } from "./utils.js";
|
|
|
90
90
|
* type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
|
|
91
91
|
* ```
|
|
92
92
|
*
|
|
93
|
-
* @hideconstructor
|
|
94
93
|
* @public
|
|
95
94
|
*/
|
|
96
95
|
export declare class RequestManager {
|
|
97
|
-
#private;
|
|
98
|
-
/** @internal */
|
|
99
|
-
_hasCacheHandler: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* A map of pending requests from request.id to their
|
|
102
|
-
* associated CacheHandler promise.
|
|
103
|
-
*
|
|
104
|
-
* This queue is managed by the CacheHandler
|
|
105
|
-
*
|
|
106
|
-
* @internal
|
|
107
|
-
*/
|
|
108
|
-
_pending: Map<number, Promise<unknown>>;
|
|
109
|
-
/** @internal */
|
|
110
|
-
_deduped: Map<RequestKey, {
|
|
111
|
-
priority: ManagedRequestPriority;
|
|
112
|
-
promise: Promise<unknown>;
|
|
113
|
-
}>;
|
|
114
96
|
constructor(options?: GenericCreateArgs);
|
|
115
97
|
/**
|
|
116
98
|
* Register a handler to use for primary cache intercept.
|
|
@@ -153,3 +135,24 @@ export declare class RequestManager {
|
|
|
153
135
|
*/
|
|
154
136
|
static create(options?: GenericCreateArgs): RequestManager;
|
|
155
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* This type exists for internal use only for
|
|
140
|
+
* where intimate contracts still exist either for
|
|
141
|
+
* the Test Suite or for Legacy code.
|
|
142
|
+
*
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
export interface PrivateRequestManager extends RequestManager {
|
|
146
|
+
/**
|
|
147
|
+
* A map of pending requests from request.id to their
|
|
148
|
+
* associated CacheHandler promise.
|
|
149
|
+
*
|
|
150
|
+
* This queue is managed by the CacheHandler
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
_pending: Map<number, Promise<unknown>>;
|
|
154
|
+
_deduped: Map<RequestKey, {
|
|
155
|
+
priority: ManagedRequestPriority;
|
|
156
|
+
promise: Promise<unknown>;
|
|
157
|
+
}>;
|
|
158
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-irregular-whitespace */
|
|
2
2
|
import type { Store } from "../../store/-private.js";
|
|
3
3
|
import type { RequestKey } from "../../types/identifier.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { RequestContext, RequestInfo, ResponseInfo, StructuredDataDocument } from "../../types/request.js";
|
|
5
5
|
import type { RequestManager } from "./manager.js";
|
|
6
6
|
export interface GodContext {
|
|
7
7
|
controller: AbortController;
|
|
@@ -35,8 +35,6 @@ export type DeferredStream = {
|
|
|
35
35
|
* @public
|
|
36
36
|
*/
|
|
37
37
|
export interface Future<T> extends Promise<StructuredDataDocument<T>> {
|
|
38
|
-
/** @internal */
|
|
39
|
-
[IS_FUTURE]: true;
|
|
40
38
|
/**
|
|
41
39
|
* Cancel this request by firing the {@link AbortController}'s signal.
|
|
42
40
|
*
|
|
@@ -32,7 +32,7 @@ export declare function removeRecordIdentifier(record: OpaqueRecordInstance): vo
|
|
|
32
32
|
export declare const StoreMap: Map<unknown, Store>;
|
|
33
33
|
/**
|
|
34
34
|
* We may eventually make this public, but its likely better for this to be killed off
|
|
35
|
-
* @
|
|
35
|
+
* @private
|
|
36
36
|
*/
|
|
37
37
|
export declare function storeFor(record: OpaqueRecordInstance, ignoreMissing: boolean): Store | null;
|
|
38
38
|
export type Caches = {
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
|
|
2
2
|
import type { CacheCapabilitiesManager as StoreWrapper } from "../../-types/q/cache-capabilities-manager.js";
|
|
3
3
|
import type { SchemaService } from "../../-types/q/schema-service.js";
|
|
4
|
-
import type { Store } from "../store-service.js";
|
|
4
|
+
import type { PrivateStore, Store } from "../store-service.js";
|
|
5
5
|
import type { CacheKeyManager } from "./cache-key-manager.js";
|
|
6
6
|
import type { NotificationType } from "./notification-manager.js";
|
|
7
7
|
export interface CacheCapabilitiesManager {
|
|
8
|
+
/** @deprecated - use {@link CacheCapabilitiesManager.schema} */
|
|
8
9
|
getSchemaDefinitionService(): SchemaService;
|
|
9
10
|
}
|
|
10
11
|
export declare class CacheCapabilitiesManager implements StoreWrapper {
|
|
11
|
-
_willNotify: boolean;
|
|
12
|
-
_pendingNotifies: Map<ResourceKey, Set<string>>;
|
|
13
|
-
_store: Store;
|
|
14
12
|
constructor(_store: Store);
|
|
15
13
|
get cacheKeyManager(): CacheKeyManager;
|
|
16
14
|
/** @deprecated use {@link CacheCapabilitiesManager.cacheKeyManager} */
|
|
17
15
|
get identifierCache(): CacheKeyManager;
|
|
18
|
-
_scheduleNotification(identifier: ResourceKey, key: string): void;
|
|
19
|
-
_flushNotifications(): void;
|
|
20
16
|
notifyChange(identifier: ResourceKey, namespace: "added" | "removed", key: null): void;
|
|
21
17
|
notifyChange(identifier: RequestKey, namespace: "added" | "updated" | "removed", key: null): void;
|
|
22
18
|
notifyChange(identifier: ResourceKey, namespace: NotificationType, key: string | null): void;
|
|
@@ -25,3 +21,14 @@ export declare class CacheCapabilitiesManager implements StoreWrapper {
|
|
|
25
21
|
hasRecord(identifier: ResourceKey): boolean;
|
|
26
22
|
disconnectRecord(identifier: ResourceKey): void;
|
|
27
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* This type exists for internal use only for
|
|
26
|
+
* where intimate contracts still exist either for
|
|
27
|
+
* the Test Suite or for Legacy code.
|
|
28
|
+
*
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
export interface PrivateCacheCapabilitiesManager extends CacheCapabilitiesManager {
|
|
32
|
+
_store: PrivateStore;
|
|
33
|
+
}
|
|
34
|
+
export declare function assertPrivateCapabilities(manager: unknown): asserts manager is PrivateCacheCapabilitiesManager;
|
|
@@ -191,38 +191,8 @@ export declare function setKeyInfoForResource(method: KeyInfoMethod | null): voi
|
|
|
191
191
|
* @public
|
|
192
192
|
*/
|
|
193
193
|
export declare class CacheKeyManager {
|
|
194
|
-
/** @internal */
|
|
195
|
-
_cache: StableCache;
|
|
196
|
-
private _generate;
|
|
197
|
-
private _update;
|
|
198
|
-
private _forget;
|
|
199
|
-
private _reset;
|
|
200
|
-
private _merge;
|
|
201
|
-
private _keyInfoForResource;
|
|
202
|
-
private _id;
|
|
203
194
|
constructor();
|
|
204
195
|
/**
|
|
205
|
-
* Internal hook to allow management of merge conflicts with identifiers.
|
|
206
|
-
*
|
|
207
|
-
* we allow late binding of this private internal merge so that
|
|
208
|
-
* the cache can insert itself here to handle elimination of duplicates
|
|
209
|
-
*
|
|
210
|
-
* @private
|
|
211
|
-
*/
|
|
212
|
-
__configureMerge(method: MergeMethod | null): void;
|
|
213
|
-
/** @internal */
|
|
214
|
-
upgradeIdentifier(resource: {
|
|
215
|
-
type: string;
|
|
216
|
-
id: string | null;
|
|
217
|
-
lid?: string;
|
|
218
|
-
}): ResourceKey;
|
|
219
|
-
/**
|
|
220
|
-
* @private
|
|
221
|
-
*/
|
|
222
|
-
private _getRecordIdentifier;
|
|
223
|
-
private _getRecordIdentifier;
|
|
224
|
-
private _getRecordIdentifier;
|
|
225
|
-
/**
|
|
226
196
|
* allows us to peek without generating when needed
|
|
227
197
|
* useful for the "create" case when we need to see if
|
|
228
198
|
* we are accidentally overwritting something
|
|
@@ -286,10 +256,6 @@ export declare class CacheKeyManager {
|
|
|
286
256
|
// FIXME audit usage
|
|
287
257
|
updateRecordIdentifier(identifierObject: ResourceKey, data: unknown): ResourceKey;
|
|
288
258
|
/**
|
|
289
|
-
* @private
|
|
290
|
-
*/
|
|
291
|
-
_mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: ResourceKey, existingIdentifier: ResourceKey, data: unknown): ResourceKey;
|
|
292
|
-
/**
|
|
293
259
|
Provides the opportunity to eliminate an identifier from secondary lookup tables
|
|
294
260
|
as well as eliminates it from ember-data's own lookup tables and book keeping.
|
|
295
261
|
|
|
@@ -301,7 +267,24 @@ export declare class CacheKeyManager {
|
|
|
301
267
|
*/
|
|
302
268
|
// FIXME audit usage
|
|
303
269
|
forgetRecordIdentifier(identifierObject: ResourceKey): void;
|
|
304
|
-
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* This type exists for internal use only for
|
|
273
|
+
* where intimate contracts still exist either for
|
|
274
|
+
* the Test Suite or for Legacy code.
|
|
275
|
+
*
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
export interface PrivateCacheKeyManager extends CacheKeyManager {
|
|
279
|
+
_cache: StableCache;
|
|
280
|
+
/**
|
|
281
|
+
* Internal hook to allow management of merge conflicts with identifiers.
|
|
282
|
+
*
|
|
283
|
+
* we allow late binding of this private internal merge so that
|
|
284
|
+
* the cache can insert itself here to handle elimination of duplicates
|
|
285
|
+
*/
|
|
286
|
+
__configureMerge(method: MergeMethod | null): void;
|
|
287
|
+
_mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: ResourceKey, existingIdentifier: ResourceKey, data: unknown): ResourceKey;
|
|
305
288
|
destroy(): void;
|
|
306
289
|
}
|
|
307
290
|
export {};
|
|
@@ -28,8 +28,8 @@ import type { StoreRequestContext } from "../cache-handler/handler.js";
|
|
|
28
28
|
* @public
|
|
29
29
|
*/
|
|
30
30
|
export declare class CacheManager implements Cache {
|
|
31
|
-
#private;
|
|
32
31
|
version: "2";
|
|
32
|
+
private ___cache;
|
|
33
33
|
constructor(cache: Cache);
|
|
34
34
|
// Cache Management
|
|
35
35
|
// ================
|
|
@@ -28,18 +28,6 @@ export interface DocumentOperationCallback {
|
|
|
28
28
|
* @public
|
|
29
29
|
*/
|
|
30
30
|
export default class NotificationManager {
|
|
31
|
-
/** @internal */
|
|
32
|
-
private store;
|
|
33
|
-
/** @internal */
|
|
34
|
-
private isDestroyed;
|
|
35
|
-
/** @internal */
|
|
36
|
-
private _buffered;
|
|
37
|
-
/** @internal */
|
|
38
|
-
private _cache;
|
|
39
|
-
/** @internal */
|
|
40
|
-
private _hasFlush;
|
|
41
|
-
/** @internal */
|
|
42
|
-
private _onFlushCB?;
|
|
43
31
|
constructor(store: Store);
|
|
44
32
|
/**
|
|
45
33
|
* Subscribe to changes for a given ResourceKey, RequestKey, or addition/removal of any resource
|
|
@@ -84,11 +72,15 @@ export default class NotificationManager {
|
|
|
84
72
|
notify(cacheKey: ResourceKey, value: "errors" | "meta" | "identity" | "state", key?: null): boolean;
|
|
85
73
|
notify(cacheKey: ResourceKey, value: CacheOperation, key?: null): boolean;
|
|
86
74
|
notify(cacheKey: RequestKey, value: DocumentCacheOperation, key?: null): boolean;
|
|
87
|
-
/** @internal */
|
|
88
|
-
_onNextFlush(cb: () => void): void;
|
|
89
75
|
private _scheduleNotify;
|
|
90
|
-
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* This type exists for internal use only for
|
|
79
|
+
* where intimate contracts still exist either for
|
|
80
|
+
* the Test Suite or for Legacy code.
|
|
81
|
+
*
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
export interface PrivateNotificationManager extends NotificationManager {
|
|
91
85
|
_flush(): void;
|
|
92
|
-
/** @internal */
|
|
93
|
-
destroy(): void;
|
|
94
86
|
}
|
|
@@ -6,7 +6,6 @@ import type { LegacyLiveArray } from "../record-arrays/legacy-live-array.js";
|
|
|
6
6
|
import { type LegacyQueryArray } from "../record-arrays/legacy-query.js";
|
|
7
7
|
import { type ReactiveResourceArray } from "../record-arrays/resource-array.js";
|
|
8
8
|
import type { Store } from "../store-service.js";
|
|
9
|
-
import type { UnsubscribeToken } from "./notification-manager.js";
|
|
10
9
|
/**
|
|
11
10
|
* This is a clever optimization.
|
|
12
11
|
*
|
|
@@ -40,7 +39,7 @@ import type { UnsubscribeToken } from "./notification-manager.js";
|
|
|
40
39
|
* Sincerely,
|
|
41
40
|
* - runspired (Chris Thoburn) 08/21/2022
|
|
42
41
|
*
|
|
43
|
-
* @
|
|
42
|
+
* @private
|
|
44
43
|
* @param target the array to push into
|
|
45
44
|
* @param source the items to push into target
|
|
46
45
|
*/
|
|
@@ -58,91 +57,45 @@ interface RequestCollectionInit {
|
|
|
58
57
|
}
|
|
59
58
|
type ChangeSet = Map<ResourceKey, "add" | "del">;
|
|
60
59
|
/**
|
|
61
|
-
@
|
|
62
|
-
@
|
|
60
|
+
@hideconstructor
|
|
61
|
+
@private
|
|
63
62
|
*/
|
|
64
63
|
export declare class RecordArrayManager {
|
|
65
|
-
store: Store;
|
|
66
|
-
isDestroying: boolean;
|
|
67
|
-
isDestroyed: boolean;
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
_set: Map<ReactiveResourceArray, Set<ResourceKey>>;
|
|
72
|
-
/**
|
|
73
|
-
* LiveArray (peekAll/findAll) array instances
|
|
74
|
-
* keyed by their ResourceType.
|
|
75
|
-
*/
|
|
76
|
-
_live: Map<string, LegacyLiveArray>;
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
_managed: Set<ReactiveResourceArray>;
|
|
81
|
-
/**
|
|
82
|
-
* Buffered changes to apply keyed by the array to
|
|
83
|
-
* which to apply them to.
|
|
84
|
-
*/
|
|
85
|
-
_pending: Map<ReactiveResourceArray, ChangeSet>;
|
|
86
|
-
/**
|
|
87
|
-
* An inverse map from ResourceKey to the list
|
|
88
|
-
* of arrays it can be found in, useful for fast updates
|
|
89
|
-
* when state changes to a resource occur.
|
|
90
|
-
*/
|
|
91
|
-
_identifiers: Map<ResourceKey, Set<ReactiveResourceArray>>;
|
|
92
|
-
/**
|
|
93
|
-
* When we do not yet have a LiveArray, this keeps track of
|
|
94
|
-
* the added/removed identifiers to enable us to more efficiently
|
|
95
|
-
* produce the LiveArray later.
|
|
96
|
-
*
|
|
97
|
-
* It's possible that using a Set and only storing additions instead of
|
|
98
|
-
* additions and deletes would be more efficient.
|
|
99
|
-
*/
|
|
100
|
-
_staged: Map<string, ChangeSet>;
|
|
101
|
-
_subscription: UnsubscribeToken;
|
|
102
|
-
_documentSubscription: UnsubscribeToken;
|
|
103
|
-
/**
|
|
104
|
-
* KeyedArrays are arrays associated to a specific RequestKey.
|
|
105
|
-
*/
|
|
106
|
-
_keyedArrays: Map<string, ReactiveResourceArray>;
|
|
107
|
-
/**
|
|
108
|
-
* The visibility set tracks whether a given identifier should
|
|
109
|
-
* be shown in RecordArrays. It is used to dedupe added/removed
|
|
110
|
-
* and state change events.
|
|
111
|
-
*
|
|
112
|
-
* As a Map, it grows to be very large - there may be ways to
|
|
113
|
-
* reduce its size by instead migrating to it functioning as
|
|
114
|
-
* an exclusion list. Any entry not in the list would be considered
|
|
115
|
-
* visible.
|
|
116
|
-
*/
|
|
117
|
-
_visibilitySet: Map<ResourceKey, boolean>;
|
|
118
64
|
constructor(options: {
|
|
119
65
|
store: Store;
|
|
120
66
|
});
|
|
121
|
-
private _subscribeToResourceChanges;
|
|
122
|
-
_syncArray(array: ReactiveResourceArray): void;
|
|
123
67
|
mutate(mutation: LocalRelationshipOperation): void;
|
|
124
68
|
/**
|
|
125
69
|
Get the `RecordArray` for a modelName, which contains all loaded records of
|
|
126
70
|
given modelName.
|
|
127
71
|
|
|
128
|
-
@
|
|
129
|
-
@param {String} modelName
|
|
130
|
-
@return {RecordArray}
|
|
72
|
+
@private
|
|
131
73
|
*/
|
|
132
74
|
liveArrayFor(type: string): LegacyLiveArray;
|
|
133
75
|
getCollection(config: LegacyQueryInit): LegacyQueryArray;
|
|
134
76
|
getCollection(config: AnonymousRequestCollectionInit): ReactiveResourceArray;
|
|
135
77
|
getCollection(config: RequestCollectionInit): ReactiveResourceArray;
|
|
136
|
-
dirtyArray
|
|
137
|
-
|
|
78
|
+
private dirtyArray;
|
|
79
|
+
/**
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
138
82
|
populateManagedArray(array: ReactiveResourceArray, identifiers: ResourceKey[], payload: CollectionResourceDocument | null): void;
|
|
139
|
-
identifierAdded(identifier: ResourceKey): void;
|
|
140
|
-
identifierRemoved(identifier: ResourceKey): void;
|
|
141
|
-
identifierChanged(identifier: ResourceKey): void;
|
|
142
83
|
pause(): void;
|
|
143
84
|
resume(): void;
|
|
144
|
-
clear(isClear?: boolean): void;
|
|
145
85
|
destroy(): void;
|
|
146
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* This type exists for internal use only for
|
|
89
|
+
* where intimate contracts still exist either for
|
|
90
|
+
* the Test Suite or for Legacy code.
|
|
91
|
+
*
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
export interface PrivateRecordArrayManager extends RecordArrayManager {
|
|
95
|
+
_live: Map<string, LegacyLiveArray>;
|
|
96
|
+
_pending: Map<ReactiveResourceArray, ChangeSet>;
|
|
97
|
+
_managed: Set<ReactiveResourceArray>;
|
|
98
|
+
clear(isClear?: boolean): void;
|
|
99
|
+
}
|
|
147
100
|
export declare function disassociateIdentifier(ArraysCache: Map<ResourceKey, Set<ReactiveResourceArray>>, array: ReactiveResourceArray, identifier: ResourceKey): void;
|
|
148
101
|
export {};
|
|
@@ -42,19 +42,7 @@ export type RequestSubscription = (requestState: RequestCacheRequestState) => vo
|
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
44
|
export declare class RequestStateService {
|
|
45
|
-
/** @internal */
|
|
46
|
-
_pending: Map<ResourceKey, InternalRequest[]>;
|
|
47
|
-
private _done;
|
|
48
|
-
private _subscriptions;
|
|
49
|
-
private _toFlush;
|
|
50
|
-
private _store;
|
|
51
45
|
constructor(store: Store);
|
|
52
|
-
/** @internal */
|
|
53
|
-
_clearEntries(identifier: ResourceKey): void;
|
|
54
|
-
/** @internal */
|
|
55
|
-
_enqueue<T>(promise: Promise<T>, queryRequest: Request): Promise<T>;
|
|
56
|
-
private _triggerSubscriptions;
|
|
57
|
-
private _flush;
|
|
58
46
|
private _flushRequest;
|
|
59
47
|
private _dequeue;
|
|
60
48
|
private _addDone;
|
|
@@ -104,4 +92,16 @@ export declare class RequestStateService {
|
|
|
104
92
|
*/
|
|
105
93
|
getLastRequestForRecord(identifier: ResourceKey): RequestCacheRequestState | null;
|
|
106
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* This type exists for internal use only for
|
|
97
|
+
* where intimate contracts still exist either for
|
|
98
|
+
* the Test Suite or for Legacy code.
|
|
99
|
+
*
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
export interface PrivateRequestStateService extends RequestStateService {
|
|
103
|
+
_pending: Map<ResourceKey, InternalRequest[]>;
|
|
104
|
+
_clearEntries(identifier: ResourceKey): void;
|
|
105
|
+
_enqueue<T>(promise: Promise<T>, queryRequest: Request): Promise<T>;
|
|
106
|
+
}
|
|
107
107
|
export {};
|