@warp-drive/core 5.7.0-alpha.3 → 5.7.0-alpha.31
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 -21
- 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 +16 -72
- 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 -3
- 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 +21 -19
- 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 +47 -95
- package/declarations/store/-private/managers/notification-manager.d.ts +30 -42
- package/declarations/store/-private/managers/record-array-manager.d.ts +45 -41
- package/declarations/store/-private/network/request-cache.d.ts +21 -21
- 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 +129 -22
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +51 -123
- 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 +156 -101
- package/declarations/store/-private.d.ts +12 -9
- 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 +28 -40
- package/declarations/store/-types/q/store.d.ts +6 -7
- package/declarations/store/deprecated/-private.d.ts +12 -23
- package/declarations/store/deprecated/store.d.ts +11 -12
- 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 -113
- 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 +378 -14
- package/declarations/types/spec/document.d.ts +6 -6
- package/declarations/types/spec/json-api-raw.d.ts +6 -8
- package/declarations/utils/string.d.ts +2 -2
- package/dist/{configure-B48bFHOl.js → configure-C3x8YXzL.js} +5 -5
- package/dist/configure.js +1 -1
- package/dist/{context-COmAnXUQ.js → context-Bh-MA_tH.js} +40 -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 +203 -1413
- package/dist/{request-state-CejVJgdj.js → request-state-DGyt5EV8.js} +5674 -2812
- 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/record-arrays/identifier-array.d.ts +0 -147
- package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
- package/dist/handler-D2jjnIA-.js +0 -339
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { RequestKey, ResourceKey } from "../../../types/identifier.js";
|
|
2
|
+
import type { CacheKeyManager } from "../../-private/managers/cache-key-manager.js";
|
|
3
3
|
import type { NotificationType } from "../../-private/managers/notification-manager.js";
|
|
4
4
|
import type { SchemaService } from "./schema-service.js";
|
|
5
5
|
/**
|
|
@@ -11,22 +11,21 @@ import type { SchemaService } from "./schema-service.js";
|
|
|
11
11
|
*
|
|
12
12
|
* This class cannot be directly instantiated.
|
|
13
13
|
*
|
|
14
|
-
* @class CacheCapabilitiesManager
|
|
15
14
|
* @public
|
|
16
15
|
*/
|
|
17
16
|
export type CacheCapabilitiesManager = {
|
|
18
17
|
/**
|
|
19
|
-
* Provides access to the
|
|
18
|
+
* Provides access to the CacheKeyManager instance
|
|
20
19
|
* for this Store instance.
|
|
21
20
|
*
|
|
22
|
-
* The
|
|
21
|
+
* The CacheKeyManager can be used to peek, generate or
|
|
23
22
|
* retrieve a stable unique identifier for any resource.
|
|
24
23
|
*
|
|
25
|
-
* @property identifierCache
|
|
26
|
-
* @type {IdentifierCache}
|
|
27
24
|
* @public
|
|
28
25
|
*/
|
|
29
|
-
|
|
26
|
+
cacheKeyManager: CacheKeyManager;
|
|
27
|
+
/** @deprecated use {@link CacheCapabilitiesManager.cacheKeyManager} */
|
|
28
|
+
identifierCache: CacheKeyManager;
|
|
30
29
|
/**
|
|
31
30
|
* DEPRECATED - use the schema property
|
|
32
31
|
*
|
|
@@ -36,7 +35,7 @@ export type CacheCapabilitiesManager = {
|
|
|
36
35
|
* The SchemaService can be used to query for
|
|
37
36
|
* information about the schema of a resource.
|
|
38
37
|
*
|
|
39
|
-
* @deprecated
|
|
38
|
+
* @deprecated use {@link CacheCapabilitiesManager.schema}
|
|
40
39
|
* @public
|
|
41
40
|
*/
|
|
42
41
|
getSchemaDefinitionService(): SchemaService;
|
|
@@ -55,30 +54,25 @@ export type CacheCapabilitiesManager = {
|
|
|
55
54
|
* Update the `id` for the record corresponding to the identifier
|
|
56
55
|
* This operation can only be done for records whose `id` is `null`.
|
|
57
56
|
*
|
|
58
|
-
* @param {StableRecordIdentifier} identifier;
|
|
59
|
-
* @param {String} id;
|
|
60
57
|
* @public
|
|
61
58
|
*/
|
|
62
|
-
setRecordId(identifier:
|
|
59
|
+
setRecordId(identifier: ResourceKey, id: string): void;
|
|
63
60
|
/**
|
|
64
61
|
* Signal to the store that the specified record may be considered fully
|
|
65
62
|
* removed from the cache. Generally this means that not only does no
|
|
66
63
|
* data exist for the identified resource, no known relationships still
|
|
67
64
|
* point to it either.
|
|
68
65
|
*
|
|
69
|
-
* @param {StableRecordIdentifier} identifier
|
|
70
66
|
* @public
|
|
71
67
|
*/
|
|
72
|
-
disconnectRecord(identifier:
|
|
68
|
+
disconnectRecord(identifier: ResourceKey): void;
|
|
73
69
|
/**
|
|
74
70
|
* Use this method to determine if the Store has an instantiated record associated
|
|
75
71
|
* with an identifier.
|
|
76
72
|
*
|
|
77
|
-
* @param identifier
|
|
78
|
-
* @return {Boolean}
|
|
79
73
|
* @public
|
|
80
74
|
*/
|
|
81
|
-
hasRecord(identifier:
|
|
75
|
+
hasRecord(identifier: ResourceKey): boolean;
|
|
82
76
|
/**
|
|
83
77
|
* Notify subscribers of the NotificationManager that cache state has changed.
|
|
84
78
|
*
|
|
@@ -87,13 +81,10 @@ export type CacheCapabilitiesManager = {
|
|
|
87
81
|
*
|
|
88
82
|
* No other namespaces currently expect the `key` argument.
|
|
89
83
|
*
|
|
90
|
-
* @param {StableRecordIdentifier} identifier
|
|
91
|
-
* @param {'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'} namespace
|
|
92
|
-
* @param {string|undefined} key
|
|
93
84
|
* @public
|
|
94
85
|
*/
|
|
95
|
-
notifyChange(identifier:
|
|
96
|
-
notifyChange(identifier:
|
|
97
|
-
notifyChange(identifier:
|
|
98
|
-
notifyChange(identifier:
|
|
86
|
+
notifyChange(identifier: ResourceKey, namespace: "added" | "removed", key: null): void;
|
|
87
|
+
notifyChange(identifier: RequestKey, namespace: "added" | "updated" | "removed", key: null): void;
|
|
88
|
+
notifyChange(identifier: ResourceKey, namespace: NotificationType, key: string | null): void;
|
|
89
|
+
notifyChange(identifier: ResourceKey | RequestKey, namespace: NotificationType | "added" | "removed" | "updated", key: string | null): void;
|
|
99
90
|
};
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CacheKeyType, RequestKey, ResourceKey } from "../../../types/identifier.js";
|
|
2
2
|
import type { ImmutableRequestInfo } from "../../../types/request.js";
|
|
3
3
|
export interface GenerationMethod {
|
|
4
4
|
(data: ImmutableRequestInfo, bucket: "document"): string | null;
|
|
5
5
|
(data: unknown | {
|
|
6
6
|
type: string;
|
|
7
7
|
}, bucket: "record"): string;
|
|
8
|
-
(data: unknown, bucket:
|
|
8
|
+
(data: unknown, bucket: CacheKeyType): string | null;
|
|
9
9
|
}
|
|
10
10
|
export type UpdateMethod = {
|
|
11
|
-
(identifier:
|
|
12
|
-
(identifier:
|
|
11
|
+
(identifier: ResourceKey, newData: unknown, bucket: "record"): void;
|
|
12
|
+
(identifier: RequestKey, newData: unknown, bucket: "document"): void;
|
|
13
|
+
(identifier: {
|
|
14
|
+
lid: string;
|
|
15
|
+
}, newData: unknown, bucket: never): void;
|
|
13
16
|
};
|
|
14
|
-
export type ForgetMethod = (identifier:
|
|
17
|
+
export type ForgetMethod = (identifier: RequestKey | ResourceKey, bucket: CacheKeyType) => void;
|
|
15
18
|
export type ResetMethod = () => void;
|
|
16
19
|
export type KeyInfo = {
|
|
17
20
|
id: string | null;
|
|
18
21
|
type: string;
|
|
19
22
|
};
|
|
20
|
-
export type KeyInfoMethod = (resource: unknown, known:
|
|
23
|
+
export type KeyInfoMethod = (resource: unknown, known: ResourceKey | null) => KeyInfo;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "../../../reactive.js";
|
|
2
2
|
import type { ExtensibleField } from "../../../reactive/-private/schema.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResourceKey } from "../../../types/identifier.js";
|
|
4
4
|
import type { ObjectValue } from "../../../types/json/raw.js";
|
|
5
5
|
import type { Derivation, HashFn, Transformation } from "../../../types/schema/concepts.js";
|
|
6
|
-
import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "../../../types/schema/fields.js";
|
|
6
|
+
import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "../../../types/schema/fields.js";
|
|
7
7
|
export type AttributesSchema = Record<string, LegacyAttributeField>;
|
|
8
8
|
export type RelationshipsSchema = Record<string, LegacyRelationshipField>;
|
|
9
9
|
interface ObjectWithStringTypeProperty {
|
|
@@ -57,7 +57,6 @@ interface ObjectWithStringTypeProperty {
|
|
|
57
57
|
* }
|
|
58
58
|
* ```
|
|
59
59
|
*
|
|
60
|
-
* @class (Interface) SchemaService
|
|
61
60
|
* @public
|
|
62
61
|
*/
|
|
63
62
|
export interface SchemaService {
|
|
@@ -68,52 +67,47 @@ export interface SchemaService {
|
|
|
68
67
|
*
|
|
69
68
|
* @public
|
|
70
69
|
* @deprecated
|
|
71
|
-
* @param {String} type
|
|
72
|
-
* @return {Boolean}
|
|
73
70
|
*/
|
|
74
71
|
doesTypeExist?(type: string): boolean;
|
|
75
72
|
/**
|
|
76
73
|
* Queries whether the SchemaService recognizes `type` as a resource type
|
|
77
74
|
*
|
|
78
75
|
* @public
|
|
79
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
80
|
-
* @return {Boolean}
|
|
81
76
|
*/
|
|
82
|
-
hasResource(resource: ObjectWithStringTypeProperty |
|
|
77
|
+
hasResource(resource: ObjectWithStringTypeProperty | ResourceKey): boolean;
|
|
83
78
|
/**
|
|
84
79
|
* Queries whether the SchemaService recognizes `type` as a resource trait
|
|
85
80
|
*
|
|
86
81
|
* @public
|
|
87
|
-
* @param {String} type
|
|
88
|
-
* @return {Boolean}
|
|
89
82
|
*/
|
|
90
83
|
hasTrait(type: string): boolean;
|
|
91
84
|
/**
|
|
92
85
|
* Queries whether the given resource has the given trait
|
|
93
86
|
*
|
|
94
87
|
* @public
|
|
95
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
96
|
-
* @param {String} trait
|
|
97
|
-
* @return {Boolean}
|
|
98
88
|
*/
|
|
99
|
-
resourceHasTrait(resource: ObjectWithStringTypeProperty |
|
|
89
|
+
resourceHasTrait(resource: ObjectWithStringTypeProperty | ResourceKey, trait: string): boolean;
|
|
100
90
|
/**
|
|
101
91
|
* Queries for the fields of a given resource type or resource identity.
|
|
102
92
|
*
|
|
103
93
|
* Should error if the resource type is not recognized.
|
|
104
94
|
*
|
|
105
95
|
* @public
|
|
106
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
107
|
-
* @return {Map<string, FieldSchema>}
|
|
108
96
|
*/
|
|
109
|
-
fields(resource: ObjectWithStringTypeProperty |
|
|
97
|
+
fields(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, FieldSchema>;
|
|
98
|
+
/**
|
|
99
|
+
* Queries for the fields of a given resource type or resource identity.
|
|
100
|
+
*
|
|
101
|
+
* Should error if the resource type is not recognized.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
cacheFields?(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
110
106
|
/**
|
|
111
107
|
* Returns the transformation registered with the name provided
|
|
112
108
|
* by `field.type`. Validates that the field is a valid transformable.
|
|
113
109
|
*
|
|
114
110
|
* @public
|
|
115
|
-
* @param {TransformableField|ObjectWithStringTypeProperty} field
|
|
116
|
-
* @return {Transformation}
|
|
117
111
|
*/
|
|
118
112
|
transformation(field: GenericField | ObjectField | ArrayField | ObjectWithStringTypeProperty): Transformation;
|
|
119
113
|
/**
|
|
@@ -121,8 +115,6 @@ export interface SchemaService {
|
|
|
121
115
|
* by `field.type`. Validates that the field is a valid HashField.
|
|
122
116
|
*
|
|
123
117
|
* @public
|
|
124
|
-
* @param {HashField|ObjectWithStringTypeProperty} field
|
|
125
|
-
* @return {HashFn}
|
|
126
118
|
*/
|
|
127
119
|
hashFn(field: HashField | ObjectWithStringTypeProperty): HashFn;
|
|
128
120
|
/**
|
|
@@ -130,18 +122,14 @@ export interface SchemaService {
|
|
|
130
122
|
* by `field.type`. Validates that the field is a valid DerivedField.
|
|
131
123
|
*
|
|
132
124
|
* @public
|
|
133
|
-
* @param {DerivedField|ObjectWithStringTypeProperty} field
|
|
134
|
-
* @return {Derivation}
|
|
135
125
|
*/
|
|
136
126
|
derivation(field: DerivedField | ObjectWithStringTypeProperty): Derivation;
|
|
137
127
|
/**
|
|
138
128
|
* Returns the schema for the provided resource type.
|
|
139
129
|
*
|
|
140
130
|
* @public
|
|
141
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
142
|
-
* @return {ResourceSchema}
|
|
143
131
|
*/
|
|
144
|
-
resource(resource: ObjectWithStringTypeProperty |
|
|
132
|
+
resource(resource: ObjectWithStringTypeProperty | ResourceKey): Schema;
|
|
145
133
|
/**
|
|
146
134
|
* Enables registration of multiple Schemas at once.
|
|
147
135
|
*
|
|
@@ -150,7 +138,6 @@ export interface SchemaService {
|
|
|
150
138
|
* or other sources just-in-time.
|
|
151
139
|
*
|
|
152
140
|
* @public
|
|
153
|
-
* @param {Schema[]} schemas
|
|
154
141
|
*/
|
|
155
142
|
registerResources(schemas: Schema[]): void;
|
|
156
143
|
/**
|
|
@@ -163,7 +150,6 @@ export interface SchemaService {
|
|
|
163
150
|
* or other sources just-in-time.
|
|
164
151
|
*
|
|
165
152
|
* @public
|
|
166
|
-
* @param {Schema} schema
|
|
167
153
|
*/
|
|
168
154
|
registerResource(schema: Schema): void;
|
|
169
155
|
/**
|
|
@@ -173,7 +159,6 @@ export interface SchemaService {
|
|
|
173
159
|
* attached to it's `[Type]` property.
|
|
174
160
|
*
|
|
175
161
|
* @public
|
|
176
|
-
* @param {Transformation} transform
|
|
177
162
|
*/
|
|
178
163
|
registerTransformation(transform: Transformation): void;
|
|
179
164
|
/**
|
|
@@ -183,7 +168,6 @@ export interface SchemaService {
|
|
|
183
168
|
* attached to it's `[Type]` property.
|
|
184
169
|
*
|
|
185
170
|
* @public
|
|
186
|
-
* @param {Derivation} derivation
|
|
187
171
|
*/
|
|
188
172
|
registerDerivation<
|
|
189
173
|
R,
|
|
@@ -197,7 +181,6 @@ export interface SchemaService {
|
|
|
197
181
|
* attached to it's `[Type]` property.
|
|
198
182
|
*
|
|
199
183
|
* @public
|
|
200
|
-
* @param {HashFn} hashfn
|
|
201
184
|
*/
|
|
202
185
|
registerHashFn(hashFn: HashFn): void;
|
|
203
186
|
/**
|
|
@@ -269,10 +252,8 @@ export interface SchemaService {
|
|
|
269
252
|
*
|
|
270
253
|
* @public
|
|
271
254
|
* @deprecated
|
|
272
|
-
* @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
|
|
273
|
-
* @return {AttributesSchema}
|
|
274
255
|
*/
|
|
275
|
-
attributesDefinitionFor?(
|
|
256
|
+
attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
|
|
276
257
|
/**
|
|
277
258
|
* DEPRECATED - use `fields` instead
|
|
278
259
|
*
|
|
@@ -350,37 +331,44 @@ export interface SchemaService {
|
|
|
350
331
|
*
|
|
351
332
|
* @public
|
|
352
333
|
* @deprecated
|
|
353
|
-
* @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
|
|
354
|
-
* @return {RelationshipsSchema}
|
|
355
334
|
*/
|
|
356
|
-
relationshipsDefinitionFor?(
|
|
335
|
+
relationshipsDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): RelationshipsSchema;
|
|
357
336
|
/**
|
|
358
337
|
* Returns all known resource types
|
|
359
338
|
*
|
|
360
339
|
* @public
|
|
361
|
-
* @return {String[]}
|
|
362
340
|
*/
|
|
363
341
|
resourceTypes(): Readonly<string[]>;
|
|
364
342
|
/**
|
|
365
343
|
* Register an extension for either objects or arrays
|
|
344
|
+
*
|
|
345
|
+
* @public
|
|
366
346
|
*/
|
|
367
347
|
CAUTION_MEGA_DANGER_ZONE_registerExtension?(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
368
348
|
/**
|
|
369
349
|
* Retrieve the extension map for a resource
|
|
350
|
+
*
|
|
351
|
+
* @public
|
|
370
352
|
*/
|
|
371
|
-
CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource:
|
|
353
|
+
CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: ResourceKey | {
|
|
372
354
|
type: string;
|
|
373
355
|
}): null | ProcessedExtension["features"];
|
|
374
356
|
/**
|
|
375
357
|
* Retrieve the extension map for an object field
|
|
358
|
+
*
|
|
359
|
+
* @public
|
|
376
360
|
*/
|
|
377
|
-
CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
361
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
378
362
|
/**
|
|
379
363
|
* Retrieve the extension map for an array field
|
|
364
|
+
*
|
|
365
|
+
* @public
|
|
380
366
|
*/
|
|
381
367
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
382
368
|
/**
|
|
383
369
|
* Check if a specific extension has been registered previously
|
|
370
|
+
*
|
|
371
|
+
* @public
|
|
384
372
|
*/
|
|
385
373
|
CAUTION_MEGA_DANGER_ZONE_hasExtension?(ext: {
|
|
386
374
|
kind: "object" | "array";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Value } from "../../../types/json/raw.js";
|
|
2
|
-
|
|
3
|
-
export interface BaseFinderOptions<T = unknown> {
|
|
2
|
+
export interface BaseFinderOptions {
|
|
4
3
|
reload?: boolean;
|
|
5
4
|
backgroundReload?: boolean;
|
|
6
|
-
include?:
|
|
5
|
+
include?: string | string[];
|
|
7
6
|
adapterOptions?: Record<string, unknown>;
|
|
8
7
|
}
|
|
9
|
-
export interface FindRecordOptions
|
|
8
|
+
export interface FindRecordOptions extends BaseFinderOptions {
|
|
10
9
|
/**
|
|
11
10
|
* Data to preload into the store before the request is made.
|
|
12
11
|
* This feature is *highly* discouraged and has no corresponding
|
|
@@ -25,8 +24,8 @@ export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
|
|
|
25
24
|
preload?: Record<string, Value>;
|
|
26
25
|
}
|
|
27
26
|
export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
|
|
28
|
-
export type FindAllOptions
|
|
29
|
-
export type LegacyResourceQuery
|
|
30
|
-
include?:
|
|
27
|
+
export type FindAllOptions = BaseFinderOptions;
|
|
28
|
+
export type LegacyResourceQuery = {
|
|
29
|
+
include?: string | string[];
|
|
31
30
|
[key: string]: Value | undefined;
|
|
32
31
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NewResourceKey, ResourceKey } from "../../types/identifier.js";
|
|
2
2
|
import type { Value } from "../../types/json/raw.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
|
|
4
4
|
import type { LegacyAttributeField, LegacyRelationshipField } from "../../types/schema/fields.js";
|
|
5
5
|
import type { SingleResourceDocument } from "../../types/spec/json-api-raw.js";
|
|
6
6
|
import { type InstanceCache } from "../-private.js";
|
|
7
7
|
import type { Store } from "./store.js";
|
|
8
|
-
export declare function preloadData(store: Store, identifier:
|
|
9
|
-
export interface BaseFinderOptions
|
|
8
|
+
export declare function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void;
|
|
9
|
+
export interface BaseFinderOptions {
|
|
10
10
|
reload?: boolean;
|
|
11
11
|
backgroundReload?: boolean;
|
|
12
|
-
include?:
|
|
12
|
+
include?: string | string[];
|
|
13
13
|
adapterOptions?: Record<string, unknown>;
|
|
14
14
|
}
|
|
15
|
-
export interface FindRecordOptions
|
|
15
|
+
export interface FindRecordOptions extends BaseFinderOptions {
|
|
16
16
|
/**
|
|
17
17
|
* Data to preload into the store before the request is made.
|
|
18
18
|
* This feature is *highly* discouraged and has no corresponding
|
|
@@ -31,9 +31,9 @@ export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
|
|
|
31
31
|
preload?: Record<string, Value>;
|
|
32
32
|
}
|
|
33
33
|
export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
|
|
34
|
-
export type FindAllOptions
|
|
35
|
-
export type LegacyResourceQuery
|
|
36
|
-
include?:
|
|
34
|
+
export type FindAllOptions = BaseFinderOptions;
|
|
35
|
+
export type LegacyResourceQuery = {
|
|
36
|
+
include?: string | string[];
|
|
37
37
|
[key: string]: Value | undefined;
|
|
38
38
|
};
|
|
39
39
|
export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
|
|
@@ -55,7 +55,7 @@ export interface ModelSchema<T = unknown> {
|
|
|
55
55
|
eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
|
|
56
56
|
eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
|
|
57
57
|
}
|
|
58
|
-
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier:
|
|
58
|
+
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean;
|
|
59
59
|
/**
|
|
60
60
|
A `RecordReference` is a low-level API that allows users and
|
|
61
61
|
addon authors to perform meta-operations on a record.
|
|
@@ -64,18 +64,7 @@ addon authors to perform meta-operations on a record.
|
|
|
64
64
|
@public
|
|
65
65
|
*/
|
|
66
66
|
export declare class RecordReference {
|
|
67
|
-
|
|
68
|
-
private store;
|
|
69
|
-
// unsubscribe token given to us by the notification manager
|
|
70
|
-
/** @internal */
|
|
71
|
-
private ___token;
|
|
72
|
-
/** @internal */
|
|
73
|
-
private ___identifier;
|
|
74
|
-
/** @internal */
|
|
75
|
-
private _ref;
|
|
76
|
-
constructor(store: Store, identifier: StableRecordIdentifier);
|
|
77
|
-
/** @internal */
|
|
78
|
-
destroy(): void;
|
|
67
|
+
constructor(store: Store, identifier: ResourceKey);
|
|
79
68
|
get type(): string;
|
|
80
69
|
/**
|
|
81
70
|
The `id` of the record that this reference refers to.
|
|
@@ -112,7 +101,7 @@ export declare class RecordReference {
|
|
|
112
101
|
@public
|
|
113
102
|
@return The identifier of the record.
|
|
114
103
|
*/
|
|
115
|
-
identifier():
|
|
104
|
+
identifier(): ResourceKey;
|
|
116
105
|
/**
|
|
117
106
|
How the reference will be looked up when it is loaded. Currently
|
|
118
107
|
this always returns `identity` to signify that a record will be
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TypeFromInstance } from "../../types/record.js";
|
|
2
2
|
import type { ResourceIdentifierObject } from "../../types/spec/json-api-raw.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { LegacyLiveArray, LegacyQueryArray } from "../-private.js";
|
|
4
4
|
import { Store } from "../-private/store-service.js";
|
|
5
5
|
import type { FindAllOptions, FindRecordOptions, LegacyResourceQuery, ModelSchema, QueryOptions } from "./-private.js";
|
|
6
6
|
import { RecordReference } from "./-private.js";
|
|
@@ -363,11 +363,11 @@ declare module "../-private/store-service" {
|
|
|
363
363
|
@param id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved
|
|
364
364
|
@param options - if the first param is a string this will be the optional options for the request. See examples for available options.
|
|
365
365
|
*/
|
|
366
|
-
findRecord<T>(type: TypeFromInstance<T>, id: string | number, options?: FindRecordOptions
|
|
366
|
+
findRecord<T>(type: TypeFromInstance<T>, id: string | number, options?: FindRecordOptions): Promise<T>;
|
|
367
367
|
/** @deprecated */
|
|
368
368
|
findRecord(type: string, id: string | number, options?: FindRecordOptions): Promise<unknown>;
|
|
369
369
|
/** @deprecated */
|
|
370
|
-
findRecord<T>(resource: ResourceIdentifierObject<TypeFromInstance<T>>, options?: FindRecordOptions
|
|
370
|
+
findRecord<T>(resource: ResourceIdentifierObject<TypeFromInstance<T>>, options?: FindRecordOptions): Promise<T>;
|
|
371
371
|
/** @deprecated */
|
|
372
372
|
findRecord(resource: ResourceIdentifierObject, options?: FindRecordOptions): Promise<unknown>;
|
|
373
373
|
/**
|
|
@@ -548,9 +548,9 @@ declare module "../-private/store-service" {
|
|
|
548
548
|
@param type the name of the resource
|
|
549
549
|
@param options
|
|
550
550
|
*/
|
|
551
|
-
findAll<T>(type: TypeFromInstance<T>, options?: FindAllOptions
|
|
551
|
+
findAll<T>(type: TypeFromInstance<T>, options?: FindAllOptions): Promise<LegacyLiveArray<T>>;
|
|
552
552
|
/** @deprecated */
|
|
553
|
-
findAll(type: string, options?: FindAllOptions): Promise<
|
|
553
|
+
findAll(type: string, options?: FindAllOptions): Promise<LegacyLiveArray>;
|
|
554
554
|
/**
|
|
555
555
|
This method delegates a query to the adapter. This is the one place where
|
|
556
556
|
adapter-level semantics are exposed to the application.
|
|
@@ -565,13 +565,13 @@ declare module "../-private/store-service" {
|
|
|
565
565
|
|
|
566
566
|
If you do something like this:
|
|
567
567
|
|
|
568
|
-
```
|
|
568
|
+
```js
|
|
569
569
|
store.query('person', { page: 1 });
|
|
570
570
|
```
|
|
571
571
|
|
|
572
572
|
The request made to the server will look something like this:
|
|
573
573
|
|
|
574
|
-
```
|
|
574
|
+
```http
|
|
575
575
|
GET "/api/v1/person?page=1"
|
|
576
576
|
```
|
|
577
577
|
|
|
@@ -591,8 +591,7 @@ declare module "../-private/store-service" {
|
|
|
591
591
|
```
|
|
592
592
|
|
|
593
593
|
This method returns a promise, which is resolved with a
|
|
594
|
-
|
|
595
|
-
once the server returns.
|
|
594
|
+
{@link LegacyQueryArray} once the server returns.
|
|
596
595
|
|
|
597
596
|
@public
|
|
598
597
|
@deprecated use {@link Store.request} instead
|
|
@@ -602,9 +601,9 @@ declare module "../-private/store-service" {
|
|
|
602
601
|
@param query a query to be used by the adapter
|
|
603
602
|
@param options optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
604
603
|
*/
|
|
605
|
-
query<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery
|
|
604
|
+
query<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryOptions): Promise<LegacyQueryArray<T>>;
|
|
606
605
|
/** @deprecated */
|
|
607
|
-
query(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<
|
|
606
|
+
query(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<LegacyQueryArray>;
|
|
608
607
|
/**
|
|
609
608
|
This method makes a request for one record, where the `id` is not known
|
|
610
609
|
beforehand (if the `id` is known, use [`findRecord`](../methods/findRecord?anchor=findRecord)
|
|
@@ -704,7 +703,7 @@ declare module "../-private/store-service" {
|
|
|
704
703
|
@param options optional, may include `adapterOptions` hash which will be passed to adapter.queryRecord
|
|
705
704
|
@return promise which resolves with the found record or `null`
|
|
706
705
|
*/
|
|
707
|
-
queryRecord<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery
|
|
706
|
+
queryRecord<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryOptions): Promise<T | null>;
|
|
708
707
|
/** @deprecated */
|
|
709
708
|
queryRecord(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<unknown | null>;
|
|
710
709
|
/**
|
|
@@ -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
|