@warp-drive/core 5.7.0-alpha.0 → 5.7.0-alpha.10

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.
Files changed (48) hide show
  1. package/declarations/reactive/-private/default-mode.d.ts +73 -0
  2. package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
  3. package/declarations/reactive/-private/fields/managed-array.d.ts +3 -5
  4. package/declarations/reactive/-private/fields/managed-object.d.ts +5 -3
  5. package/declarations/reactive/-private/kind/alias-field.d.ts +4 -0
  6. package/declarations/reactive/-private/kind/array-field.d.ts +4 -0
  7. package/declarations/reactive/-private/kind/attribute-field.d.ts +4 -0
  8. package/declarations/reactive/-private/kind/belongs-to-field.d.ts +4 -0
  9. package/declarations/reactive/-private/kind/collection-field.d.ts +4 -0
  10. package/declarations/reactive/-private/kind/derived-field.d.ts +4 -0
  11. package/declarations/reactive/-private/kind/generic-field.d.ts +4 -0
  12. package/declarations/reactive/-private/kind/has-many-field.d.ts +4 -0
  13. package/declarations/reactive/-private/kind/hash-field.d.ts +4 -0
  14. package/declarations/reactive/-private/kind/identity-field.d.ts +4 -0
  15. package/declarations/reactive/-private/kind/local-field.d.ts +4 -0
  16. package/declarations/reactive/-private/kind/object-field.d.ts +4 -0
  17. package/declarations/reactive/-private/kind/resource-field.d.ts +4 -0
  18. package/declarations/reactive/-private/kind/schema-array-field.d.ts +4 -0
  19. package/declarations/reactive/-private/kind/schema-object-field.d.ts +4 -0
  20. package/declarations/reactive/-private/record.d.ts +2 -4
  21. package/declarations/reactive/-private/schema.d.ts +47 -3
  22. package/declarations/reactive.d.ts +1 -0
  23. package/declarations/request/-private/fetch.d.ts +2 -0
  24. package/declarations/store/-private/caches/instance-cache.d.ts +1 -8
  25. package/declarations/store/-private/store-service.d.ts +17 -777
  26. package/declarations/store/-private.d.ts +3 -2
  27. package/declarations/store/-types/q/schema-service.d.ts +56 -32
  28. package/declarations/store/-types/q/store.d.ts +6 -7
  29. package/declarations/store/deprecated/-private.d.ts +235 -0
  30. package/declarations/store/deprecated/store.d.ts +788 -0
  31. package/declarations/types/cache.d.ts +0 -2
  32. package/declarations/types/params.d.ts +2 -3
  33. package/declarations/types/request.d.ts +6 -6
  34. package/declarations/types/schema/fields.d.ts +361 -11
  35. package/declarations/types.d.ts +2 -1
  36. package/dist/graph/-private.js +1 -1
  37. package/dist/{handler-C2T-IyJK.js → handler-SdXlte1w.js} +1 -1
  38. package/dist/index.js +2 -2
  39. package/dist/reactive.js +1287 -589
  40. package/dist/{request-state-CjLph1LP.js → request-state-CeN66aML.js} +851 -1346
  41. package/dist/store/-private.js +2 -2
  42. package/dist/types/-private.js +1 -1
  43. package/dist/types/schema/fields.js +17 -2
  44. package/package.json +3 -3
  45. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
  46. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
  47. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
  48. package/declarations/store/-types/q/ds-model.d.ts +0 -21
@@ -1,4 +1,5 @@
1
- export { Store, storeFor } from "./-private/store-service.js";
1
+ export { Store } from "./deprecated/store.js";
2
+ export { storeFor } from "./-private/store-service.js";
2
3
  export { recordIdentifierFor } from "./-private/caches/instance-cache.js";
3
4
  export { CacheHandler, type StoreRequestContext } from "./-private/cache-handler/handler.js";
4
5
  export { type CachePolicy } from "./-private/cache-handler/types.js";
@@ -27,5 +28,5 @@ export { getPromiseState, type PromiseState } from "./-private/new-core-tmp/prom
27
28
  export { DISPOSE, createRequestSubscription, type SubscriptionArgs, type RequestSubscription } from "./-private/new-core-tmp/request-subscription.js";
28
29
  export { getRequestState, type RequestLoadingState, type RequestCacheRequestState as RequestState } from "./-private/new-core-tmp/request-state.js";
