@warp-drive/core 5.7.0-alpha.9 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/graph/-private/-diff.d.ts +7 -20
- package/declarations/graph/-private/-edge-definition.d.ts +3 -12
- package/declarations/graph/-private/-state.d.ts +0 -87
- package/declarations/graph/-private/-utils.d.ts +5 -11
- package/declarations/graph/-private/coerce-id.d.ts +0 -6
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +2 -14
- package/declarations/graph/-private/edges/collection.d.ts +10 -10
- package/declarations/graph/-private/edges/implicit.d.ts +5 -5
- package/declarations/graph/-private/edges/resource.d.ts +6 -7
- package/declarations/graph/-private/graph.d.ts +17 -51
- package/declarations/graph/-private/normalize-link.d.ts +0 -6
- package/declarations/graph/-private/operations/replace-related-records.d.ts +4 -59
- package/declarations/graph/-private/operations/update-relationship.d.ts +3 -7
- package/declarations/index.d.ts +1 -1
- package/declarations/reactive/-private/default-mode.d.ts +2 -2
- package/declarations/reactive/-private/document.d.ts +11 -27
- package/declarations/reactive/-private/fields/managed-array.d.ts +4 -6
- package/declarations/reactive/-private/fields/managed-object.d.ts +2 -8
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +2 -2
- package/declarations/reactive/-private/hooks.d.ts +2 -2
- package/declarations/reactive/-private/record.d.ts +42 -30
- package/declarations/reactive/-private/schema.d.ts +11 -73
- package/declarations/reactive/-private/symbols.d.ts +2 -33
- package/declarations/reactive/-private.d.ts +1 -1
- package/declarations/reactive.d.ts +277 -1
- package/declarations/request/-private/context.d.ts +3 -5
- package/declarations/request/-private/fetch.d.ts +2 -2
- package/declarations/request/-private/manager.d.ts +24 -28
- package/declarations/request/-private/types.d.ts +22 -24
- package/declarations/request/-private/utils.d.ts +44 -2
- package/declarations/store/-private/cache-handler/handler.d.ts +2 -8
- package/declarations/store/-private/cache-handler/types.d.ts +10 -10
- package/declarations/store/-private/cache-handler/utils.d.ts +4 -5
- package/declarations/store/-private/caches/instance-cache.d.ts +21 -20
- package/declarations/store/-private/debug/utils.d.ts +1 -0
- package/declarations/store/-private/default-cache-policy.d.ts +25 -40
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +24 -15
- package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +35 -53
- package/declarations/store/-private/managers/cache-manager.d.ts +46 -111
- package/declarations/store/-private/managers/notification-manager.d.ts +30 -45
- package/declarations/store/-private/managers/record-array-manager.d.ts +44 -41
- package/declarations/store/-private/network/request-cache.d.ts +21 -25
- package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +3 -41
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +14 -29
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +24 -3
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +132 -37
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +51 -135
- package/declarations/store/-private/record-arrays/-utils.d.ts +80 -0
- package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +81 -0
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +133 -0
- package/declarations/store/-private/record-arrays/legacy-query.d.ts +81 -0
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +1 -124
- package/declarations/store/-private/record-arrays/resource-array.d.ts +67 -0
- package/declarations/store/-private/store-service.d.ts +156 -106
- package/declarations/store/-private/utils/coerce-id.d.ts +0 -6
- package/declarations/store/-private.d.ts +11 -13
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
- package/declarations/store/-types/q/identifier.d.ts +9 -6
- package/declarations/store/-types/q/record-instance.d.ts +0 -1
- package/declarations/store/-types/q/schema-service.d.ts +9 -9
- package/declarations/store/-types/q/store.d.ts +6 -7
- package/declarations/store/deprecated/-private.d.ts +12 -24
- package/declarations/store/deprecated/store.d.ts +11 -16
- package/declarations/types/-private.d.ts +1 -1
- package/declarations/types/cache/aliases.d.ts +0 -11
- package/declarations/types/cache/change.d.ts +2 -2
- package/declarations/types/cache/mutations.d.ts +13 -37
- package/declarations/types/cache/operations.d.ts +115 -32
- package/declarations/types/cache/relationship.d.ts +4 -7
- package/declarations/types/cache.d.ts +51 -125
- package/declarations/types/graph.d.ts +12 -12
- package/declarations/types/identifier.d.ts +52 -78
- package/declarations/types/params.d.ts +2 -3
- package/declarations/types/request.d.ts +66 -42
- package/declarations/types/schema/concepts.d.ts +2 -2
- package/declarations/types/schema/fields.d.ts +30 -3
- package/declarations/types/spec/document.d.ts +6 -10
- package/declarations/types/spec/json-api-raw.d.ts +6 -9
- package/declarations/types.d.ts +0 -1
- package/declarations/utils/string.d.ts +2 -3
- package/dist/{configure-B48bFHOl.js → configure-C3x8YXzL.js} +5 -5
- package/dist/configure.js +1 -1
- package/dist/{context-COmAnXUQ.js → context-C_7OLieY.js} +48 -6
- package/dist/graph/-private.js +137 -144
- package/dist/index.js +25 -14
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +144 -1926
- package/dist/{request-state-CeN66aML.js → request-state-C955e0AL.js} +5968 -3033
- package/dist/request.js +1 -1
- package/dist/store/-private.js +2 -3
- package/dist/store.js +32 -44
- package/dist/{symbols-SIstXMLI.js → symbols-sql1_mdx.js} +3 -8
- package/dist/types/-private.js +1 -1
- package/dist/types/identifier.js +19 -45
- package/dist/types/request.js +45 -3
- package/dist/types/schema/fields.js +6 -0
- package/dist/utils/string.js +2 -2
- package/package.json +11 -11
- package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
- package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
- package/dist/handler-SdXlte1w.js +0 -339
|
@@ -3,30 +3,28 @@ export { storeFor } from "./-private/store-service.js";
|
|
|
3
3
|
export { recordIdentifierFor } from "./-private/caches/instance-cache.js";
|
|
4
4
|
export { CacheHandler, type StoreRequestContext } from "./-private/cache-handler/handler.js";
|
|
5
5
|
export { type CachePolicy } from "./-private/cache-handler/types.js";
|
|
6
|
-
export {
|
|
6
|
+
export { isResourceKey, isRequestKey } from "./-private/managers/cache-key-manager.js";
|
|
7
7
|
export { constructResource } from "./-private/utils/construct-resource.js";
|
|
8
8
|
export type { InstanceCache } from "./-private/caches/instance-cache.js";
|
|
9
9
|
export type { FindRecordQuery, Request, SaveRecordMutation, RequestCacheRequestState, RequestStateService } from "./-private/network/request-cache.js";
|
|
10
10
|
export type { CreateRecordProperties } from "./-private/store-service.js";
|
|
11
|
-
// TODO this should be a deprecated helper but we have so much usage of it
|
|
12
|
-
// to also eliminate
|
|
13
11
|
export { coerceId, ensureStringId } from "./-private/utils/coerce-id.js";
|
|
14
12
|
export type { NativeProxy } from "./-private/record-arrays/native-proxy-type-fix.js";
|
|
15
|
-
export {
|
|
13
|
+
export { type ReactiveResourceArray, type PrivateReactiveResourceArray } from "./-private/record-arrays/resource-array.js";
|
|
14
|
+
export { type LegacyLiveArray, type LegacyLiveArray as LiveArray } from "./-private/record-arrays/legacy-live-array.js";
|
|
15
|
+
export { type LegacyQueryArray, type LegacyQueryArray as CollectionRecordArray } from "./-private/record-arrays/legacy-query.js";
|
|
16
16
|
export { RecordArrayManager, fastPush } from "./-private/managers/record-array-manager.js";
|
|
17
|
-
|
|
17
|
+
export { assertPrivateStore, isPrivateStore, type PrivateStore } from "./-private/store-service.js";
|
|
18
|
+
export { assertPrivateCapabilities, type PrivateCacheCapabilitiesManager } from "./-private/managers/cache-capabilities-manager.js";
|
|
18
19
|
export { _clearCaches } from "./-private/caches/instance-cache.js";
|
|
19
|
-
export { peekCache, removeRecordDataFor } from "./-private/caches/cache-utils.js";
|
|
20
|
-
// @ember-data/model needs these temporarily
|
|
21
20
|
export { setRecordIdentifier, StoreMap } from "./-private/caches/instance-cache.js";
|
|
22
|
-
export { setCacheFor } from "./-private/caches/cache-utils.js";
|
|
23
21
|
export { normalizeModelName as _deprecatingNormalize } from "./-private/utils/normalize-model-name.js";
|
|
24
22
|
export type { StoreRequestInput } from "./-private/cache-handler/handler.js";
|
|
25
|
-
export { RelatedCollection } from "./-private/record-arrays/many-array.js";
|
|
23
|
+
export { type LegacyManyArray, type LegacyManyArray as RelatedCollection, createLegacyManyArray } from "./-private/record-arrays/legacy-many-array.js";
|
|
26
24
|
export { log, logGroup } from "./-private/debug/utils.js";
|
|
27
25
|
export { getPromiseState, type PromiseState } from "./-private/new-core-tmp/promise-state.js";
|
|
28
|
-
export { DISPOSE, createRequestSubscription, type SubscriptionArgs, type RequestSubscription } from "./-private/new-core-tmp/request-subscription.js";
|
|
26
|
+
export { DISPOSE, createRequestSubscription, type RequestArgs, type SubscriptionArgs, type RequestComponentArgs, type RequestSubscription, type ContentFeatures, type RecoveryFeatures, type AutorefreshBehaviorCombos, type AutorefreshBehaviorType } from "./-private/new-core-tmp/request-subscription.js";
|
|
29
27
|
export { getRequestState, type RequestLoadingState, type RequestCacheRequestState as RequestState } from "./-private/new-core-tmp/request-state.js";
|
|
30
|
-
export {
|
|
31
|
-
export { memoized, gate, entangleSignal, defineSignal, defineGate, defineNonEnumerableSignal } from "./-private/new-core-tmp/reactivity/signal.js";
|
|
32
|
-
export { ARRAY_SIGNAL, OBJECT_SIGNAL, Signals, type WarpDriveSignal, peekInternalSignal, withSignalStore, notifyInternalSignal, consumeInternalSignal, getOrCreateInternalSignal } from "./-private/new-core-tmp/reactivity/internal.js";
|
|
28
|
+
export { type SignalHooks, waitFor } from "./-private/new-core-tmp/reactivity/configure.js";
|
|
29
|
+
export { signal, memoized, gate, entangleSignal, entangleInitiallyStaleSignal, defineSignal, defineGate, defineNonEnumerableSignal } from "./-private/new-core-tmp/reactivity/signal.js";
|
|
30
|
+
export { ARRAY_SIGNAL, OBJECT_SIGNAL, Signals, type WarpDriveSignal, peekInternalSignal, createInternalMemo, withSignalStore, notifyInternalSignal, consumeInternalSignal, getOrCreateInternalSignal } from "./-private/new-core-tmp/reactivity/internal.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
|
|
2
|
+
import type { CacheKeyManager } from "../../-private/managers/cache-key-manager.js";
|
|
3
3
|
import type { NotificationType } from "../../-private/managers/notification-manager.js";
|
|
4
4
|
import type { SchemaService } from "./schema-service.js";
|
|
5
5
|
/**
|
|
@@ -11,22 +11,21 @@ import type { SchemaService } from "./schema-service.js";
|
|
|
11
11
|
*
|
|
12
12
|
* This class cannot be directly instantiated.
|
|
13
13
|
*
|
|
14
|
-
* @class CacheCapabilitiesManager
|
|
15
14
|
* @public
|
|
16
15
|
*/
|
|
17
16
|
export type CacheCapabilitiesManager = {
|
|
18
17
|
/**
|
|
19
|
-
* Provides access to the
|
|
18
|
+
* Provides access to the CacheKeyManager instance
|
|
20
19
|
* for this Store instance.
|
|
21
20
|
*
|
|
22
|
-
* The
|
|
21
|
+
* The CacheKeyManager can be used to peek, generate or
|
|
23
22
|
* retrieve a stable unique identifier for any resource.
|
|
24
23
|
*
|
|
25
|
-
* @property identifierCache
|
|
26
|
-
* @type {IdentifierCache}
|
|
27
24
|
* @public
|
|
28
25
|
*/
|
|
29
|
-
|
|
26
|
+
cacheKeyManager: CacheKeyManager;
|
|
27
|
+
/** @deprecated use {@link CacheCapabilitiesManager.cacheKeyManager} */
|
|
28
|
+
identifierCache: CacheKeyManager;
|
|
30
29
|
/**
|
|
31
30
|
* DEPRECATED - use the schema property
|
|
32
31
|
*
|
|
@@ -36,7 +35,7 @@ export type CacheCapabilitiesManager = {
|
|
|
36
35
|
* The SchemaService can be used to query for
|
|
37
36
|
* information about the schema of a resource.
|
|
38
37
|
*
|
|
39
|
-
* @deprecated
|
|
38
|
+
* @deprecated use {@link CacheCapabilitiesManager.schema}
|
|
40
39
|
* @public
|
|
41
40
|
*/
|
|
42
41
|
getSchemaDefinitionService(): SchemaService;
|
|
@@ -55,30 +54,25 @@ export type CacheCapabilitiesManager = {
|
|
|
55
54
|
* Update the `id` for the record corresponding to the identifier
|
|
56
55
|
* This operation can only be done for records whose `id` is `null`.
|
|
57
56
|
*
|
|
58
|
-
* @param {StableRecordIdentifier} identifier;
|
|
59
|
-
* @param {String} id;
|
|
60
57
|
* @public
|
|
61
58
|
*/
|
|
62
|
-
setRecordId(identifier:
|
|
59
|
+
setRecordId(identifier: ResourceKey, id: string): void;
|
|
63
60
|
/**
|
|
64
61
|
* Signal to the store that the specified record may be considered fully
|
|
65
62
|
* removed from the cache. Generally this means that not only does no
|
|
66
63
|
* data exist for the identified resource, no known relationships still
|
|
67
64
|
* point to it either.
|
|
68
65
|
*
|
|
69
|
-
* @param {StableRecordIdentifier} identifier
|
|
70
66
|
* @public
|
|
71
67
|
*/
|
|
72
|
-
disconnectRecord(identifier:
|
|
68
|
+
disconnectRecord(identifier: ResourceKey): void;
|
|
73
69
|
/**
|
|
74
70
|
* Use this method to determine if the Store has an instantiated record associated
|
|
75
71
|
* with an identifier.
|
|
76
72
|
*
|
|
77
|
-
* @param identifier
|
|
78
|
-
* @return {Boolean}
|
|
79
73
|
* @public
|
|
80
74
|
*/
|
|
81
|
-
hasRecord(identifier:
|
|
75
|
+
hasRecord(identifier: ResourceKey): boolean;
|
|
82
76
|
/**
|
|
83
77
|
* Notify subscribers of the NotificationManager that cache state has changed.
|
|
84
78
|
*
|
|
@@ -87,13 +81,10 @@ export type CacheCapabilitiesManager = {
|
|
|
87
81
|
*
|
|
88
82
|
* No other namespaces currently expect the `key` argument.
|
|
89
83
|
*
|
|
90
|
-
* @param {StableRecordIdentifier} identifier
|
|
91
|
-
* @param {'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'} namespace
|
|
92
|
-
* @param {string|undefined} key
|
|
93
84
|
* @public
|
|
94
85
|
*/
|
|
95
|
-
notifyChange(identifier:
|
|
96
|
-
notifyChange(identifier:
|
|
97
|
-
notifyChange(identifier:
|
|
98
|
-
notifyChange(identifier:
|
|
86
|
+
notifyChange(identifier: ResourceKey, namespace: "added" | "removed", key: null): void;
|
|
87
|
+
notifyChange(identifier: RequestKey, namespace: "added" | "updated" | "removed", key: null): void;
|
|
88
|
+
notifyChange(identifier: ResourceKey, namespace: NotificationType, key: string | null): void;
|
|
89
|
+
notifyChange(identifier: ResourceKey | RequestKey, namespace: NotificationType | "added" | "removed" | "updated", key: string | null): void;
|
|
99
90
|
};
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CacheKeyType, RequestKey, ResourceKey } from "../../../types/identifier.js";
|
|
2
2
|
import type { ImmutableRequestInfo } from "../../../types/request.js";
|
|
3
3
|
export interface GenerationMethod {
|
|
4
4
|
(data: ImmutableRequestInfo, bucket: "document"): string | null;
|
|
5
5
|
(data: unknown | {
|
|
6
6
|
type: string;
|
|
7
7
|
}, bucket: "record"): string;
|
|
8
|
-
(data: unknown, bucket:
|
|
8
|
+
(data: unknown, bucket: CacheKeyType): string | null;
|
|
9
9
|
}
|
|
10
10
|
export type UpdateMethod = {
|
|
11
|
-
(identifier:
|
|
12
|
-
(identifier:
|
|
11
|
+
(identifier: ResourceKey, newData: unknown, bucket: "record"): void;
|
|
12
|
+
(identifier: RequestKey, newData: unknown, bucket: "document"): void;
|
|
13
|
+
(identifier: {
|
|
14
|
+
lid: string;
|
|
15
|
+
}, newData: unknown, bucket: never): void;
|
|
13
16
|
};
|
|
14
|
-
export type ForgetMethod = (identifier:
|
|
17
|
+
export type ForgetMethod = (identifier: RequestKey | ResourceKey, bucket: CacheKeyType) => void;
|
|
15
18
|
export type ResetMethod = () => void;
|
|
16
19
|
export type KeyInfo = {
|
|
17
20
|
id: string | null;
|
|
18
21
|
type: string;
|
|
19
22
|
};
|
|
20
|
-
export type KeyInfoMethod = (resource: unknown, known:
|
|
23
|
+
export type KeyInfoMethod = (resource: unknown, known: ResourceKey | null) => KeyInfo;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "../../../reactive.js";
|
|
2
2
|
import type { ExtensibleField } from "../../../reactive/-private/schema.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResourceKey } from "../../../types/identifier.js";
|
|
4
4
|
import type { ObjectValue } from "../../../types/json/raw.js";
|
|
5
5
|
import type { Derivation, HashFn, Transformation } from "../../../types/schema/concepts.js";
|
|
6
6
|
import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "../../../types/schema/fields.js";
|
|
@@ -74,7 +74,7 @@ export interface SchemaService {
|
|
|
74
74
|
*
|
|
75
75
|
* @public
|
|
76
76
|
*/
|
|
77
|
-
hasResource(resource: ObjectWithStringTypeProperty |
|
|
77
|
+
hasResource(resource: ObjectWithStringTypeProperty | ResourceKey): boolean;
|
|
78
78
|
/**
|
|
79
79
|
* Queries whether the SchemaService recognizes `type` as a resource trait
|
|
80
80
|
*
|
|
@@ -86,7 +86,7 @@ export interface SchemaService {
|
|
|
86
86
|
*
|
|
87
87
|
* @public
|
|
88
88
|
*/
|
|
89
|
-
resourceHasTrait(resource: ObjectWithStringTypeProperty |
|
|
89
|
+
resourceHasTrait(resource: ObjectWithStringTypeProperty | ResourceKey, trait: string): boolean;
|
|
90
90
|
/**
|
|
91
91
|
* Queries for the fields of a given resource type or resource identity.
|
|
92
92
|
*
|
|
@@ -94,7 +94,7 @@ export interface SchemaService {
|
|
|
94
94
|
*
|
|
95
95
|
* @public
|
|
96
96
|
*/
|
|
97
|
-
fields(resource: ObjectWithStringTypeProperty |
|
|
97
|
+
fields(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, FieldSchema>;
|
|
98
98
|
/**
|
|
99
99
|
* Queries for the fields of a given resource type or resource identity.
|
|
100
100
|
*
|
|
@@ -102,7 +102,7 @@ export interface SchemaService {
|
|
|
102
102
|
*
|
|
103
103
|
* @public
|
|
104
104
|
*/
|
|
105
|
-
cacheFields?(resource: ObjectWithStringTypeProperty |
|
|
105
|
+
cacheFields?(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
106
106
|
/**
|
|
107
107
|
* Returns the transformation registered with the name provided
|
|
108
108
|
* by `field.type`. Validates that the field is a valid transformable.
|
|
@@ -129,7 +129,7 @@ export interface SchemaService {
|
|
|
129
129
|
*
|
|
130
130
|
* @public
|
|
131
131
|
*/
|
|
132
|
-
resource(resource: ObjectWithStringTypeProperty |
|
|
132
|
+
resource(resource: ObjectWithStringTypeProperty | ResourceKey): Schema;
|
|
133
133
|
/**
|
|
134
134
|
* Enables registration of multiple Schemas at once.
|
|
135
135
|
*
|
|
@@ -253,7 +253,7 @@ export interface SchemaService {
|
|
|
253
253
|
* @public
|
|
254
254
|
* @deprecated
|
|
255
255
|
*/
|
|
256
|
-
attributesDefinitionFor?(
|
|
256
|
+
attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
|
|
257
257
|
/**
|
|
258
258
|
* DEPRECATED - use `fields` instead
|
|
259
259
|
*
|
|
@@ -332,7 +332,7 @@ export interface SchemaService {
|
|
|
332
332
|
* @public
|
|
333
333
|
* @deprecated
|
|
334
334
|
*/
|
|
335
|
-
relationshipsDefinitionFor?(
|
|
335
|
+
relationshipsDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): RelationshipsSchema;
|
|
336
336
|
/**
|
|
337
337
|
* Returns all known resource types
|
|
338
338
|
*
|
|
@@ -350,7 +350,7 @@ export interface SchemaService {
|
|
|
350
350
|
*
|
|
351
351
|
* @public
|
|
352
352
|
*/
|
|
353
|
-
CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource:
|
|
353
|
+
CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: ResourceKey | {
|
|
354
354
|
type: string;
|
|
355
355
|
}): null | ProcessedExtension["features"];
|
|
356
356
|
/**
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Value } from "../../../types/json/raw.js";
|
|
2
|
-
|
|
3
|
-
export interface BaseFinderOptions<T = unknown> {
|
|
2
|
+
export interface BaseFinderOptions {
|
|
4
3
|
reload?: boolean;
|
|
5
4
|
backgroundReload?: boolean;
|
|
6
|
-
include?:
|
|
5
|
+
include?: string | string[];
|
|
7
6
|
adapterOptions?: Record<string, unknown>;
|
|
8
7
|
}
|
|
9
|
-
export interface FindRecordOptions
|
|
8
|
+
export interface FindRecordOptions extends BaseFinderOptions {
|
|
10
9
|
/**
|
|
11
10
|
* Data to preload into the store before the request is made.
|
|
12
11
|
* This feature is *highly* discouraged and has no corresponding
|
|
@@ -25,8 +24,8 @@ export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
|
|
|
25
24
|
preload?: Record<string, Value>;
|
|
26
25
|
}
|
|
27
26
|
export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
|
|
28
|
-
export type FindAllOptions
|
|
29
|
-
export type LegacyResourceQuery
|
|
30
|
-
include?:
|
|
27
|
+
export type FindAllOptions = BaseFinderOptions;
|
|
28
|
+
export type LegacyResourceQuery = {
|
|
29
|
+
include?: string | string[];
|
|
31
30
|
[key: string]: Value | undefined;
|
|
32
31
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NewResourceKey, ResourceKey } from "../../types/identifier.js";
|
|
2
2
|
import type { Value } from "../../types/json/raw.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
|
|
4
4
|
import type { LegacyAttributeField, LegacyRelationshipField } from "../../types/schema/fields.js";
|
|
5
5
|
import type { SingleResourceDocument } from "../../types/spec/json-api-raw.js";
|
|
6
6
|
import { type InstanceCache } from "../-private.js";
|
|
7
7
|
import type { Store } from "./store.js";
|
|
8
|
-
export declare function preloadData(store: Store, identifier:
|
|
9
|
-
export interface BaseFinderOptions
|
|
8
|
+
export declare function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void;
|
|
9
|
+
export interface BaseFinderOptions {
|
|
10
10
|
reload?: boolean;
|
|
11
11
|
backgroundReload?: boolean;
|
|
12
|
-
include?:
|
|
12
|
+
include?: string | string[];
|
|
13
13
|
adapterOptions?: Record<string, unknown>;
|
|
14
14
|
}
|
|
15
|
-
export interface FindRecordOptions
|
|
15
|
+
export interface FindRecordOptions extends BaseFinderOptions {
|
|
16
16
|
/**
|
|
17
17
|
* Data to preload into the store before the request is made.
|
|
18
18
|
* This feature is *highly* discouraged and has no corresponding
|
|
@@ -31,9 +31,9 @@ export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
|
|
|
31
31
|
preload?: Record<string, Value>;
|
|
32
32
|
}
|
|
33
33
|
export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
|
|
34
|
-
export type FindAllOptions
|
|
35
|
-
export type LegacyResourceQuery
|
|
36
|
-
include?:
|
|
34
|
+
export type FindAllOptions = BaseFinderOptions;
|
|
35
|
+
export type LegacyResourceQuery = {
|
|
36
|
+
include?: string | string[];
|
|
37
37
|
[key: string]: Value | undefined;
|
|
38
38
|
};
|
|
39
39
|
export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
|
|
@@ -55,7 +55,7 @@ export interface ModelSchema<T = unknown> {
|
|
|
55
55
|
eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
|
|
56
56
|
eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
|
|
57
57
|
}
|
|
58
|
-
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier:
|
|
58
|
+
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean;
|
|
59
59
|
/**
|
|
60
60
|
A `RecordReference` is a low-level API that allows users and
|
|
61
61
|
addon authors to perform meta-operations on a record.
|
|
@@ -64,18 +64,7 @@ addon authors to perform meta-operations on a record.
|
|
|
64
64
|
@public
|
|
65
65
|
*/
|
|
66
66
|
export declare class RecordReference {
|
|
67
|
-
|
|
68
|
-
private store;
|
|
69
|
-
// unsubscribe token given to us by the notification manager
|
|
70
|
-
/** @internal */
|
|
71
|
-
private ___token;
|
|
72
|
-
/** @internal */
|
|
73
|
-
private ___identifier;
|
|
74
|
-
/** @internal */
|
|
75
|
-
private _ref;
|
|
76
|
-
constructor(store: Store, identifier: StableRecordIdentifier);
|
|
77
|
-
/** @internal */
|
|
78
|
-
destroy(): void;
|
|
67
|
+
constructor(store: Store, identifier: ResourceKey);
|
|
79
68
|
get type(): string;
|
|
80
69
|
/**
|
|
81
70
|
The `id` of the record that this reference refers to.
|
|
@@ -112,7 +101,7 @@ export declare class RecordReference {
|
|
|
112
101
|
@public
|
|
113
102
|
@return The identifier of the record.
|
|
114
103
|
*/
|
|
115
|
-
identifier():
|
|
104
|
+
identifier(): ResourceKey;
|
|
116
105
|
/**
|
|
117
106
|
How the reference will be looked up when it is loaded. Currently
|
|
118
107
|
this always returns `identity` to signify that a record will be
|
|
@@ -221,7 +210,6 @@ export declare class RecordReference {
|
|
|
221
210
|
reload(): Promise<unknown>;
|
|
222
211
|
}
|
|
223
212
|
export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
|
|
224
|
-
// Mimics the static apis of @ember-data/model
|
|
225
213
|
export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
|
|
226
214
|
__store: Store;
|
|
227
215
|
modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { TypeFromInstance } from "../../types/record.js";
|
|
2
2
|
import type { ResourceIdentifierObject } from "../../types/spec/json-api-raw.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { LegacyLiveArray, LegacyQueryArray } from "../-private.js";
|
|
4
4
|
import { Store } from "../-private/store-service.js";
|
|
5
5
|
import type { FindAllOptions, FindRecordOptions, LegacyResourceQuery, ModelSchema, QueryOptions } from "./-private.js";
|
|
6
6
|
import { RecordReference } from "./-private.js";
|
|
7
|
-
/////////////// IMPORTANT ///////////////////
|
|
8
|
-
///// Move Module Augmentation Into The /////
|
|
9
|
-
///// Legacy Package Once Removed Here /////
|
|
10
|
-
/////////////////////////////////////////////
|
|
11
7
|
declare module "../-private/store-service" {
|
|
12
8
|
interface Store {
|
|
13
9
|
/**
|
|
@@ -363,11 +359,11 @@ declare module "../-private/store-service" {
|
|
|
363
359
|
@param id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved
|
|
364
360
|
@param options - if the first param is a string this will be the optional options for the request. See examples for available options.
|
|
365
361
|
*/
|
|
366
|
-
findRecord<T>(type: TypeFromInstance<T>, id: string | number, options?: FindRecordOptions
|
|
362
|
+
findRecord<T>(type: TypeFromInstance<T>, id: string | number, options?: FindRecordOptions): Promise<T>;
|
|
367
363
|
/** @deprecated */
|
|
368
364
|
findRecord(type: string, id: string | number, options?: FindRecordOptions): Promise<unknown>;
|
|
369
365
|
/** @deprecated */
|
|
370
|
-
findRecord<T>(resource: ResourceIdentifierObject<TypeFromInstance<T>>, options?: FindRecordOptions
|
|
366
|
+
findRecord<T>(resource: ResourceIdentifierObject<TypeFromInstance<T>>, options?: FindRecordOptions): Promise<T>;
|
|
371
367
|
/** @deprecated */
|
|
372
368
|
findRecord(resource: ResourceIdentifierObject, options?: FindRecordOptions): Promise<unknown>;
|
|
373
369
|
/**
|
|
@@ -548,9 +544,9 @@ declare module "../-private/store-service" {
|
|
|
548
544
|
@param type the name of the resource
|
|
549
545
|
@param options
|
|
550
546
|
*/
|
|
551
|
-
findAll<T>(type: TypeFromInstance<T>, options?: FindAllOptions
|
|
547
|
+
findAll<T>(type: TypeFromInstance<T>, options?: FindAllOptions): Promise<LegacyLiveArray<T>>;
|
|
552
548
|
/** @deprecated */
|
|
553
|
-
findAll(type: string, options?: FindAllOptions): Promise<
|
|
549
|
+
findAll(type: string, options?: FindAllOptions): Promise<LegacyLiveArray>;
|
|
554
550
|
/**
|
|
555
551
|
This method delegates a query to the adapter. This is the one place where
|
|
556
552
|
adapter-level semantics are exposed to the application.
|
|
@@ -565,13 +561,13 @@ declare module "../-private/store-service" {
|
|
|
565
561
|
|
|
566
562
|
If you do something like this:
|
|
567
563
|
|
|
568
|
-
```
|
|
564
|
+
```js
|
|
569
565
|
store.query('person', { page: 1 });
|
|
570
566
|
```
|
|
571
567
|
|
|
572
568
|
The request made to the server will look something like this:
|
|
573
569
|
|
|
574
|
-
```
|
|
570
|
+
```http
|
|
575
571
|
GET "/api/v1/person?page=1"
|
|
576
572
|
```
|
|
577
573
|
|
|
@@ -591,8 +587,7 @@ declare module "../-private/store-service" {
|
|
|
591
587
|
```
|
|
592
588
|
|
|
593
589
|
This method returns a promise, which is resolved with a
|
|
594
|
-
|
|
595
|
-
once the server returns.
|
|
590
|
+
{@link LegacyQueryArray} once the server returns.
|
|
596
591
|
|
|
597
592
|
@public
|
|
598
593
|
@deprecated use {@link Store.request} instead
|
|
@@ -602,9 +597,9 @@ declare module "../-private/store-service" {
|
|
|
602
597
|
@param query a query to be used by the adapter
|
|
603
598
|
@param options optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
604
599
|
*/
|
|
605
|
-
query<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery
|
|
600
|
+
query<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryOptions): Promise<LegacyQueryArray<T>>;
|
|
606
601
|
/** @deprecated */
|
|
607
|
-
query(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<
|
|
602
|
+
query(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<LegacyQueryArray>;
|
|
608
603
|
/**
|
|
609
604
|
This method makes a request for one record, where the `id` is not known
|
|
610
605
|
beforehand (if the `id` is known, use [`findRecord`](../methods/findRecord?anchor=findRecord)
|
|
@@ -704,7 +699,7 @@ declare module "../-private/store-service" {
|
|
|
704
699
|
@param options optional, may include `adapterOptions` hash which will be passed to adapter.queryRecord
|
|
705
700
|
@return promise which resolves with the found record or `null`
|
|
706
701
|
*/
|
|
707
|
-
queryRecord<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery
|
|
702
|
+
queryRecord<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryOptions): Promise<T | null>;
|
|
708
703
|
/** @deprecated */
|
|
709
704
|
queryRecord(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<unknown | null>;
|
|
710
705
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type UniversalTransientKey = "REQ_ID";
|
|
2
2
|
type UniversalKey = `(transient) ${UniversalTransientKey}` | "RequestMap" | "PromiseCache" | "RequestCache" | "SkipCache" | "EnableHydration" | "WarpDriveRuntimeConfig";
|
|
3
3
|
type TransientKey = "transactionRef" | "configuredGenerationMethod" | "configuredUpdateMethod" | "configuredForgetMethod" | "configuredResetMethod" | "configuredKeyInfoMethod" | "signalHooks";
|
|
4
|
-
type GlobalKey = `(transient) ${TransientKey}` | "AdapterError" | "InvalidError" | "TimeoutError" | "AbortError" | "UnauthorizedError" | "ForbiddenError" | "NotFoundError" | "ConflictError" | "ServerError" | "#{}" | "#[]" | "Signals" | "AvailableShims" | "FAKE_ARR" | "#source" | "#update" | "#notify" | "IS_COLLECTION" | "Touching" | "RequestPromise" | "SaveOp" | "LEGACY_SUPPORT" | "LegacySupport" | "Graphs" | "IS_FROZEN" | "IS_CACHE_HANDLER" | "CONFIG" | "DEBUG_MAP" | "IDENTIFIERS" | "DOCUMENTS" | "
|
|
4
|
+
type GlobalKey = `(transient) ${TransientKey}` | "AdapterError" | "InvalidError" | "TimeoutError" | "AbortError" | "UnauthorizedError" | "ForbiddenError" | "NotFoundError" | "ConflictError" | "ServerError" | "#{}" | "#[]" | "Signals" | "AvailableShims" | "FAKE_ARR" | "#source" | "#update" | "#notify" | "IS_COLLECTION" | "Touching" | "RequestPromise" | "SaveOp" | "LEGACY_SUPPORT" | "LegacySupport" | "Graphs" | "IS_FROZEN" | "IS_CACHE_HANDLER" | "CONFIG" | "DEBUG_MAP" | "IDENTIFIERS" | "DOCUMENTS" | "RecordCache" | "StoreMap" | "Store" | "$type" | "TransformName" | "RequestSignature" | "IS_FUTURE" | "DOC" | "ManagedArrayMap" | "ManagedObjectMap" | "Support" | "SOURCE" | "Destroy" | "Checkout" | "Commit" | "Context";
|
|
5
5
|
type UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;
|
|
6
6
|
type UniqueSymbolOr<
|
|
7
7
|
T,
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
// The ResourceBlob is an opaque type that must
|
|
2
|
-
// satisfy two constraints.
|
|
3
|
-
// (1) it should be possible for the IdentifierCache
|
|
4
|
-
// to be able to generate a RecordIdentifier for it
|
|
5
|
-
// whether by default or due to configuration.
|
|
6
|
-
// (2) it should be in a format expected by the Cache.
|
|
7
|
-
// This format is Cache declared.
|
|
8
|
-
//
|
|
9
|
-
// this Opaqueness allows arbitrary storage of any
|
|
10
|
-
// serializable / transferable state including such things
|
|
11
|
-
// as Buffers and Strings.
|
|
12
1
|
export type ResourceBlob = unknown;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RequestKey, ResourceKey } from "../identifier.js";
|
|
2
2
|
export interface Change {
|
|
3
|
-
identifier:
|
|
3
|
+
identifier: ResourceKey | RequestKey;
|
|
4
4
|
op: "upsert" | "remove";
|
|
5
5
|
patch?: unknown;
|
|
6
6
|
}
|
|
@@ -1,62 +1,38 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResourceKey } from "../identifier.js";
|
|
2
2
|
export interface AddToResourceRelationshipMutation {
|
|
3
3
|
op: "add";
|
|
4
|
-
record:
|
|
4
|
+
record: ResourceKey;
|
|
5
5
|
field: string;
|
|
6
|
-
value:
|
|
6
|
+
value: ResourceKey | ResourceKey[];
|
|
7
7
|
index?: number;
|
|
8
8
|
}
|
|
9
9
|
export interface RemoveFromResourceRelationshipMutation {
|
|
10
10
|
op: "remove";
|
|
11
|
-
record:
|
|
11
|
+
record: ResourceKey;
|
|
12
12
|
field: string;
|
|
13
|
-
value:
|
|
13
|
+
value: ResourceKey | ResourceKey[];
|
|
14
14
|
index?: number;
|
|
15
15
|
}
|
|
16
16
|
export interface ReplaceRelatedRecordMutation {
|
|
17
17
|
op: "replaceRelatedRecord";
|
|
18
|
-
record:
|
|
18
|
+
record: ResourceKey;
|
|
19
19
|
field: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// if field is a collection,
|
|
23
|
-
// the value we are swapping with
|
|
24
|
-
prior?: StableRecordIdentifier;
|
|
20
|
+
value: ResourceKey | null;
|
|
21
|
+
prior?: ResourceKey;
|
|
25
22
|
index?: number;
|
|
26
23
|
}
|
|
27
24
|
export interface ReplaceRelatedRecordsMutation {
|
|
28
25
|
op: "replaceRelatedRecords";
|
|
29
|
-
record:
|
|
26
|
+
record: ResourceKey;
|
|
30
27
|
field: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
value: StableRecordIdentifier[];
|
|
34
|
-
// if this is a "splice" the
|
|
35
|
-
// records we expect to be removed
|
|
36
|
-
prior?: StableRecordIdentifier[];
|
|
37
|
-
// if this is a "splice" the
|
|
38
|
-
// index to start from
|
|
28
|
+
value: ResourceKey[];
|
|
29
|
+
prior?: ResourceKey[];
|
|
39
30
|
index?: number;
|
|
40
31
|
}
|
|
41
32
|
export interface SortRelatedRecordsMutation {
|
|
42
33
|
op: "sortRelatedRecords";
|
|
43
|
-
record:
|
|
34
|
+
record: ResourceKey;
|
|
44
35
|
field: string;
|
|
45
|
-
value:
|
|
36
|
+
value: ResourceKey[];
|
|
46
37
|
}
|
|
47
|
-
// A Mutation is an action that updates
|
|
48
|
-
// the local state of the Cache in some
|
|
49
|
-
// manner.
|
|
50
|
-
// Most Mutations are in theory also
|
|
51
|
-
// Operations; with the difference being
|
|
52
|
-
// that the change should be applied as
|
|
53
|
-
// "local" or "dirty" state instead of
|
|
54
|
-
// as "remote" or "clean" state.
|
|
55
|
-
//
|
|
56
|
-
// Note: this RFC does not publicly surface
|
|
57
|
-
// any of the mutations listed here as
|
|
58
|
-
// "operations", though the (private) Graph
|
|
59
|
-
// already expects and utilizes these.
|
|
60
|
-
// and we look forward to an RFC that makes
|
|
61
|
-
// the Graph a fully public API.
|
|
62
38
|
export type Mutation = ReplaceRelatedRecordsMutation | ReplaceRelatedRecordMutation | RemoveFromResourceRelationshipMutation | AddToResourceRelationshipMutation | SortRelatedRecordsMutation;
|