@warp-drive/core 5.6.0-alpha.15 → 5.6.0-alpha.18
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/build-config/babel-macros.d.ts +1 -2
- package/declarations/build-config/canary-features.d.ts +1 -2
- package/declarations/build-config/debugging.d.ts +1 -2
- package/declarations/build-config/deprecations.d.ts +1 -2
- package/declarations/build-config/env.d.ts +1 -2
- package/declarations/build-config/macros.d.ts +1 -2
- package/declarations/build-config.d.ts +1 -2
- package/declarations/configure.d.ts +6 -7
- package/declarations/graph/-private/-diff.d.ts +21 -22
- package/declarations/graph/-private/-edge-definition.d.ts +134 -135
- package/declarations/graph/-private/-state.d.ts +93 -7
- package/declarations/graph/-private/-utils.d.ts +18 -13
- package/declarations/graph/-private/coerce-id.d.ts +6 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +15 -4
- package/declarations/graph/-private/edges/collection.d.ts +35 -36
- package/declarations/graph/-private/edges/implicit.d.ts +28 -29
- package/declarations/graph/-private/edges/resource.d.ts +19 -20
- package/declarations/graph/-private/graph.d.ts +83 -48
- package/declarations/graph/-private/normalize-link.d.ts +7 -2
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/merge-identifier.d.ts +2 -3
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/replace-related-record.d.ts +2 -3
- package/declarations/graph/-private/operations/replace-related-records.d.ts +58 -4
- package/declarations/graph/-private/operations/update-relationship.d.ts +11 -9
- package/declarations/graph/-private.d.ts +9 -10
- package/declarations/index.d.ts +11 -12
- package/declarations/reactive/-private/document.d.ts +143 -144
- package/declarations/reactive/-private/fields/compute.d.ts +31 -28
- package/declarations/reactive/-private/fields/extension.d.ts +2 -3
- package/declarations/reactive/-private/fields/managed-array.d.ts +19 -20
- package/declarations/reactive/-private/fields/managed-object.d.ts +16 -16
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +15 -16
- package/declarations/reactive/-private/hooks.d.ts +3 -4
- package/declarations/reactive/-private/record.d.ts +61 -59
- package/declarations/reactive/-private/schema.d.ts +242 -224
- package/declarations/reactive/-private/symbols.d.ts +26 -1
- package/declarations/reactive/-private.d.ts +1 -2
- package/declarations/reactive.d.ts +4 -5
- package/declarations/request/-private/context.d.ts +34 -35
- package/declarations/request/-private/debug.d.ts +2 -3
- package/declarations/request/-private/fetch.d.ts +23 -24
- package/declarations/request/-private/future.d.ts +3 -4
- package/declarations/request/-private/manager.d.ts +159 -157
- package/declarations/request/-private/promise-cache.d.ts +21 -13
- package/declarations/request/-private/types.d.ts +124 -124
- package/declarations/request/-private/utils.d.ts +8 -9
- package/declarations/request.d.ts +5 -6
- package/declarations/store/-private/cache-handler/handler.d.ts +57 -52
- package/declarations/store/-private/cache-handler/types.d.ts +95 -96
- package/declarations/store/-private/cache-handler/utils.d.ts +16 -16
- package/declarations/store/-private/caches/cache-utils.d.ts +7 -4
- package/declarations/store/-private/caches/identifier-cache.d.ts +234 -246
- package/declarations/store/-private/caches/instance-cache.d.ts +47 -47
- package/declarations/store/-private/caches/resource-utils.d.ts +3 -4
- package/declarations/store/-private/debug/utils.d.ts +6 -7
- package/declarations/store/-private/default-cache-policy.d.ts +362 -361
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +154 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +14 -14
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +21 -22
- package/declarations/store/-private/managers/cache-manager.d.ts +440 -425
- package/declarations/store/-private/managers/notification-manager.d.ts +88 -83
- package/declarations/store/-private/managers/record-array-manager.d.ts +89 -90
- package/declarations/store/-private/network/request-cache.d.ts +86 -83
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +252 -244
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +154 -155
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +148 -149
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +28 -23
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +263 -241
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +253 -223
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +125 -121
- package/declarations/store/-private/record-arrays/many-array.d.ts +180 -184
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +120 -110
- package/declarations/store/-private/store-service.d.ts +1594 -1586
- package/declarations/store/-private/utils/coerce-id.d.ts +6 -1
- package/declarations/store/-private/utils/construct-resource.d.ts +1 -2
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/declarations/store/-private.d.ts +31 -28
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +96 -97
- package/declarations/store/-types/q/ds-model.d.ts +17 -18
- package/declarations/store/-types/q/identifier.d.ts +11 -12
- package/declarations/store/-types/q/record-instance.d.ts +16 -17
- package/declarations/store/-types/q/schema-service.d.ts +346 -343
- package/declarations/store/-types/q/store.d.ts +25 -28
- package/declarations/store.d.ts +1 -2
- package/declarations/types/-private.d.ts +16 -8
- package/declarations/types/cache/aliases.d.ts +11 -1
- package/declarations/types/cache/change.d.ts +4 -5
- package/declarations/types/cache/mutations.d.ts +51 -28
- package/declarations/types/cache/operations.d.ts +60 -47
- package/declarations/types/cache/relationship.d.ts +11 -9
- package/declarations/types/cache.d.ts +495 -484
- package/declarations/types/graph.d.ts +31 -32
- package/declarations/types/identifier.d.ts +83 -82
- package/declarations/types/json/raw.d.ts +1 -2
- package/declarations/types/params.d.ts +4 -5
- package/declarations/types/record.d.ts +117 -76
- package/declarations/types/request.d.ts +289 -266
- package/declarations/types/runtime.d.ts +8 -9
- package/declarations/types/schema/concepts.d.ts +19 -13
- package/declarations/types/schema/fields.d.ts +1712 -1713
- package/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/declarations/types/spec/document.d.ts +28 -22
- package/declarations/types/spec/error.d.ts +16 -17
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/symbols.d.ts +74 -75
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types.d.ts +10 -11
- package/declarations/utils/string.d.ts +43 -40
- package/dist/graph/-private.js +1 -1
- package/dist/{handler-D1C3Innj.js → handler-C2T-IyJK.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +42 -73
- package/dist/{request-state-CCOJIj5i.js → request-state-CjLph1LP.js} +275 -261
- package/dist/store/-private.js +2 -2
- package/dist/{symbols-epHW0Vm9.js → symbols-SIstXMLI.js} +1 -1
- package/dist/types/-private.js +1 -1
- package/package.json +4 -4
- package/declarations/build-config/babel-macros.d.ts.map +0 -1
- package/declarations/build-config/canary-features.d.ts.map +0 -1
- package/declarations/build-config/debugging.d.ts.map +0 -1
- package/declarations/build-config/deprecations.d.ts.map +0 -1
- package/declarations/build-config/env.d.ts.map +0 -1
- package/declarations/build-config/macros.d.ts.map +0 -1
- package/declarations/build-config.d.ts.map +0 -1
- package/declarations/configure.d.ts.map +0 -1
- package/declarations/graph/-private/-diff.d.ts.map +0 -1
- package/declarations/graph/-private/-edge-definition.d.ts.map +0 -1
- package/declarations/graph/-private/-state.d.ts.map +0 -1
- package/declarations/graph/-private/-utils.d.ts.map +0 -1
- package/declarations/graph/-private/coerce-id.d.ts.map +0 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
- package/declarations/graph/-private/edges/collection.d.ts.map +0 -1
- package/declarations/graph/-private/edges/implicit.d.ts.map +0 -1
- package/declarations/graph/-private/edges/resource.d.ts.map +0 -1
- package/declarations/graph/-private/graph.d.ts.map +0 -1
- package/declarations/graph/-private/normalize-link.d.ts.map +0 -1
- package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/merge-identifier.d.ts.map +0 -1
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-record.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/update-relationship.d.ts.map +0 -1
- package/declarations/graph/-private.d.ts.map +0 -1
- package/declarations/index.d.ts.map +0 -1
- package/declarations/reactive/-private/document.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/compute.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/extension.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-array.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-object.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +0 -1
- package/declarations/reactive/-private/hooks.d.ts.map +0 -1
- package/declarations/reactive/-private/record.d.ts.map +0 -1
- package/declarations/reactive/-private/schema.d.ts.map +0 -1
- package/declarations/reactive/-private/symbols.d.ts.map +0 -1
- package/declarations/reactive/-private.d.ts.map +0 -1
- package/declarations/reactive.d.ts.map +0 -1
- package/declarations/request/-private/context.d.ts.map +0 -1
- package/declarations/request/-private/debug.d.ts.map +0 -1
- package/declarations/request/-private/fetch.d.ts.map +0 -1
- package/declarations/request/-private/future.d.ts.map +0 -1
- package/declarations/request/-private/manager.d.ts.map +0 -1
- package/declarations/request/-private/promise-cache.d.ts.map +0 -1
- package/declarations/request/-private/types.d.ts.map +0 -1
- package/declarations/request/-private/utils.d.ts.map +0 -1
- package/declarations/request.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/handler.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/types.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/cache-utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/identifier-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/instance-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/resource-utils.d.ts.map +0 -1
- package/declarations/store/-private/debug/utils.d.ts.map +0 -1
- package/declarations/store/-private/default-cache-policy.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/notification-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/record-array-manager.d.ts.map +0 -1
- package/declarations/store/-private/network/request-cache.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/many-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
- package/declarations/store/-private/store-service.d.ts.map +0 -1
- package/declarations/store/-private/store-service.type-test.d.ts +0 -2
- package/declarations/store/-private/store-service.type-test.d.ts.map +0 -1
- package/declarations/store/-private/utils/coerce-id.d.ts.map +0 -1
- package/declarations/store/-private/utils/construct-resource.d.ts.map +0 -1
- package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts.map +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +0 -1
- package/declarations/store/-private.d.ts.map +0 -1
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-types/q/ds-model.d.ts.map +0 -1
- package/declarations/store/-types/q/identifier.d.ts.map +0 -1
- package/declarations/store/-types/q/promise-proxies.d.ts +0 -2
- package/declarations/store/-types/q/promise-proxies.d.ts.map +0 -1
- package/declarations/store/-types/q/record-data-json-api.d.ts +0 -31
- package/declarations/store/-types/q/record-data-json-api.d.ts.map +0 -1
- package/declarations/store/-types/q/record-instance.d.ts.map +0 -1
- package/declarations/store/-types/q/schema-service.d.ts.map +0 -1
- package/declarations/store/-types/q/store.d.ts.map +0 -1
- package/declarations/store.d.ts.map +0 -1
- package/declarations/types/-private.d.ts.map +0 -1
- package/declarations/types/cache/aliases.d.ts.map +0 -1
- package/declarations/types/cache/change.d.ts.map +0 -1
- package/declarations/types/cache/mutations.d.ts.map +0 -1
- package/declarations/types/cache/operations.d.ts.map +0 -1
- package/declarations/types/cache/relationship.d.ts.map +0 -1
- package/declarations/types/cache.d.ts.map +0 -1
- package/declarations/types/graph.d.ts.map +0 -1
- package/declarations/types/identifier.d.ts.map +0 -1
- package/declarations/types/json/raw.d.ts.map +0 -1
- package/declarations/types/params.d.ts.map +0 -1
- package/declarations/types/record.d.ts.map +0 -1
- package/declarations/types/record.type-test.d.ts +0 -2
- package/declarations/types/record.type-test.d.ts.map +0 -1
- package/declarations/types/request.d.ts.map +0 -1
- package/declarations/types/request.type-test.d.ts +0 -2
- package/declarations/types/request.type-test.d.ts.map +0 -1
- package/declarations/types/runtime.d.ts.map +0 -1
- package/declarations/types/schema/concepts.d.ts.map +0 -1
- package/declarations/types/schema/fields.d.ts.map +0 -1
- package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
- package/declarations/types/spec/document.d.ts.map +0 -1
- package/declarations/types/spec/error.d.ts.map +0 -1
- package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
- package/declarations/types/symbols.d.ts.map +0 -1
- package/declarations/types/utils.d.ts.map +0 -1
- package/declarations/types.d.ts.map +0 -1
- package/declarations/utils/string.d.ts.map +0 -1
- package/dist/build-config/babel-macros.js.map +0 -1
- package/dist/build-config/canary-features.js.map +0 -1
- package/dist/build-config/debugging.js.map +0 -1
- package/dist/build-config/deprecations.js.map +0 -1
- package/dist/build-config/env.js.map +0 -1
- package/dist/build-config/macros.js.map +0 -1
- package/dist/build-config.js.map +0 -1
- package/dist/configure-B48bFHOl.js.map +0 -1
- package/dist/configure.js.map +0 -1
- package/dist/context-COmAnXUQ.js.map +0 -1
- package/dist/graph/-private.js.map +0 -1
- package/dist/handler-D1C3Innj.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/reactive/-private.js.map +0 -1
- package/dist/reactive.js.map +0 -1
- package/dist/request-state-CCOJIj5i.js.map +0 -1
- package/dist/request.js.map +0 -1
- package/dist/store/-private.js.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/symbols-epHW0Vm9.js.map +0 -1
- package/dist/types/-private.js.map +0 -1
- package/dist/types/cache/aliases.js.map +0 -1
- package/dist/types/cache/change.js.map +0 -1
- package/dist/types/cache/mutations.js.map +0 -1
- package/dist/types/cache/operations.js.map +0 -1
- package/dist/types/cache/relationship.js.map +0 -1
- package/dist/types/cache.js.map +0 -1
- package/dist/types/graph.js.map +0 -1
- package/dist/types/identifier.js.map +0 -1
- package/dist/types/json/raw.js.map +0 -1
- package/dist/types/params.js.map +0 -1
- package/dist/types/record.js.map +0 -1
- package/dist/types/request.js.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/types/schema/concepts.js.map +0 -1
- package/dist/types/schema/fields.js.map +0 -1
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/types/spec/document.js.map +0 -1
- package/dist/types/spec/error.js.map +0 -1
- package/dist/types/spec/json-api-raw.js.map +0 -1
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/string.js.map +0 -1
|
@@ -1,492 +1,503 @@
|
|
|
1
|
-
import type { ResourceBlob } from
|
|
2
|
-
import type { Change } from
|
|
3
|
-
import type { Mutation } from
|
|
4
|
-
import type { Operation } from
|
|
5
|
-
import type { CollectionRelationship, ResourceRelationship } from
|
|
6
|
-
import type { StableDocumentIdentifier, StableRecordIdentifier } from
|
|
7
|
-
import type { Value } from
|
|
8
|
-
import type { TypeFromInstanceOrString } from
|
|
9
|
-
import type { RequestContext, StructuredDataDocument, StructuredDocument } from
|
|
10
|
-
import type { ResourceDocument, SingleResourceDataDocument } from
|
|
11
|
-
import type { ApiError } from
|
|
1
|
+
import type { ResourceBlob } from "./cache/aliases.js";
|
|
2
|
+
import type { Change } from "./cache/change.js";
|
|
3
|
+
import type { Mutation } from "./cache/mutations.js";
|
|
4
|
+
import type { Operation } from "./cache/operations.js";
|
|
5
|
+
import type { CollectionRelationship, ResourceRelationship } from "./cache/relationship.js";
|
|
6
|
+
import type { StableDocumentIdentifier, StableRecordIdentifier } from "./identifier.js";
|
|
7
|
+
import type { Value } from "./json/raw.js";
|
|
8
|
+
import type { TypeFromInstanceOrString } from "./record.js";
|
|
9
|
+
import type { RequestContext, StructuredDataDocument, StructuredDocument } from "./request.js";
|
|
10
|
+
import type { ResourceDocument, SingleResourceDataDocument } from "./spec/document.js";
|
|
11
|
+
import type { ApiError } from "./spec/error.js";
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
* A hash of changed attributes with the key being the attribute name and the value being an
|
|
14
|
+
* array of `[oldValue, newValue]`.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
18
|
export type ChangedAttributesHash = Record<string, [Value | undefined, Value]>;
|
|
19
19
|
export type RelationshipDiff = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
kind: "collection";
|
|
21
|
+
remoteState: StableRecordIdentifier[];
|
|
22
|
+
additions: Set<StableRecordIdentifier>;
|
|
23
|
+
removals: Set<StableRecordIdentifier>;
|
|
24
|
+
localState: StableRecordIdentifier[];
|
|
25
|
+
reordered: boolean;
|
|
26
26
|
} | {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
kind: "resource";
|
|
28
|
+
remoteState: StableRecordIdentifier | null;
|
|
29
|
+
localState: StableRecordIdentifier | null;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
* The interface for WarpDrive Caches.
|
|
33
|
+
*
|
|
34
|
+
* A Cache handles in-memory storage of Document and Resource
|
|
35
|
+
* data.
|
|
36
|
+
*
|
|
37
|
+
* @class (Interface) Cache
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
40
|
export interface Cache {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The Cache Version that this implementation implements.
|
|
43
|
+
*
|
|
44
|
+
* @type {'2'}
|
|
45
|
+
* @public
|
|
46
|
+
* @property version
|
|
47
|
+
*/
|
|
48
|
+
version: "2";
|
|
49
|
+
// Cache Management
|
|
50
|
+
// ================
|
|
51
|
+
/**
|
|
52
|
+
* Cache the response to a request
|
|
53
|
+
*
|
|
54
|
+
* Unlike `store.push` which has UPSERT
|
|
55
|
+
* semantics, `put` has `replace` semantics similar to
|
|
56
|
+
* the `http` method `PUT`
|
|
57
|
+
*
|
|
58
|
+
* the individually cacheable resource data it may contain
|
|
59
|
+
* should upsert, but the document data surrounding it should
|
|
60
|
+
* fully replace any existing information
|
|
61
|
+
*
|
|
62
|
+
* Note that in order to support inserting arbitrary data
|
|
63
|
+
* to the cache that did not originate from a request `put`
|
|
64
|
+
* should expect to sometimes encounter a document with only
|
|
65
|
+
* a `content` member and therefor must not assume the existence
|
|
66
|
+
* of `request` and `response` on the document.
|
|
67
|
+
*
|
|
68
|
+
* @param {StructuredDocument} doc
|
|
69
|
+
* @return {ResourceDocument}
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
put<T>(doc: StructuredDocument<T> | {
|
|
73
|
+
content: T;
|
|
74
|
+
}): ResourceDocument;
|
|
75
|
+
/**
|
|
76
|
+
* Update the "remote" or "canonical" (persisted) state of the Cache
|
|
77
|
+
* by merging new information into the existing state.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
* @param {Operation | Operation[]} op the operation(s) to perform
|
|
81
|
+
* @return {void}
|
|
82
|
+
*/
|
|
83
|
+
patch(op: Operation | Operation[]): void;
|
|
84
|
+
/**
|
|
85
|
+
* Update the "local" or "current" (unpersisted) state of the Cache
|
|
86
|
+
*
|
|
87
|
+
* @param {Mutation} mutation
|
|
88
|
+
* @return {void}
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
mutate(mutation: Mutation): void;
|
|
92
|
+
/**
|
|
93
|
+
* Peek resource data from the Cache.
|
|
94
|
+
*
|
|
95
|
+
* In development, if the return value
|
|
96
|
+
* is JSON the return value
|
|
97
|
+
* will be deep-cloned and deep-frozen
|
|
98
|
+
* to prevent mutation thereby enforcing cache
|
|
99
|
+
* Immutability.
|
|
100
|
+
*
|
|
101
|
+
* This form of peek is useful for implementations
|
|
102
|
+
* that want to feed raw-data from cache to the UI
|
|
103
|
+
* or which want to interact with a blob of data
|
|
104
|
+
* directly from the presentation cache.
|
|
105
|
+
*
|
|
106
|
+
* An implementation might want to do this because
|
|
107
|
+
* de-referencing records which read from their own
|
|
108
|
+
* blob is generally safer because the record does
|
|
109
|
+
* not require retainining connections to the Store
|
|
110
|
+
* and Cache to present data on a per-field basis.
|
|
111
|
+
*
|
|
112
|
+
* This generally takes the place of `getAttr` as
|
|
113
|
+
* an API and may even take the place of `getRelationship`
|
|
114
|
+
* depending on implementation specifics, though this
|
|
115
|
+
* latter usage is less recommended due to the advantages
|
|
116
|
+
* of the Graph handling necessary entanglements and
|
|
117
|
+
* notifications for relational data.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
* @param {StableRecordIdentifier | StableDocumentIdentifier} identifier
|
|
121
|
+
* @return {ResourceDocument | ResourceBlob | null} the known resource data
|
|
122
|
+
*/
|
|
123
|
+
peek<T = unknown>(identifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>): T | null;
|
|
124
|
+
peek(identifier: StableDocumentIdentifier): ResourceDocument | null;
|
|
125
|
+
/**
|
|
126
|
+
* Peek remote resource data from the Cache.
|
|
127
|
+
*
|
|
128
|
+
* This will give the data provided from the server without any local changes.
|
|
129
|
+
*
|
|
130
|
+
* In development, if the return value
|
|
131
|
+
* is JSON the return value
|
|
132
|
+
* will be deep-cloned and deep-frozen
|
|
133
|
+
* to prevent mutation thereby enforcing cache
|
|
134
|
+
* Immutability.
|
|
135
|
+
*
|
|
136
|
+
* This form of peek is useful for implementations
|
|
137
|
+
* that want to feed raw-data from cache to the UI
|
|
138
|
+
* or which want to interact with a blob of data
|
|
139
|
+
* directly from the presentation cache.
|
|
140
|
+
*
|
|
141
|
+
* An implementation might want to do this because
|
|
142
|
+
* de-referencing records which read from their own
|
|
143
|
+
* blob is generally safer because the record does
|
|
144
|
+
* not require retainining connections to the Store
|
|
145
|
+
* and Cache to present data on a per-field basis.
|
|
146
|
+
*
|
|
147
|
+
* This generally takes the place of `getAttr` as
|
|
148
|
+
* an API and may even take the place of `getRelationship`
|
|
149
|
+
* depending on implementation specifics, though this
|
|
150
|
+
* latter usage is less recommended due to the advantages
|
|
151
|
+
* of the Graph handling necessary entanglements and
|
|
152
|
+
* notifications for relational data.
|
|
153
|
+
*
|
|
154
|
+
* @public
|
|
155
|
+
* @param {StableRecordIdentifier | StableDocumentIdentifier} identifier
|
|
156
|
+
* @return {ResourceDocument | ResourceBlob | null} the known resource data
|
|
157
|
+
*/
|
|
158
|
+
peekRemoteState<T = unknown>(identifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>): T | null;
|
|
159
|
+
peekRemoteState(identifier: StableDocumentIdentifier): ResourceDocument | null;
|
|
160
|
+
/**
|
|
161
|
+
* Peek the Cache for the existing request data associated with
|
|
162
|
+
* a cacheable request
|
|
163
|
+
*
|
|
164
|
+
* This is effectively the reverse of `put` for a request in
|
|
165
|
+
* that it will return the the request, response, and content
|
|
166
|
+
* whereas `peek` will return just the `content`.
|
|
167
|
+
*
|
|
168
|
+
* @param {StableDocumentIdentifier}
|
|
169
|
+
* @return {StructuredDocument<ResourceDocument> | null}
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
peekRequest(identifier: StableDocumentIdentifier): StructuredDocument<ResourceDocument> | null;
|
|
173
|
+
/**
|
|
174
|
+
* Push resource data from a remote source into the cache for this identifier
|
|
175
|
+
*
|
|
176
|
+
* @public
|
|
177
|
+
* @param identifier
|
|
178
|
+
* @param data
|
|
179
|
+
* @param hasRecord
|
|
180
|
+
* @return {void | string[]} if `hasRecord` is true then calculated key changes should be returned
|
|
181
|
+
*/
|
|
182
|
+
upsert(identifier: StableRecordIdentifier, data: ResourceBlob, hasRecord: boolean): void | string[];
|
|
183
|
+
// Cache Forking Support
|
|
184
|
+
// =====================
|
|
185
|
+
/**
|
|
186
|
+
* Create a fork of the cache from the current state.
|
|
187
|
+
*
|
|
188
|
+
* Applications should typically not call this method themselves,
|
|
189
|
+
* preferring instead to fork at the Store level, which will
|
|
190
|
+
* utilize this method to fork the cache.
|
|
191
|
+
*
|
|
192
|
+
* @public
|
|
193
|
+
* @return {Promise<Cache>}
|
|
194
|
+
*/
|
|
195
|
+
fork(): Promise<Cache>;
|
|
196
|
+
/**
|
|
197
|
+
* Merge a fork back into a parent Cache.
|
|
198
|
+
*
|
|
199
|
+
* Applications should typically not call this method themselves,
|
|
200
|
+
* preferring instead to merge at the Store level, which will
|
|
201
|
+
* utilize this method to merge the caches.
|
|
202
|
+
*
|
|
203
|
+
* @param {Cache} cache
|
|
204
|
+
* @public
|
|
205
|
+
* @return {Promise<void>}
|
|
206
|
+
*/
|
|
207
|
+
merge(cache: Cache): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Generate the list of changes applied to all
|
|
210
|
+
* record in the store.
|
|
211
|
+
*
|
|
212
|
+
* Each individual resource or document that has
|
|
213
|
+
* been mutated should be described as an individual
|
|
214
|
+
* `Change` entry in the returned array.
|
|
215
|
+
*
|
|
216
|
+
* A `Change` is described by an object containing up to
|
|
217
|
+
* three properties: (1) the `identifier` of the entity that
|
|
218
|
+
* changed; (2) the `op` code of that change being one of
|
|
219
|
+
* `upsert` or `remove`, and if the op is `upsert` a `patch`
|
|
220
|
+
* containing the data to merge into the cache for the given
|
|
221
|
+
* entity.
|
|
222
|
+
*
|
|
223
|
+
* This `patch` is opaque to the Store but should be understood
|
|
224
|
+
* by the Cache and may expect to be utilized by an Adapter
|
|
225
|
+
* when generating data during a `save` operation.
|
|
226
|
+
*
|
|
227
|
+
* It is generally recommended that the `patch` contain only
|
|
228
|
+
* the updated state, ignoring fields that are unchanged
|
|
229
|
+
*
|
|
230
|
+
* ```ts
|
|
231
|
+
* interface Change {
|
|
232
|
+
* identifier: StableRecordIdentifier | StableDocumentIdentifier;
|
|
233
|
+
* op: 'upsert' | 'remove';
|
|
234
|
+
* patch?: unknown;
|
|
235
|
+
* }
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
240
|
+
diff(): Promise<Change[]>;
|
|
241
|
+
// SSR Support
|
|
242
|
+
// ===========
|
|
243
|
+
/**
|
|
244
|
+
* Serialize the entire contents of the Cache into a Stream
|
|
245
|
+
* which may be fed back into a new instance of the same Cache
|
|
246
|
+
* via `cache.hydrate`.
|
|
247
|
+
*
|
|
248
|
+
* @return {Promise<ReadableStream>}
|
|
249
|
+
* @public
|
|
250
|
+
*/
|
|
251
|
+
dump(): Promise<ReadableStream<unknown>>;
|
|
252
|
+
/**
|
|
253
|
+
* hydrate a Cache from a Stream with content previously serialized
|
|
254
|
+
* from another instance of the same Cache, resolving when hydration
|
|
255
|
+
* is complete.
|
|
256
|
+
*
|
|
257
|
+
* This method should expect to be called both in the context of restoring
|
|
258
|
+
* the Cache during application rehydration after SSR **AND** at unknown
|
|
259
|
+
* times during the lifetime of an already booted application when it is
|
|
260
|
+
* desired to bulk-load additional information into the cache. This latter
|
|
261
|
+
* behavior supports optimizing pre/fetching of data for route transitions
|
|
262
|
+
* via data-only SSR modes.
|
|
263
|
+
*
|
|
264
|
+
* @param {ReadableStream} stream
|
|
265
|
+
* @return {Promise<void>}
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
hydrate(stream: ReadableStream<unknown>): Promise<void>;
|
|
269
|
+
// Resource Support
|
|
270
|
+
// ================
|
|
271
|
+
/**
|
|
272
|
+
* [LIFECYCLE] Signal to the cache that a new record has been instantiated on the client
|
|
273
|
+
*
|
|
274
|
+
* It returns properties from options that should be set on the record during the create
|
|
275
|
+
* process. This return value behavior is deprecated.
|
|
276
|
+
*
|
|
277
|
+
* @public
|
|
278
|
+
* @param identifier
|
|
279
|
+
* @param createArgs
|
|
280
|
+
*/
|
|
281
|
+
clientDidCreate(identifier: StableRecordIdentifier, createArgs?: Record<string, unknown>): Record<string, unknown>;
|
|
282
|
+
/**
|
|
283
|
+
* [LIFECYCLE] Signals to the cache that a resource
|
|
284
|
+
* will be part of a save transaction.
|
|
285
|
+
*
|
|
286
|
+
* @public
|
|
287
|
+
* @param identifier
|
|
288
|
+
*/
|
|
289
|
+
willCommit(identifier: StableRecordIdentifier, context: RequestContext): void;
|
|
290
|
+
/**
|
|
291
|
+
* [LIFECYCLE] Signals to the cache that a resource
|
|
292
|
+
* was successfully updated as part of a save transaction.
|
|
293
|
+
*
|
|
294
|
+
* @public
|
|
295
|
+
* @param identifier - the primary identifier that was operated on
|
|
296
|
+
* @param data - a document in the cache format containing any updated data
|
|
297
|
+
* @return {SingleResourceDataDocument}
|
|
298
|
+
*/
|
|
299
|
+
didCommit(identifier: StableRecordIdentifier, result: StructuredDataDocument<unknown>): SingleResourceDataDocument;
|
|
300
|
+
/**
|
|
301
|
+
* [LIFECYCLE] Signals to the cache that a resource
|
|
302
|
+
* was update via a save transaction failed.
|
|
303
|
+
*
|
|
304
|
+
* @public
|
|
305
|
+
* @param identifier
|
|
306
|
+
* @param errors
|
|
307
|
+
*/
|
|
308
|
+
commitWasRejected(identifier: StableRecordIdentifier, errors?: ApiError[]): void;
|
|
309
|
+
/**
|
|
310
|
+
* [LIFECYCLE] Signals to the cache that all data for a resource
|
|
311
|
+
* should be cleared.
|
|
312
|
+
*
|
|
313
|
+
* This method is a candidate to become a mutation
|
|
314
|
+
*
|
|
315
|
+
* @public
|
|
316
|
+
* @param identifier
|
|
317
|
+
*/
|
|
318
|
+
unloadRecord(identifier: StableRecordIdentifier): void;
|
|
319
|
+
// Granular Resource Data APIs
|
|
320
|
+
// ===========================
|
|
321
|
+
/**
|
|
322
|
+
* Retrieve the data for an attribute from the cache
|
|
323
|
+
*
|
|
324
|
+
* @public
|
|
325
|
+
* @param identifier
|
|
326
|
+
* @param field
|
|
327
|
+
* @return {unknown}
|
|
328
|
+
*/
|
|
329
|
+
getAttr(identifier: StableRecordIdentifier, field: string | string[]): Value | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* Retrieve remote state without any local changes for a specific attribute
|
|
332
|
+
*
|
|
333
|
+
* @public
|
|
334
|
+
* @param identifier
|
|
335
|
+
* @param field
|
|
336
|
+
* @return {unknown}
|
|
337
|
+
*/
|
|
338
|
+
getRemoteAttr(identifier: StableRecordIdentifier, field: string | string[]): Value | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* Mutate the data for an attribute in the cache
|
|
341
|
+
*
|
|
342
|
+
* This method is a candidate to become a mutation
|
|
343
|
+
*
|
|
344
|
+
* @public
|
|
345
|
+
* @param identifier
|
|
346
|
+
* @param field
|
|
347
|
+
* @param value
|
|
348
|
+
*/
|
|
349
|
+
setAttr(identifier: StableRecordIdentifier, field: string | string[], value: Value): void;
|
|
350
|
+
/**
|
|
351
|
+
* Query the cache for the changed attributes of a resource.
|
|
352
|
+
*
|
|
353
|
+
* Returns a map of field names to tuples of [old, new] values
|
|
354
|
+
*
|
|
355
|
+
* ```
|
|
356
|
+
* { <field>: [<old>, <new>] }
|
|
357
|
+
* ```
|
|
358
|
+
*
|
|
359
|
+
* @public
|
|
360
|
+
* @param identifier
|
|
361
|
+
* @return {Record<string, [unknown, unknown]>} `{ <field>: [<old>, <new>] }`
|
|
362
|
+
*/
|
|
363
|
+
changedAttrs(identifier: StableRecordIdentifier): ChangedAttributesHash;
|
|
364
|
+
/**
|
|
365
|
+
* Query the cache for whether any mutated attributes exist
|
|
366
|
+
*
|
|
367
|
+
* @public
|
|
368
|
+
* @param identifier
|
|
369
|
+
* @return {Boolean}
|
|
370
|
+
*/
|
|
371
|
+
hasChangedAttrs(identifier: StableRecordIdentifier): boolean;
|
|
372
|
+
/**
|
|
373
|
+
* Tell the cache to discard any uncommitted mutations to attributes
|
|
374
|
+
*
|
|
375
|
+
* This method is a candidate to become a mutation
|
|
376
|
+
*
|
|
377
|
+
* @public
|
|
378
|
+
* @param identifier
|
|
379
|
+
* @return {String[]} the names of fields that were restored
|
|
380
|
+
*/
|
|
381
|
+
rollbackAttrs(identifier: StableRecordIdentifier): string[];
|
|
382
|
+
/**
|
|
383
|
+
* Query the cache for the changes to relationships of a resource.
|
|
384
|
+
*
|
|
385
|
+
* Returns a map of relationship names to RelationshipDiff objects.
|
|
386
|
+
*
|
|
387
|
+
* ```ts
|
|
388
|
+
* type RelationshipDiff =
|
|
389
|
+
| {
|
|
390
|
+
kind: 'collection';
|
|
391
|
+
remoteState: StableRecordIdentifier[];
|
|
392
|
+
additions: Set<StableRecordIdentifier>;
|
|
393
|
+
removals: Set<StableRecordIdentifier>;
|
|
394
|
+
localState: StableRecordIdentifier[];
|
|
395
|
+
reordered: boolean;
|
|
396
|
+
}
|
|
397
|
+
| {
|
|
398
|
+
kind: 'resource';
|
|
399
|
+
remoteState: StableRecordIdentifier | null;
|
|
400
|
+
localState: StableRecordIdentifier | null;
|
|
401
|
+
};
|
|
402
|
+
```
|
|
403
|
+
*
|
|
404
|
+
* @public
|
|
405
|
+
* @param {StableRecordIdentifier} identifier
|
|
406
|
+
* @return {Map<string, RelationshipDiff>}
|
|
407
|
+
*/
|
|
408
|
+
changedRelationships(identifier: StableRecordIdentifier): Map<string, RelationshipDiff>;
|
|
409
|
+
/**
|
|
410
|
+
* Query the cache for whether any mutated attributes exist
|
|
411
|
+
*
|
|
412
|
+
* @public
|
|
413
|
+
* @param {StableRecordIdentifier} identifier
|
|
414
|
+
* @return {Boolean}
|
|
415
|
+
*/
|
|
416
|
+
hasChangedRelationships(identifier: StableRecordIdentifier): boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Tell the cache to discard any uncommitted mutations to relationships.
|
|
419
|
+
*
|
|
420
|
+
* This will also discard the change on any appropriate inverses.
|
|
421
|
+
*
|
|
422
|
+
* This method is a candidate to become a mutation
|
|
423
|
+
*
|
|
424
|
+
* @public
|
|
425
|
+
* @param {StableRecordIdentifier} identifier
|
|
426
|
+
* @return {String[]} the names of relationships that were restored
|
|
427
|
+
*/
|
|
428
|
+
rollbackRelationships(identifier: StableRecordIdentifier): string[];
|
|
429
|
+
/**
|
|
430
|
+
* Query the cache for the current state of a relationship property
|
|
431
|
+
*
|
|
432
|
+
* @public
|
|
433
|
+
* @param {StableRecordIdentifier} identifier
|
|
434
|
+
* @param {String} field
|
|
435
|
+
* @return resource relationship object
|
|
436
|
+
*/
|
|
437
|
+
getRelationship(identifier: StableRecordIdentifier, field: string, isCollection?: boolean): ResourceRelationship | CollectionRelationship;
|
|
438
|
+
/**
|
|
439
|
+
* Query the cache for the server state of a relationship property without any local changes
|
|
440
|
+
*
|
|
441
|
+
* @public
|
|
442
|
+
* @param {StableRecordIdentifier} identifier
|
|
443
|
+
* @param {String} field
|
|
444
|
+
* @return resource relationship object
|
|
445
|
+
*/
|
|
446
|
+
getRemoteRelationship(identifier: StableRecordIdentifier, field: string, isCollection?: boolean): ResourceRelationship | CollectionRelationship;
|
|
447
|
+
// Resource State
|
|
448
|
+
// ===============
|
|
449
|
+
/**
|
|
450
|
+
* Update the cache state for the given resource to be marked
|
|
451
|
+
* as locally deleted, or remove such a mark.
|
|
452
|
+
*
|
|
453
|
+
* This method is a candidate to become a mutation
|
|
454
|
+
*
|
|
455
|
+
* @public
|
|
456
|
+
* @param identifier
|
|
457
|
+
* @param {Boolean} isDeleted
|
|
458
|
+
*/
|
|
459
|
+
setIsDeleted(identifier: StableRecordIdentifier, isDeleted: boolean): void;
|
|
460
|
+
/**
|
|
461
|
+
* Query the cache for any validation errors applicable to the given resource.
|
|
462
|
+
*
|
|
463
|
+
* @public
|
|
464
|
+
* @param identifier
|
|
465
|
+
* @return {JsonApiError[]}
|
|
466
|
+
*/
|
|
467
|
+
getErrors(identifier: StableRecordIdentifier): ApiError[];
|
|
468
|
+
/**
|
|
469
|
+
* Query the cache for whether a given resource has any available data
|
|
470
|
+
*
|
|
471
|
+
* @public
|
|
472
|
+
* @param identifier
|
|
473
|
+
* @return {Boolean}
|
|
474
|
+
*/
|
|
475
|
+
isEmpty(identifier: StableRecordIdentifier): boolean;
|
|
476
|
+
/**
|
|
477
|
+
* Query the cache for whether a given resource was created locally and not
|
|
478
|
+
* yet persisted.
|
|
479
|
+
*
|
|
480
|
+
* @public
|
|
481
|
+
* @param identifier
|
|
482
|
+
* @return {Boolean}
|
|
483
|
+
*/
|
|
484
|
+
isNew(identifier: StableRecordIdentifier): boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Query the cache for whether a given resource is marked as deleted (but not
|
|
487
|
+
* necessarily persisted yet).
|
|
488
|
+
*
|
|
489
|
+
* @public
|
|
490
|
+
* @param identifier
|
|
491
|
+
* @return {Boolean}
|
|
492
|
+
*/
|
|
493
|
+
isDeleted(identifier: StableRecordIdentifier): boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Query the cache for whether a given resource has been deleted and that deletion
|
|
496
|
+
* has also been persisted.
|
|
497
|
+
*
|
|
498
|
+
* @public
|
|
499
|
+
* @param identifier
|
|
500
|
+
* @return {Boolean}
|
|
501
|
+
*/
|
|
502
|
+
isDeletionCommitted(identifier: StableRecordIdentifier): boolean;
|
|
491
503
|
}
|
|
492
|
-
//# sourceMappingURL=cache.d.ts.map
|