29
30
  export { createMemo, type SignalHooks, waitFor } from "./-private/new-core-tmp/reactivity/configure.js";
30
- export { memoized, gate, entangleSignal, defineSignal, defineNonEnumerableSignal } from "./-private/new-core-tmp/reactivity/signal.js";
31
+ export { memoized, gate, entangleSignal, defineSignal, defineGate, defineNonEnumerableSignal } from "./-private/new-core-tmp/reactivity/signal.js";
31
32
  export { ARRAY_SIGNAL, OBJECT_SIGNAL, Signals, type WarpDriveSignal, peekInternalSignal, withSignalStore, notifyInternalSignal, consumeInternalSignal, getOrCreateInternalSignal } from "./-private/new-core-tmp/reactivity/internal.js";
@@ -3,7 +3,7 @@ import type { ExtensibleField } from "../../../reactive/-private/schema.js";
3
3
  import type { RecordIdentifier, StableRecordIdentifier } 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 } 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,33 +67,24 @@ 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
77
  hasResource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): 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
89
  resourceHasTrait(resource: ObjectWithStringTypeProperty | StableRecordIdentifier, trait: string): boolean;
100
90
  /**
@@ -103,17 +93,21 @@ export interface SchemaService {
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
97
  fields(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Map<string, FieldSchema>;
110
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 | StableRecordIdentifier): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
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,16 +122,12 @@ 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
132
  resource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Schema;
145
133
  /**
@@ -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,10 +181,38 @@ 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
  /**
187
+ * Registers a {@link Trait} for use by resource schemas.
188
+ *
189
+ * Traits are re-usable collections of fields that can be composed to
190
+ * build up a resource schema. Often they represent polymorphic behaviors
191
+ * a resource should exhibit.
192
+ *
193
+ * When we finalize a resource, we walk its traits and apply their fields
194
+ * to the resource's fields. All specified traits must be registered by
195
+ * this time or an error will be thrown.
196
+ *
197
+ * Traits are applied left-to-right, with traits of traits being applied in the same
198
+ * way. Thus for the most part, application of traits is a post-order graph traversal
199
+ * problem.
200
+ *
201
+ * A trait is only ever processed once. If multiple traits (A, B, C) have the same
202
+ * trait (D) as a dependency, D will be included only once when first encountered by
203
+ * A.
204
+ *
205
+ * If a cycle exists such that trait A has trait B which has Trait A, trait A will
206
+ * be applied *after* trait B in production. In development a cycle error will be thrown.
207
+ *
208
+ * Fields are finalized on a "last wins principle". Thus traits appearing higher in
209
+ * the tree and further to the right of a traits array take precedence, with the
210
+ * resource's fields always being applied last and winning out.
211
+ *
212
+ * @public
213
+ */
214
+ registerTrait?(trait: Trait): void;
215
+ /**
204
216
  * DEPRECATED - use `fields` instead
205
217
  *
206
218
  * Returns definitions for all properties of the specified resource
@@ -240,8 +252,6 @@ export interface SchemaService {
240
252
  *
241
253
  * @public
242
254
  * @deprecated
243
- * @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
244
- * @return {AttributesSchema}
245
255
  */
246
256
  attributesDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): AttributesSchema;
247
257
  /**
@@ -321,34 +331,48 @@ export interface SchemaService {
321
331
  *
322
332
  * @public
323
333
  * @deprecated
324
- * @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
325
- * @return {RelationshipsSchema}
326
334
  */
327
335
  relationshipsDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): RelationshipsSchema;
328
336
  /**
329
337
  * Returns all known resource types
330
338
  *
331
339
  * @public
332
- * @return {String[]}
333
340
  */
334
341
  resourceTypes(): Readonly<string[]>;
335
342
  /**
336
343
  * Register an extension for either objects or arrays
344
+ *
345
+ * @public
337
346
  */
338
347
  CAUTION_MEGA_DANGER_ZONE_registerExtension?(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
339
348
  /**
340
349
  * Retrieve the extension map for a resource
350
+ *
351
+ * @public
341
352
  */
342
353
  CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: StableRecordIdentifier | {
343
354
  type: string;
344
355
  }): null | ProcessedExtension["features"];
345
356
  /**
346
357
  * Retrieve the extension map for an object field
358
+ *
359
+ * @public
347
360
  */
