@warp-drive/core 5.6.0-alpha.15 → 5.6.0-alpha.17
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,40 +1,39 @@
|
|
|
1
|
-
import type { CollectionRelationship } from
|
|
2
|
-
import type { StableRecordIdentifier } from
|
|
3
|
-
import type { Links, Meta, PaginationLinks } from
|
|
4
|
-
import type { UpgradedMeta } from
|
|
5
|
-
import type { RelationshipState } from
|
|
1
|
+
import type { CollectionRelationship } from "../../../types/cache/relationship.js";
|
|
2
|
+
import type { StableRecordIdentifier } from "../../../types/identifier.js";
|
|
3
|
+
import type { Links, Meta, PaginationLinks } from "../../../types/spec/json-api-raw.js";
|
|
4
|
+
import type { UpgradedMeta } from "../-edge-definition.js";
|
|
5
|
+
import type { RelationshipState } from "../-state.js";
|
|
6
6
|
export interface CollectionEdge {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
7
|
+
definition: UpgradedMeta;
|
|
8
|
+
identifier: StableRecordIdentifier;
|
|
9
|
+
state: RelationshipState;
|
|
10
|
+
remoteMembers: Set<StableRecordIdentifier>;
|
|
11
|
+
remoteState: StableRecordIdentifier[];
|
|
12
|
+
additions: Set<StableRecordIdentifier> | null;
|
|
13
|
+
removals: Set<StableRecordIdentifier> | null;
|
|
14
|
+
meta: Meta | null;
|
|
15
|
+
links: Links | PaginationLinks | null;
|
|
16
|
+
localState: StableRecordIdentifier[] | null;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the localState for this edge is out-of-sync
|
|
19
|
+
* with the remoteState.
|
|
20
|
+
*
|
|
21
|
+
* if state.hasReceivedData=false we are also
|
|
22
|
+
* not dirty since there is nothing to sync with.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
isDirty: boolean;
|
|
26
|
+
transactionRef: number;
|
|
27
|
+
/**
|
|
28
|
+
* Whether data for this edge has been accessed at least once
|
|
29
|
+
* via `graph.getData`
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
accessed: boolean;
|
|
33
|
+
_diff?: {
|
|
34
|
+
add: Set<StableRecordIdentifier>;
|
|
35
|
+
del: Set<StableRecordIdentifier>;
|
|
36
|
+
};
|
|
37
37
|
}
|
|
38
38
|
export declare function createCollectionEdge(definition: UpgradedMeta, identifier: StableRecordIdentifier): CollectionEdge;
|
|
39
39
|
export declare function legacyGetCollectionRelationshipData(source: CollectionEdge, getRemoteState: boolean): CollectionRelationship;
|
|
40
|
-
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import type { StableRecordIdentifier } from
|
|
2
|
-
import type { UpgradedMeta } from
|
|
1
|
+
import type { StableRecordIdentifier } from "../../../types/identifier.js";
|
|
2
|
+
import type { UpgradedMeta } from "../-edge-definition.js";
|
|
3
3
|
export type ImplicitMeta = UpgradedMeta & {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
kind: "implicit";
|
|
5
|
+
isImplicit: true;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Implicit relationships are relationships which have not been declared but the inverse side exists on
|
|
9
|
+
another record somewhere
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
For example consider the following two models
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
::: code-group
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
```js [./models/comment.js]
|
|
16
|
+
import { Model, attr } from '@warp-drive/legacy/model';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export default class Comment extends Model {
|
|
19
|
+
@attr text;
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
```js [./models/post.js]
|
|
24
|
+
import { Model, attr, hasMany } from '@warp-drive/legacy/model';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export default class Post extends Model {
|
|
27
|
+
@attr title;
|
|
28
|
+
@hasMany('comment', { async: true, inverse: null }) comments;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
:::
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
Then we would have a implicit 'post' relationship for the comment record in order
|
|
35
|
+
to be do things like remove the comment from the post if the comment were to be deleted.
|
|
36
36
|
*/
|
|
37
37
|
export interface ImplicitEdge {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
definition: ImplicitMeta;
|
|
39
|
+
identifier: StableRecordIdentifier;
|
|
40
|
+
localMembers: Set<StableRecordIdentifier>;
|
|
41
|
+
remoteMembers: Set<StableRecordIdentifier>;
|
|
42
42
|
}
|
|
43
43
|
export declare function createImplicitEdge(definition: ImplicitMeta, identifier: StableRecordIdentifier): ImplicitEdge;
|
|
44
|
-
//# sourceMappingURL=implicit.d.ts.map
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import type { ResourceRelationship } from
|
|
2
|
-
import type { StableRecordIdentifier } from
|
|
3
|
-
import type { Links, Meta, PaginationLinks } from
|
|
4
|
-
import type { UpgradedMeta } from
|
|
5
|
-
import type { RelationshipState } from
|
|
1
|
+
import type { ResourceRelationship } from "../../../types/cache/relationship.js";
|
|
2
|
+
import type { StableRecordIdentifier } from "../../../types/identifier.js";
|
|
3
|
+
import type { Links, Meta, PaginationLinks } from "../../../types/spec/json-api-raw.js";
|
|
4
|
+
import type { UpgradedMeta } from "../-edge-definition.js";
|
|
5
|
+
import type { RelationshipState } from "../-state.js";
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
* Stores the data for one side of a "single" resource relationship.
|
|
8
|
+
*
|
|
9
|
+
* @class ResourceEdge
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
12
|
export interface ResourceEdge {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
definition: UpgradedMeta;
|
|
14
|
+
identifier: StableRecordIdentifier;
|
|
15
|
+
state: RelationshipState;
|
|
16
|
+
localState: StableRecordIdentifier | null;
|
|
17
|
+
remoteState: StableRecordIdentifier | null;
|
|
18
|
+
meta: Meta | null;
|
|
19
|
+
links: Links | PaginationLinks | null;
|
|
20
|
+
transactionRef: number;
|
|
21
|
+
accessed: boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare function createResourceEdge(definition: UpgradedMeta, identifier: StableRecordIdentifier): ResourceEdge;
|
|
24
24
|
export declare function legacyGetResourceRelationshipData(source: ResourceEdge, getRemoteState: boolean): ResourceRelationship;
|
|
25
|
-
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -1,55 +1,90 @@
|
|
|
1
|
-
import type { CacheCapabilitiesManager, StableRecordIdentifier } from
|
|
2
|
-
import type { RelationshipDiff } from
|
|
3
|
-
import type { MergeOperation } from
|
|
4
|
-
import type { CollectionRelationship, ResourceRelationship } from
|
|
5
|
-
import type { DeleteRecordOperation, LocalRelationshipOperation, RemoteRelationshipOperation } from
|
|
6
|
-
import type { EdgeCache, UpgradedMeta } from
|
|
7
|
-
import { type CollectionEdge } from
|
|
8
|
-
import type { ImplicitEdge } from
|
|
9
|
-
import { type ResourceEdge } from
|
|
1
|
+
import type { CacheCapabilitiesManager, StableRecordIdentifier } from "../../types.js";
|
|
2
|
+
import type { RelationshipDiff } from "../../types/cache.js";
|
|
3
|
+
import type { MergeOperation } from "../../types/cache/operations.js";
|
|
4
|
+
import type { CollectionRelationship, ResourceRelationship } from "../../types/cache/relationship.js";
|
|
5
|
+
import type { DeleteRecordOperation, LocalRelationshipOperation, RemoteRelationshipOperation } from "../../types/graph.js";
|
|
6
|
+
import type { EdgeCache, UpgradedMeta } from "./-edge-definition.js";
|
|
7
|
+
import { type CollectionEdge } from "./edges/collection.js";
|
|
8
|
+
import type { ImplicitEdge } from "./edges/implicit.js";
|
|
9
|
+
import { type ResourceEdge } from "./edges/resource.js";
|
|
10
10
|
export type GraphEdge = ImplicitEdge | CollectionEdge | ResourceEdge;
|
|
11
11
|
export declare const Graphs: Map<CacheCapabilitiesManager, Graph>;
|
|
12
12
|
type PendingOps = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
belongsTo?: Map<string, Map<string, RemoteRelationshipOperation[]>>;
|
|
14
|
+
hasMany?: Map<string, Map<string, RemoteRelationshipOperation[]>>;
|
|
15
|
+
deletions: DeleteRecordOperation[];
|
|
16
16
|
};
|
|
17
|
+
/*
|
|
18
|
+
* Graph acts as the cache for relationship data. It allows for
|
|
19
|
+
* us to ask about and update relationships for a given Identifier
|
|
20
|
+
* without requiring other objects for that Identifier to be
|
|
21
|
+
* instantiated (such as `RecordData` or a `Record`)
|
|
22
|
+
*
|
|
23
|
+
* This also allows for us to make more substantive changes to relationships
|
|
24
|
+
* with increasingly minor alterations to other portions of the internals
|
|
25
|
+
* over time.
|
|
26
|
+
*
|
|
27
|
+
* The graph is made up of nodes and edges. Each unique identifier gets
|
|
28
|
+
* its own node, which is a dictionary with a list of that node's edges
|
|
29
|
+
* (or connections) to other nodes. In `Model` terms, a node represents a
|
|
30
|
+
* record instance, with each key (an edge) in the dictionary correlating
|
|
31
|
+
* to either a `hasMany` or `belongsTo` field on that record instance.
|
|
32
|
+
*
|
|
33
|
+
* The value for each key, or `edge` is the identifier(s) the node relates
|
|
34
|
+
* to in the graph from that key.
|
|
35
|
+
*/
|
|
17
36
|
export declare class Graph {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
_definitionCache: EdgeCache;
|
|
38
|
+
_metaCache: Record<string, Record<string, UpgradedMeta>>;
|
|
39
|
+
_potentialPolymorphicTypes: Record<string, Record<string, boolean>>;
|
|
40
|
+
identifiers: Map<StableRecordIdentifier, Record<string, GraphEdge>>;
|
|
41
|
+
store: CacheCapabilitiesManager;
|
|
42
|
+
isDestroyed: boolean;
|
|
43
|
+
_willSyncRemote: boolean;
|
|
44
|
+
_willSyncLocal: boolean;
|
|
45
|
+
silenceNotifications: boolean;
|
|
46
|
+
_pushedUpdates: PendingOps;
|
|
47
|
+
_updatedRelationships: Set<CollectionEdge>;
|
|
48
|
+
_transaction: number | null;
|
|
49
|
+
_removing: StableRecordIdentifier | null;
|
|
50
|
+
constructor(store: CacheCapabilitiesManager);
|
|
51
|
+
has(identifier: StableRecordIdentifier, propertyName: string): boolean;
|
|
52
|
+
getDefinition(identifier: StableRecordIdentifier, propertyName: string): UpgradedMeta;
|
|
53
|
+
get(identifier: StableRecordIdentifier, propertyName: string): GraphEdge;
|
|
54
|
+
getData(identifier: StableRecordIdentifier, propertyName: string): ResourceRelationship | CollectionRelationship;
|
|
55
|
+
getRemoteData(identifier: StableRecordIdentifier, propertyName: string): ResourceRelationship | CollectionRelationship;
|
|
56
|
+
/*
|
|
57
|
+
* Allows for the graph to dynamically discover polymorphic connections
|
|
58
|
+
* without needing to walk prototype chains.
|
|
59
|
+
*
|
|
60
|
+
* Used by edges when an added `type` does not match the expected `type`
|
|
61
|
+
* for that edge.
|
|
62
|
+
*
|
|
63
|
+
* Currently we assert before calling this. For a public API we will want
|
|
64
|
+
* to call out to the schema manager to ask if we should consider these
|
|
65
|
+
* types as equivalent for a given relationship.
|
|
66
|
+
*/
|
|
67
|
+
registerPolymorphicType(type1: string, type2: string): void;
|
|
68
|
+
isReleasable(identifier: StableRecordIdentifier): boolean;
|
|
69
|
+
unload(identifier: StableRecordIdentifier, silenceNotifications?: boolean): void;
|
|
70
|
+
_isDirty(identifier: StableRecordIdentifier, field: string): boolean;
|
|
71
|
+
getChanged(identifier: StableRecordIdentifier): Map<string, RelationshipDiff>;
|
|
72
|
+
hasChanged(identifier: StableRecordIdentifier): boolean;
|
|
73
|
+
rollback(identifier: StableRecordIdentifier): string[];
|
|
74
|
+
remove(identifier: StableRecordIdentifier): void;
|
|
75
|
+
/*
|
|
76
|
+
* Remote state changes
|
|
77
|
+
*/
|
|
78
|
+
push(op: RemoteRelationshipOperation): void;
|
|
79
|
+
/*
|
|
80
|
+
* Local state changes
|
|
81
|
+
*/
|
|
82
|
+
update(op: RemoteRelationshipOperation | MergeOperation, isRemote: true): void;
|
|
83
|
+
update(op: LocalRelationshipOperation, isRemote?: false): void;
|
|
84
|
+
_scheduleLocalSync(relationship: CollectionEdge): void;
|
|
85
|
+
_flushRemoteQueue(): void;
|
|
86
|
+
_addToTransaction(relationship: CollectionEdge | ResourceEdge): void;
|
|
87
|
+
_flushLocalQueue(): void;
|
|
88
|
+
destroy(): void;
|
|
53
89
|
}
|
|
54
90
|
export {};
|
|
55
|
-
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import type { Link, LinkObject } from
|
|
1
|
+
import type { Link, LinkObject } from "../../types/spec/json-api-raw.js";
|
|
2
|
+
/*
|
|
3
|
+
This method normalizes a link to an "links object". If the passed link is
|
|
4
|
+
already an object it's returned without any modifications.
|
|
5
|
+
|
|
6
|
+
See http://jsonapi.org/format/#document-links for more information.
|
|
7
|
+
*/
|
|
2
8
|
export default function _normalizeLink(link: Link): LinkObject | null;
|
|
3
|
-
//# sourceMappingURL=normalize-link.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AddToResourceRelationshipMutation } from
|
|
2
|
-
import type { AddToResourceRelationshipOperation } from
|
|
3
|
-
import type { Graph } from
|
|
1
|
+
import type { AddToResourceRelationshipMutation } from "../../../types/cache/mutations.js";
|
|
2
|
+
import type { AddToResourceRelationshipOperation } from "../../../types/cache/operations.js";
|
|
3
|
+
import type { Graph } from "../graph.js";
|
|
4
4
|
export default function addToRelatedRecords(graph: Graph, op: AddToResourceRelationshipOperation | AddToResourceRelationshipMutation, isRemote: boolean): void;
|
|
5
|
-
//# sourceMappingURL=add-to-related-records.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { MergeOperation } from
|
|
2
|
-
import type { Graph, GraphEdge } from
|
|
1
|
+
import type { MergeOperation } from "../../../types/cache/operations.js";
|
|
2
|
+
import type { Graph, GraphEdge } from "../graph.js";
|
|
3
3
|
export declare function mergeIdentifier(graph: Graph, op: MergeOperation, relationships: Record<string, GraphEdge>): void;
|
|
4
|
-
//# sourceMappingURL=merge-identifier.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { RemoveFromResourceRelationshipMutation } from
|
|
2
|
-
import type { RemoveFromResourceRelationshipOperation } from
|
|
3
|
-
import type { Graph } from
|
|
1
|
+
import type { RemoveFromResourceRelationshipMutation } from "../../../types/cache/mutations.js";
|
|
2
|
+
import type { RemoveFromResourceRelationshipOperation } from "../../../types/cache/operations.js";
|
|
3
|
+
import type { Graph } from "../graph.js";
|
|
4
4
|
export default function removeFromRelatedRecords(graph: Graph, op: RemoveFromResourceRelationshipOperation | RemoveFromResourceRelationshipMutation, isRemote: boolean): void;
|
|
5
|
-
//# sourceMappingURL=remove-from-related-records.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ReplaceRelatedRecordOperation } from
|
|
2
|
-
import type { Graph } from
|
|
1
|
+
import type { ReplaceRelatedRecordOperation } from "../../../types/graph.js";
|
|
2
|
+
import type { Graph } from "../graph.js";
|
|
3
3
|
export default function replaceRelatedRecord(graph: Graph, op: ReplaceRelatedRecordOperation, isRemote?: boolean): void;
|
|
4
|
-
//# sourceMappingURL=replace-related-record.d.ts.map
|
|
@@ -1,8 +1,62 @@
|
|
|
1
|
-
import type { StableRecordIdentifier } from
|
|
2
|
-
import type { ReplaceRelatedRecordsOperation } from
|
|
3
|
-
import type { Graph } from
|
|
1
|
+
import type { StableRecordIdentifier } from "../../../types.js";
|
|
2
|
+
import type { ReplaceRelatedRecordsOperation } from "../../../types/graph.js";
|
|
3
|
+
import type { Graph } from "../graph.js";
|
|
4
|
+
/*
|
|
5
|
+
case many:1
|
|
6
|
+
========
|
|
7
|
+
In a bi-directional graph with Many:1 edges, adding a value
|
|
8
|
+
results in up-to 3 discrete value transitions, while removing
|
|
9
|
+
a value is only 2 transitions.
|
|
10
|
+
|
|
11
|
+
For adding C to A
|
|
12
|
+
If: A <<-> B, C <->> D is the initial state,
|
|
13
|
+
and: B <->> A <<-> C, D is the final state
|
|
14
|
+
|
|
15
|
+
then we would undergo the following transitions.
|
|
16
|
+
|
|
17
|
+
add C to A
|
|
18
|
+
remove C from D
|
|
19
|
+
add A to C
|
|
20
|
+
|
|
21
|
+
For removing B from A
|
|
22
|
+
If: A <<-> B, C <->> D is the initial state,
|
|
23
|
+
and: A, B, C <->> D is the final state
|
|
24
|
+
|
|
25
|
+
then we would undergo the following transitions.
|
|
26
|
+
|
|
27
|
+
remove B from A
|
|
28
|
+
remove A from B
|
|
29
|
+
|
|
30
|
+
case many:many
|
|
31
|
+
===========
|
|
32
|
+
In a bi-directional graph with Many:Many edges, adding or
|
|
33
|
+
removing a value requires only 2 value transitions.
|
|
34
|
+
|
|
35
|
+
For Adding
|
|
36
|
+
If: A<<->>B, C<<->>D is the initial state (double arrows representing the many side)
|
|
37
|
+
And: D<<->>C<<->>A<<->>B is the final state
|
|
38
|
+
|
|
39
|
+
Then we would undergo two transitions.
|
|
40
|
+
|
|
41
|
+
add C to A.
|
|
42
|
+
add A to C
|
|
43
|
+
|
|
44
|
+
For Removing
|
|
45
|
+
If: A<<->>B, C<<->>D is the initial state (double arrows representing the many side)
|
|
46
|
+
And: A, B, C<<->>D is the final state
|
|
47
|
+
|
|
48
|
+
Then we would undergo two transitions.
|
|
49
|
+
|
|
50
|
+
remove B from A
|
|
51
|
+
remove A from B
|
|
52
|
+
|
|
53
|
+
case many:?
|
|
54
|
+
========
|
|
55
|
+
In a uni-directional graph with Many:? edges (modeled in WarpDrive with `inverse:null`) with
|
|
56
|
+
artificial (implicit) inverses, replacing a value results in 2 discrete value transitions.
|
|
57
|
+
This is because a Many:? relationship is effectively Many:Many.
|
|
58
|
+
*/
|
|
4
59
|
export default function replaceRelatedRecords(graph: Graph, op: ReplaceRelatedRecordsOperation, isRemote: boolean): void;
|
|
5
60
|
export declare function addToInverse(graph: Graph, identifier: StableRecordIdentifier, key: string, value: StableRecordIdentifier, isRemote: boolean): void;
|
|
6
61
|
export declare function notifyInverseOfPotentialMaterialization(graph: Graph, identifier: StableRecordIdentifier, key: string, value: StableRecordIdentifier, isRemote: boolean): void;
|
|
7
62
|
export declare function removeFromInverse(graph: Graph, identifier: StableRecordIdentifier, key: string, value: StableRecordIdentifier, isRemote: boolean): void;
|
|
8
|
-
//# sourceMappingURL=replace-related-records.d.ts.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { Store } from
|
|
2
|
-
import type { StableRecordIdentifier } from
|
|
3
|
-
import type { UpdateResourceRelationshipOperation } from
|
|
4
|
-
import type { UpdateRelationshipOperation } from
|
|
5
|
-
import type { ExistingResourceIdentifierObject, NewResourceIdentifierObject } from
|
|
6
|
-
import type { Graph } from
|
|
7
|
-
type IdentifierCache = Store[
|
|
1
|
+
import type { Store } from "../../../index.js";
|
|
2
|
+
import type { StableRecordIdentifier } from "../../../types.js";
|
|
3
|
+
import type { UpdateResourceRelationshipOperation } from "../../../types/cache/operations.js";
|
|
4
|
+
import type { UpdateRelationshipOperation } from "../../../types/graph.js";
|
|
5
|
+
import type { ExistingResourceIdentifierObject, NewResourceIdentifierObject } from "../../../types/spec/json-api-raw.js";
|
|
6
|
+
import type { Graph } from "../graph.js";
|
|
7
|
+
type IdentifierCache = Store["identifierCache"];
|
|
8
|
+
/*
|
|
9
|
+
Updates the "canonical" or "remote" state of a relationship, replacing any existing
|
|
10
|
+
state and blowing away any local changes (excepting new records).
|
|
11
|
+
*/
|
|
8
12
|
export default function updateRelationshipOperation(graph: Graph, op: UpdateRelationshipOperation | UpdateResourceRelationshipOperation): void;
|
|
9
13
|
export declare function upgradeIdentifiers(arr: (ExistingResourceIdentifierObject | NewResourceIdentifierObject | StableRecordIdentifier)[], cache: IdentifierCache): StableRecordIdentifier[];
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=update-relationship.d.ts.map
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { Store } from
|
|
2
|
-
import type { CacheCapabilitiesManager } from
|
|
3
|
-
import { Graph } from
|
|
4
|
-
export { isBelongsTo } from
|
|
5
|
-
export type { CollectionEdge } from
|
|
6
|
-
export type { ResourceEdge } from
|
|
7
|
-
export type { ImplicitEdge } from
|
|
8
|
-
export type { GraphEdge } from
|
|
9
|
-
export type { UpgradedMeta } from
|
|
1
|
+
import type { Store } from "../index.js";
|
|
2
|
+
import type { CacheCapabilitiesManager } from "../types.js";
|
|
3
|
+
import { Graph } from "./-private/graph.js";
|
|
4
|
+
export { isBelongsTo } from "./-private/-utils.js";
|
|
5
|
+
export type { CollectionEdge } from "./-private/edges/collection.js";
|
|
6
|
+
export type { ResourceEdge } from "./-private/edges/resource.js";
|
|
7
|
+
export type { ImplicitEdge } from "./-private/edges/implicit.js";
|
|
8
|
+
export type { GraphEdge } from "./-private/graph.js";
|
|
9
|
+
export type { UpgradedMeta } from "./-private/-edge-definition.js";
|
|
10
10
|
export type { Graph };
|
|
11
11
|
export declare function peekGraph(store: CacheCapabilitiesManager | Store): Graph | undefined;
|
|
12
12
|
export type peekGraph = typeof peekGraph;
|
|
13
13
|
export declare function graphFor(store: CacheCapabilitiesManager | Store): Graph;
|
|
14
|
-
//# sourceMappingURL=-private.d.ts.map
|
package/declarations/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { ReactiveDocument } from
|
|
6
|
-
export { Fetch } from
|
|
7
|
-
export { RequestManager } from
|
|
8
|
-
export { Store, type StoreRequestContext, CacheHandler, type CachePolicy, type StoreRequestInput, recordIdentifierFor, storeFor
|
|
2
|
+
* @module
|
|
3
|
+
* @mergeModuleWith <project>
|
|
4
|
+
*/
|
|
5
|
+
import type { ReactiveDocument } from "./reactive/-private/document.js";
|
|
6
|
+
export { Fetch } from "./request/-private/fetch.js";
|
|
7
|
+
export { RequestManager } from "./request/-private/manager.js";
|
|
8
|
+
export { Store, type StoreRequestContext, CacheHandler, type CachePolicy, type StoreRequestInput, recordIdentifierFor, storeFor } from "./store/-private.js";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* @deprecated use `ReactiveDocument` instead
|
|
11
|
+
*/
|
|
12
12
|
export type Document<T> = ReactiveDocument<T>;
|
|
13
|
-
export type { DocumentCacheOperation, CacheOperation, NotificationType
|
|
14
|
-
export { setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, setKeyInfoForResource
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
13
|
+
export type { DocumentCacheOperation, CacheOperation, NotificationType } from "./store/-private/managers/notification-manager.js";
|
|
14
|
+
export { setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, setKeyInfoForResource } from "./store/-private/caches/identifier-cache.js";
|