@warp-drive/core 5.6.0-beta.0 → 5.6.0-beta.2
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 +2 -2
- package/declarations/graph/-private/-utils.d.ts +5 -5
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +3 -3
- 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 -15
- package/declarations/graph/-private/operations/replace-related-records.d.ts +4 -4
- package/declarations/graph/-private/operations/update-relationship.d.ts +3 -3
- package/declarations/index.d.ts +1 -1
- package/declarations/reactive/-private/default-mode.d.ts +73 -0
- package/declarations/reactive/-private/document.d.ts +11 -27
- package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +7 -10
- package/declarations/reactive/-private/fields/managed-object.d.ts +7 -9
- 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/kind/alias-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/array-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/attribute-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/belongs-to-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/collection-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/derived-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/generic-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/has-many-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/hash-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/identity-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/local-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/object-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/resource-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/schema-array-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/schema-object-field.d.ts +4 -0
- package/declarations/reactive/-private/record.d.ts +44 -33
- package/declarations/reactive/-private/schema.d.ts +50 -66
- package/declarations/reactive/-private/symbols.d.ts +2 -7
- package/declarations/reactive/-private.d.ts +1 -1
- package/declarations/reactive.d.ts +278 -1
- package/declarations/request/-private/context.d.ts +3 -5
- package/declarations/request/-private/fetch.d.ts +2 -0
- package/declarations/request/-private/manager.d.ts +24 -28
- package/declarations/request/-private/types.d.ts +22 -23
- 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 -4
- package/declarations/store/-private/caches/instance-cache.d.ts +22 -27
- package/declarations/store/-private/debug/utils.d.ts +1 -0
- package/declarations/store/-private/default-cache-policy.d.ts +25 -38
- 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} +38 -52
- package/declarations/store/-private/managers/cache-manager.d.ts +46 -95
- package/declarations/store/-private/managers/notification-manager.d.ts +30 -43
- package/declarations/store/-private/managers/record-array-manager.d.ts +44 -41
- package/declarations/store/-private/network/request-cache.d.ts +21 -24
- 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 +133 -37
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +51 -133
- 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 +75 -0
- package/declarations/store/-private/store-service.d.ts +167 -872
- package/declarations/store/-private.d.ts +14 -10
- 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 +64 -40
- package/declarations/store/-types/q/store.d.ts +6 -7
- package/declarations/store/deprecated/-private.d.ts +224 -0
- package/declarations/store/deprecated/store.d.ts +787 -0
- package/declarations/types/-private.d.ts +1 -1
- package/declarations/types/cache/aliases.d.ts +2 -2
- package/declarations/types/cache/change.d.ts +2 -2
- package/declarations/types/cache/mutations.d.ts +13 -13
- package/declarations/types/cache/operations.d.ts +115 -32
- package/declarations/types/cache/relationship.d.ts +4 -4
- package/declarations/types/cache.d.ts +51 -115
- package/declarations/types/graph.d.ts +12 -12
- package/declarations/types/identifier.d.ts +52 -76
- package/declarations/types/params.d.ts +2 -3
- package/declarations/types/request.d.ts +69 -42
- package/declarations/types/schema/concepts.d.ts +2 -2
- package/declarations/types/schema/fields.d.ts +391 -14
- package/declarations/types/spec/document.d.ts +6 -6
- package/declarations/types/spec/json-api-raw.d.ts +6 -8
- package/declarations/types.d.ts +2 -1
- package/declarations/utils/string.d.ts +2 -2
- 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 +337 -1422
- package/dist/{request-state-CjLph1LP.js → request-state-C955e0AL.js} +8352 -5912
- 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 +23 -2
- package/dist/utils/string.js +2 -2
- package/package.json +10 -10
- package/declarations/reactive/-private/fields/compute.d.ts +0 -43
- package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
- 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/declarations/store/-types/q/ds-model.d.ts +0 -21
- package/dist/handler-C2T-IyJK.js +0 -339
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
// The ResourceBlob is an opaque type that must
|
|
2
2
|
// satisfy two constraints.
|
|
3
|
-
// (1) it should be possible for the
|
|
4
|
-
// to be able to generate a
|
|
3
|
+
// (1) it should be possible for the CacheKeyManager
|
|
4
|
+
// to be able to generate a ResourceKey for it
|
|
5
5
|
// whether by default or due to configuration.
|
|
6
6
|
// (2) it should be in a format expected by the Cache.
|
|
7
7
|
// This format is Cache declared.
|
|
@@ -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,48 +1,48 @@
|
|
|
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
20
|
// never null if field is a collection
|
|
21
|
-
value:
|
|
21
|
+
value: ResourceKey | null;
|
|
22
22
|
// if field is a collection,
|
|
23
23
|
// the value we are swapping with
|
|
24
|
-
prior?:
|
|
24
|
+
prior?: ResourceKey;
|
|
25
25
|
index?: number;
|
|
26
26
|
}
|
|
27
27
|
export interface ReplaceRelatedRecordsMutation {
|
|
28
28
|
op: "replaceRelatedRecords";
|
|
29
|
-
record:
|
|
29
|
+
record: ResourceKey;
|
|
30
30
|
field: string;
|
|
31
31
|
// the records to add. If no prior/index
|
|
32
32
|
// specified all existing should be removed
|
|
33
|
-
value:
|
|
33
|
+
value: ResourceKey[];
|
|
34
34
|
// if this is a "splice" the
|
|
35
35
|
// records we expect to be removed
|
|
36
|
-
prior?:
|
|
36
|
+
prior?: ResourceKey[];
|
|
37
37
|
// if this is a "splice" the
|
|
38
38
|
// index to start from
|
|
39
39
|
index?: number;
|
|
40
40
|
}
|
|
41
41
|
export interface SortRelatedRecordsMutation {
|
|
42
42
|
op: "sortRelatedRecords";
|
|
43
|
-
record:
|
|
43
|
+
record: ResourceKey;
|
|
44
44
|
field: string;
|
|
45
|
-
value:
|
|
45
|
+
value: ResourceKey[];
|
|
46
46
|
}
|
|
47
47
|
// A Mutation is an action that updates
|
|
48
48
|
// the local state of the Cache in some
|
|
@@ -1,85 +1,168 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PersistedResourceKey, RequestKey, ResourceKey } from "../identifier.js";
|
|
2
2
|
import type { Value } from "../json/raw.js";
|
|
3
3
|
import type { ExistingResourceObject } from "../spec/json-api-raw.js";
|
|
4
4
|
import type { Relationship } from "./relationship.js";
|
|
5
|
+
/**
|
|
6
|
+
* All operations are objects with at least one property,
|
|
7
|
+
* `op` which contains a string with the name of the operation
|
|
8
|
+
* to perform.
|
|
9
|
+
*/
|
|
5
10
|
export interface Op {
|
|
11
|
+
/**
|
|
12
|
+
* The name of the {@link Op | operation}
|
|
13
|
+
*/
|
|
6
14
|
op: string;
|
|
7
15
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Occasionally the Store discovers that two previously
|
|
18
|
+
* thought to be distinct resources refer to the same resource.
|
|
19
|
+
*
|
|
20
|
+
* This operation will be performed, giving the Cache the chance
|
|
21
|
+
* to cleanup and merge internal state as desired when this discovery
|
|
22
|
+
* is made.
|
|
23
|
+
*/
|
|
16
24
|
export interface MergeOperation extends Op {
|
|
17
25
|
op: "mergeIdentifiers";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The stale {@link ResourceKey | ResourceKey} that
|
|
28
|
+
* the cache should eliminate in favor of {@link MergeOperation.value | value}
|
|
29
|
+
*/
|
|
30
|
+
record: ResourceKey;
|
|
31
|
+
/**
|
|
32
|
+
* The kept {@link ResourceKey | ResourceKey} that
|
|
33
|
+
* the cache should also keep and merge {@link MergeOperation.record | record} into.
|
|
34
|
+
*/
|
|
35
|
+
value: ResourceKey;
|
|
22
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Removes a document and its associated request from
|
|
39
|
+
* the cache.
|
|
40
|
+
*/
|
|
23
41
|
export interface RemoveDocumentOperation extends Op {
|
|
24
42
|
op: "remove";
|
|
25
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The cache key for the request
|
|
45
|
+
*/
|
|
46
|
+
record: RequestKey;
|
|
26
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Removes a resource from the cache. This is treated
|
|
50
|
+
* as if a remote deletion has occurred, and all references
|
|
51
|
+
* to the resource should be eliminated.
|
|
52
|
+
*/
|
|
27
53
|
export interface RemoveResourceOperation extends Op {
|
|
28
54
|
op: "remove";
|
|
29
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The cache key for the resource
|
|
57
|
+
*/
|
|
58
|
+
record: PersistedResourceKey;
|
|
30
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Adds a resource to the cache.
|
|
62
|
+
*/
|
|
31
63
|
export interface AddResourceOperation extends Op {
|
|
32
64
|
op: "add";
|
|
33
|
-
|
|
65
|
+
/**
|
|
66
|
+
* The cache key for the resource
|
|
67
|
+
*/
|
|
68
|
+
record: PersistedResourceKey;
|
|
69
|
+
/**
|
|
70
|
+
* The data for the resource
|
|
71
|
+
*/
|
|
34
72
|
value: ExistingResourceObject;
|
|
35
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Upserts (merges) new state for a resource
|
|
76
|
+
*/
|
|
36
77
|
export interface UpdateResourceOperation extends Op {
|
|
37
78
|
op: "update";
|
|
38
|
-
record:
|
|
79
|
+
record: PersistedResourceKey;
|
|
39
80
|
value: ExistingResourceObject;
|
|
40
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Replaces the state of a field with a new state
|
|
84
|
+
*/
|
|
41
85
|
export interface UpdateResourceFieldOperation extends Op {
|
|
42
86
|
op: "update";
|
|
43
|
-
record:
|
|
87
|
+
record: PersistedResourceKey;
|
|
44
88
|
field: string;
|
|
45
89
|
value: Value;
|
|
46
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Replaces the state of a relationship with a new state
|
|
93
|
+
*/
|
|
47
94
|
export interface UpdateResourceRelationshipOperation extends Op {
|
|
48
95
|
op: "update";
|
|
49
|
-
record:
|
|
96
|
+
record: PersistedResourceKey;
|
|
50
97
|
field: string;
|
|
51
|
-
value: Relationship<
|
|
98
|
+
value: Relationship<PersistedResourceKey>;
|
|
52
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Adds a resource to a request document, optionally
|
|
102
|
+
* at a specific index. This can be used to update the
|
|
103
|
+
* result of a request.
|
|
104
|
+
*/
|
|
53
105
|
export interface AddToDocumentOperation extends Op {
|
|
54
106
|
op: "add";
|
|
55
|
-
record:
|
|
107
|
+
record: RequestKey;
|
|
56
108
|
field: "data" | "included";
|
|
57
|
-
value:
|
|
109
|
+
value: PersistedResourceKey | PersistedResourceKey[];
|
|
58
110
|
index?: number;
|
|
59
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Adds the specified ResourceKeys to a relationship
|
|
114
|
+
*/
|
|
60
115
|
export interface AddToResourceRelationshipOperation extends Op {
|
|
61
116
|
op: "add";
|
|
62
|
-
record:
|
|
117
|
+
record: PersistedResourceKey;
|
|
63
118
|
field: string;
|
|
64
|
-
value:
|
|
119
|
+
value: PersistedResourceKey | PersistedResourceKey[];
|
|
65
120
|
index?: number;
|
|
66
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Removes the specified ResourceKeys from a relationship
|
|
124
|
+
*/
|
|
67
125
|
export interface RemoveFromResourceRelationshipOperation extends Op {
|
|
68
126
|
op: "remove";
|
|
69
|
-
record:
|
|
127
|
+
record: PersistedResourceKey;
|
|
70
128
|
field: string;
|
|
71
|
-
value:
|
|
129
|
+
value: PersistedResourceKey | PersistedResourceKey[];
|
|
72
130
|
index?: number;
|
|
73
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Removes a resource from a request document, optionally
|
|
134
|
+
* at a specific index. This can be used to update the
|
|
135
|
+
* result of a request.
|
|
136
|
+
*/
|
|
74
137
|
export interface RemoveFromDocumentOperation extends Op {
|
|
75
138
|
op: "remove";
|
|
76
|
-
record:
|
|
139
|
+
record: RequestKey;
|
|
77
140
|
field: "data" | "included";
|
|
78
|
-
value:
|
|
141
|
+
value: PersistedResourceKey | PersistedResourceKey[];
|
|
79
142
|
index?: number;
|
|
80
143
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
144
|
+
/**
|
|
145
|
+
* {@link Cache} Operations perform updates to the
|
|
146
|
+
* Cache's "remote" (or clean) state to reflect external
|
|
147
|
+
* changes.
|
|
148
|
+
*
|
|
149
|
+
* Usually operations represent the result of a {@link WebSocket} or
|
|
150
|
+
* {@link EventSource | ServerEvent} message, though they can also be used to carefully
|
|
151
|
+
* patch the state of the cache with information known by the
|
|
152
|
+
* application or developer.
|
|
153
|
+
*
|
|
154
|
+
* Operations are applied via {@link Cache.patch}.
|
|
155
|
+
*
|
|
156
|
+
* See also:
|
|
157
|
+
* - {@link MergeOperation}
|
|
158
|
+
* - {@link RemoveResourceOperation}
|
|
159
|
+
* - {@link RemoveDocumentOperation}
|
|
160
|
+
* - {@link AddResourceOperation}
|
|
161
|
+
* - {@link UpdateResourceOperation}
|
|
162
|
+
* - {@link UpdateResourceFieldOperation}
|
|
163
|
+
* - {@link AddToResourceRelationshipOperation}
|
|
164
|
+
* - {@link RemoveFromResourceRelationshipOperation}
|
|
165
|
+
* - {@link AddToDocumentOperation}
|
|
166
|
+
* - {@link RemoveFromDocumentOperation}
|
|
167
|
+
*/
|
|
85
168
|
export type Operation = MergeOperation | RemoveResourceOperation | RemoveDocumentOperation | AddResourceOperation | UpdateResourceOperation | UpdateResourceFieldOperation | AddToResourceRelationshipOperation | RemoveFromResourceRelationshipOperation | AddToDocumentOperation | RemoveFromDocumentOperation;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResourceKey } from "../identifier.js";
|
|
2
2
|
import type { Links, Meta, PaginationLinks } from "../spec/json-api-raw.js";
|
|
3
3
|
// we request that it be in the stable form already.
|
|
4
|
-
export interface ResourceRelationship<T =
|
|
4
|
+
export interface ResourceRelationship<T = ResourceKey> {
|
|
5
5
|
data?: T | null;
|
|
6
6
|
meta?: Meta;
|
|
7
7
|
links?: Links;
|
|
8
8
|
}
|
|
9
9
|
// Note: in v1 data could be a ResourceIdentifier, now
|
|
10
10
|
// we request that it be in the stable form already.
|
|
11
|
-
export interface CollectionRelationship<T =
|
|
11
|
+
export interface CollectionRelationship<T = ResourceKey> {
|
|
12
12
|
data?: T[];
|
|
13
13
|
meta?: Meta;
|
|
14
14
|
links?: PaginationLinks;
|
|
15
15
|
}
|
|
16
|
-
export type Relationship<T =
|
|
16
|
+
export type Relationship<T = ResourceKey> = ResourceRelationship<T> | CollectionRelationship<T>;
|