348
- CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
361
+ CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
349
362
  /**
350
363
  * Retrieve the extension map for an array field
364
+ *
365
+ * @public
351
366
  */
352
367
  CAUTION_MEGA_DANGER_ZONE_arrayExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
368
+ /**
369
+ * Check if a specific extension has been registered previously
370
+ *
371
+ * @public
372
+ */
373
+ CAUTION_MEGA_DANGER_ZONE_hasExtension?(ext: {
374
+ kind: "object" | "array";
375
+ name: string;
376
+ }): boolean;
353
377
  }
354
378
  export {};
@@ -1,12 +1,11 @@
1
1
  import type { Value } from "../../../types/json/raw.js";
2
- import type { Includes, TypedRecordInstance } from "../../../types/record.js";
3
- export interface BaseFinderOptions<T = unknown> {
2
+ export interface BaseFinderOptions {
4
3
  reload?: boolean;
5
4
  backgroundReload?: boolean;
6
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
5
+ include?: string | string[];
7
6
  adapterOptions?: Record<string, unknown>;
8
7
  }
9
- export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
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<T = unknown> = BaseFinderOptions<T>;
29
- export type LegacyResourceQuery<T = unknown> = {
30
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
27
+ export type FindAllOptions = BaseFinderOptions;
28
+ export type LegacyResourceQuery = {
29
+ include?: string | string[];
31
30
  [key: string]: Value | undefined;
32
31
  };
@@ -0,0 +1,235 @@
1
+ import type { StableNewRecordIdentifier, StableRecordIdentifier } from "../../types/identifier.js";
2
+ import type { Value } from "../../types/json/raw.js";
3
+ import type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
4
+ import type { LegacyAttributeField, LegacyRelationshipField } from "../../types/schema/fields.js";
5
+ import type { SingleResourceDocument } from "../../types/spec/json-api-raw.js";
6
+ import { type InstanceCache } from "../-private.js";
7
+ import type { Store } from "./store.js";
8
+ export declare function preloadData(store: Store, identifier: StableNewRecordIdentifier, preload: Record<string, Value>): void;
9
+ export interface BaseFinderOptions {
10
+ reload?: boolean;
11
+ backgroundReload?: boolean;
12
+ include?: string | string[];
13
+ adapterOptions?: Record<string, unknown>;
14
+ }
15
+ export interface FindRecordOptions extends BaseFinderOptions {
16
+ /**
17
+ * Data to preload into the store before the request is made.
18
+ * This feature is *highly* discouraged and has no corresponding
19
+ * feature when using builders and handlers.
20
+ *
21
+ * Excepting relationships: the data should be in the form of a
22
+ * JSON object where the keys are fields on the record and the value
23
+ * is the raw value to be added to the cache.
24
+ *
25
+ * Relationships can either be provided as string IDs from which
26
+ * an identifier will be built base upon the relationship's expected
27
+ * resource type, or be record instances from which the identifier
28
+ * will be extracted.
29
+ *
30
+ */
31
+ preload?: Record<string, Value>;
32
+ }
33
+ export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
34
+ export type FindAllOptions = BaseFinderOptions;
35
+ export type LegacyResourceQuery = {
36
+ include?: string | string[];
37
+ [key: string]: Value | undefined;
38
+ };
39
+ export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
40
+ /**
41
+ * Minimum subset of static schema methods and properties on the
42
+ * "model" class.
43
+ *
44
+ * Only used when using the legacy schema-service implementation
45
+ * for @ember-data/model or when wrapping schema for legacy
46
+ * Adapters/Serializers.
47
+ *
48
+ */
49
+ export interface ModelSchema<T = unknown> {
50
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
51
+ fields: Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
52
+ attributes: Map<KeyOrString<T>, LegacyAttributeField>;
53
+ relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;
54
+ eachAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
55
+ eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
56
+ eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
57
+ }
58
+ export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean;
59
+ /**
60
+ A `RecordReference` is a low-level API that allows users and
61
+ addon authors to perform meta-operations on a record.
62
+
63
+ @hideconstructor
64
+ @public
65
+ */
66
+ export declare class RecordReference {
67
+ /** @internal */
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;
79
+ get type(): string;
80
+ /**
81
+ The `id` of the record that this reference refers to.
82
+
83
+ Together, the `type` and `id` properties form a composite key for
84
+ the identity map.
85
+
86
+ Example
87
+
88
+ ```javascript
89
+ let userRef = store.getReference('user', 1);
90
+
91
+ userRef.id(); // '1'
92
+ ```
93
+
94
+ @public
95
+ @return The id of the record.
96
+ */
97
+ id(): string | null;
98
+ /**
99
+ The `identifier` of the record that this reference refers to.
100
+
101
+ Together, the `type` and `id` properties form a composite key for
102
+ the identity map.
103
+
104
+ Example
105
+
106
+ ```javascript
107
+ let userRef = store.getReference('user', 1);
108
+
109
+ userRef.identifier(); // '1'
110
+ ```
111
+
112
+ @public
113
+ @return The identifier of the record.
114
+ */
115
+ identifier(): StableRecordIdentifier;
116
+ /**
117
+ How the reference will be looked up when it is loaded. Currently
118
+ this always returns `identity` to signify that a record will be
119
+ loaded by its `type` and `id`.
120
+
121
+ Example
122
+
123
+ ```javascript
124
+ const userRef = store.getReference('user', 1);
125
+
126
+ userRef.remoteType(); // 'identity'
127
+ ```
128
+
129
+ @public
130
+ */
131
+ remoteType(): "identity";
132
+ /**
133
+ This API allows you to provide a reference with new data. The
134
+ simplest usage of this API is similar to `store.push`: you provide a
135
+ normalized hash of data and the object represented by the reference
136
+ will update.
137
+
138
+ If you pass a promise to `push`, Ember Data will not ask the adapter
139
+ for the data if another attempt to fetch it is made in the
140
+ interim. When the promise resolves, the underlying object is updated
141
+ with the new data, and the promise returned by *this function* is resolved
142
+ with that object.
143
+
144
+ For example, `recordReference.push(promise)` will be resolved with a
145
+ record.
146
+
147
+ Example
148
+
149
+ ```javascript
150
+ let userRef = store.getReference('user', 1);
151
+
152
+ // provide data for reference
153
+ userRef.push({
154
+ data: {
155
+ id: "1",
156
+ type: "user",
157
+ attributes: {
158
+ username: "@user"
159
+ }
160
+ }
161
+ }).then(function(user) {
162
+ userRef.value() === user;
163
+ });
164
+ ```
165
+
166
+ @public
167
+ @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one
168
+ @return a promise for the value (record or relationship)
169
+ */
170
+ push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance>;
171
+ /**
172
+ If the entity referred to by the reference is already loaded, it is
173
+ present as `reference.value`. Otherwise the value returned by this function
174
+ is `null`.
175
+
176
+ Example
177
+
178
+ ```javascript
179
+ let userRef = store.getReference('user', 1);
180
+
181
+ userRef.value(); // user
182
+ ```
183
+
184
+ @public
185
+ @return the record for this RecordReference
186
+ */
187
+ value(): OpaqueRecordInstance | null;
188
+ /**
189
+ Triggers a fetch for the backing entity based on its `remoteType`
190
+ (see `remoteType` definitions per reference type).
191
+
192
+ Example
193
+
194
+ ```javascript
195
+ let userRef = store.getReference('user', 1);
196
+
197
+ // load user (via store.find)
198
+ userRef.load().then(...)
199
+ ```
200
+
201
+ @public
202
+ @return the record for this RecordReference
203
+ */
204
+ load(): Promise<unknown>;
205
+ /**
206
+ Reloads the record if it is already loaded. If the record is not
207
+ loaded it will load the record via `store.findRecord`
208
+
209
+ Example
210
+
211
+ ```javascript
212
+ let userRef = store.getReference('user', 1);
213
+
214
+ // or trigger a reload
215
+ userRef.reload().then(...)
216
+ ```
217
+
218
+ @public
219
+ @return the record for this RecordReference
220
+ */
221
+ reload(): Promise<unknown>;
222
+ }
223
+ export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
224
+ // Mimics the static apis of @ember-data/model
225
+ export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
226
+ __store: Store;
227
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
228
+ constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string);
229
+ get fields(): Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
230
+ get attributes(): Map<KeyOrString<T>, LegacyAttributeField>;
231
+ get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField>;
232
+ eachAttribute<K extends KeyOrString<T>>(callback: (key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
233
+ eachRelationship<K extends KeyOrString<T>>(callback: (key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
234
+ eachTransformedAttribute<K extends KeyOrString<T>>(callback: (key: K, type: string | null) => void, binding?: T): void;
235
+ }