@warp-drive/core 5.7.0-alpha.1 → 5.7.0-alpha.11

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 (46) 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 +5 -8
  4. package/declarations/reactive/-private/fields/managed-object.d.ts +7 -9
  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 +6 -21
  21. package/declarations/reactive/-private/schema.d.ts +6 -2
  22. package/declarations/reactive/-private/symbols.d.ts +1 -6
  23. package/declarations/reactive/-private.d.ts +1 -1
  24. package/declarations/reactive.d.ts +1 -0
  25. package/declarations/request/-private/fetch.d.ts +2 -0
  26. package/declarations/store/-types/q/schema-service.d.ts +27 -32
  27. package/declarations/store/-types/q/store.d.ts +6 -7
  28. package/declarations/store/deprecated/-private.d.ts +7 -7
  29. package/declarations/store/deprecated/store.d.ts +5 -5
  30. package/declarations/types/-private.d.ts +1 -1
  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 +377 -13
  35. package/dist/graph/-private.js +1 -1
  36. package/dist/{handler-D2jjnIA-.js → handler-SdXlte1w.js} +1 -1
  37. package/dist/index.js +2 -2
  38. package/dist/reactive/-private.js +1 -1
  39. package/dist/reactive.js +1171 -603
  40. package/dist/{request-state-CejVJgdj.js → request-state-CeN66aML.js} +12 -10
  41. package/dist/store/-private.js +2 -2
  42. package/dist/{symbols-SIstXMLI.js → symbols-BoONANuz.js} +2 -7
  43. package/dist/types/-private.js +1 -1
  44. package/dist/types/schema/fields.js +21 -2
  45. package/package.json +3 -3
  46. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
@@ -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<T>): Promise<T>;
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<T>): Promise<T>;
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,7 +548,7 @@ 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<T>): Promise<LiveArray<T>>;
551
+ findAll<T>(type: TypeFromInstance<T>, options?: FindAllOptions): Promise<LiveArray<T>>;
552
552
  /** @deprecated */
553
553
  findAll(type: string, options?: FindAllOptions): Promise<LiveArray>;
554
554
  /**
@@ -602,7 +602,7 @@ declare module "../-private/store-service" {
602
602
  @param query a query to be used by the adapter
603
603
  @param options optional, may include `adapterOptions` hash which will be passed to adapter.query
604
604
  */
605
- query<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryOptions): Promise<CollectionRecordArray<T>>;
605
+ query<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryOptions): Promise<CollectionRecordArray<T>>;
606
606
  /** @deprecated */
607
607
  query(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<CollectionRecordArray>;
608
608
  /**
@@ -704,7 +704,7 @@ declare module "../-private/store-service" {
704
704
  @param options optional, may include `adapterOptions` hash which will be passed to adapter.queryRecord
705
705
  @return promise which resolves with the found record or `null`
706
706
  */
707
- queryRecord<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryOptions): Promise<T | null>;
707
+ queryRecord<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery, options?: QueryOptions): Promise<T | null>;
708
708
  /** @deprecated */
709
709
  queryRecord(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<unknown | null>;
710
710
  /**
@@ -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" | "CacheForIdentifierCache" | "RecordCache" | "StoreMap" | "Store" | "$type" | "TransformName" | "RequestSignature" | "IS_FUTURE" | "DOC" | "ManagedArrayMap" | "ManagedObjectMap" | "Support" | "SOURCE" | "MUTATE" | "Destroy" | "Identifier" | "Editable" | "EmbeddedPath" | "EmbeddedField" | "Parent" | "Checkout" | "Legacy";
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" | "CacheForIdentifierCache" | "RecordCache" | "StoreMap" | "Store" | "$type" | "TransformName" | "RequestSignature" | "IS_FUTURE" | "DOC" | "ManagedArrayMap" | "ManagedObjectMap" | "Support" | "SOURCE" | "MUTATE" | "Destroy" | "Checkout" | "Context";
5
5
  type UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;
6
6
  type UniqueSymbolOr<
7
7
  T,
@@ -461,8 +461,6 @@ export interface Cache {
461
461
  * Query the cache for any validation errors applicable to the given resource.
462
462
  *
463
463
  * @public
464
- * @param identifier
465
- * @return {JsonApiError[]}
466
464
  */
467
465
  getErrors(identifier: StableRecordIdentifier): ApiError[];
468
466
  /**
@@ -1,9 +1,8 @@
1
- import type { Includes, TypedRecordInstance } from "./record.js";
2
1
  export type SerializablePrimitive = string | number | boolean | null;
3
2
  export type Serializable = SerializablePrimitive | SerializablePrimitive[];
4
3
  export type QueryParamsSerializationOptions = {
5
4
  arrayFormat?: "bracket" | "indices" | "repeat" | "comma";
6
5
  };
7
- export type QueryParamsSource<T = unknown> = ({
8
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
6
+ export type QueryParamsSource = ({
7
+ include?: string | string[];
9
8
  } & Record<Exclude<string, "include">, Serializable>) | URLSearchParams;
@@ -1,6 +1,6 @@
1
1
  import type { StableRecordIdentifier } from "./identifier.js";
2
2
  import type { QueryParamsSerializationOptions } from "./params.js";
3
- import type { ExtractSuggestedCacheTypes, Includes, TypedRecordInstance, TypeFromInstanceOrString } from "./record.js";
3
+ import type { ExtractSuggestedCacheTypes, TypedRecordInstance, TypeFromInstanceOrString } from "./record.js";
4
4
  import type { ResourceIdentifierObject } from "./spec/json-api-raw.js";
5
5
  import type { RequestSignature } from "./symbols.js";
6
6
  type Store = unknown;
@@ -152,17 +152,17 @@ export type RemotelyAccessibleIdentifier<T extends string = string> = {
152
152
  type: T;
153
153
  lid?: string;
154
154
  };
155
- export type ConstrainedRequestOptions = {
155
+ export interface ConstrainedRequestOptions {
156
156
  reload?: boolean;
157
157
  backgroundReload?: boolean;
158
158
  host?: string;
159
159
  namespace?: string;
160
160
  resourcePath?: string;
161
161
  urlParamsSettings?: QueryParamsSerializationOptions;
162
- };
163
- export type FindRecordOptions<T = unknown> = ConstrainedRequestOptions & {
164
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
165
- };
162
+ }
163
+ export interface FindRecordOptions extends ConstrainedRequestOptions {
164
+ include?: string | string[];
165
+ }
166
166
  export interface StructuredDataDocument<T> {
167
167
  [STRUCTURED]?: true;
168
168
  /**
@@ -1,5 +1,15 @@
1
1
  import type { ObjectValue, PrimitiveValue, Value } from "../json/raw.js";
2
2
  /**
3
+ * Options signature for Legacy Attributes.
4
+ */
5
+ export interface AttrOptions {
6
+ /**
7
+ * A primitive value or a function which produces a value.
8
+ */
9
+ defaultValue?: PrimitiveValue | (() => Value);
10
+ [key: string]: Value | (() => Value) | undefined;
11
+ }
12
+ /**
3
13
  * A generic "field" that can be used to define
4
14
  * primitive value fields.
5
15
  *
@@ -29,7 +39,30 @@ export interface GenericField {
29
39
  */
30
40
  name: string;
31
41
  /**
32
- * the name of the transform to use, if any
42
+ * The name of the field as returned by the API
43
+ * and inserted into the {@link Cache} if it differs
44
+ * from {@link GenericField.name}
45
+ *
46
+ * For instance, if the API returns:
47
+ *
48
+ * ```ts
49
+ * {
50
+ * attributes: {
51
+ * 'first-name': 'Chris'
52
+ * }
53
+ * }
54
+ * ```
55
+ *
56
+ * But the app desires to use `record.firstName; // 'Chris'`
57
+ *
58
+ * Then `name` would be set to `'firstName'` and
59
+ * `sourceKey` would be set to `'first-name'`.
60
+ *
61
+ * This option is only needed when the value differs from name.
62
+ */
63
+ sourceKey?: string;
64
+ /**
65
+ * the name of the {@link Transformation} to use, if any
33
66
  *
34
67
  * @public
35
68
  */
@@ -234,6 +267,27 @@ export interface IdentityField {
234
267
  * @public
235
268
  */
236
269
  name: string;
270
+ /**
271
+ * The name of the field as returned by the API
272
+ * and inserted into the {@link Cache} if it differs
273
+ * from {@link IdentityField.name}
274
+ *
275
+ * For instance, if the API returns:
276
+ *
277
+ * ```ts
278
+ * {
279
+ * entityUrn: '324523-sadf34-345'
280
+ * }
281
+ * ```
282
+ *
283
+ * But the app desires to use `record.id; // '324523-sadf34-345'`
284
+ *
285
+ * Then `name` would be set to `'id'` and
286
+ * `sourceKey` would be set to `'entityUrn'`.
287
+ *
288
+ * This option is only needed when the value differs from name.
289
+ */
290
+ sourceKey?: string;
237
291
  }
238
292
  /**
239
293
  * Represents a specialized field whose computed value
@@ -250,7 +304,7 @@ export interface IdentityField {
250
304
  * perform those itself.
251
305
  *
252
306
  * A schema-array can declare its "key" value to be `@hash` if
253
- * a schema-object has such a field.
307
+ * the schema-objects it contains have such a field.
254
308
  *
255
309
  * Only one hash field is permittable per schema-object, and
256
310
  * it should be placed in the `ResourceSchema`'s `@id` field
@@ -374,6 +428,29 @@ export interface ObjectField {
374
428
  */
375
429
  name: string;
376
430
  /**
431
+ * The name of the field as returned by the API
432
+ * and inserted into the {@link Cache} if it differs
433
+ * from {@link ObjectField.name}
434
+ *
435
+ * For instance, if the API returns:
436
+ *
437
+ * ```ts
438
+ * {
439
+ * attributes: {
440
+ * 'first-name': 'Chris'
441
+ * }
442
+ * }
443
+ * ```
444
+ *
445
+ * But the app desires to use `record.firstName; // 'Chris'`
446
+ *
447
+ * Then `name` would be set to `'firstName'` and
448
+ * `sourceKey` would be set to `'first-name'`.
449
+ *
450
+ * This option is only needed when the value differs from name.
451
+ */
452
+ sourceKey?: string;
453
+ /**
377
454
  * The name of a transform to pass the entire object
378
455
  * through before displaying or serializing it.
379
456
  *
@@ -409,11 +486,13 @@ export interface ObjectField {
409
486
  /**
410
487
  * Represents a field whose value is an object
411
488
  * with a well-defined structure described by
412
- * a non-resource schema.
489
+ * a schema-object (a non-resource schema).
413
490
  *
414
491
  * If the object's structure is not well-defined,
415
492
  * use 'object' instead.
416
493
  *
494
+ * By default, a SchemaObject within
495
+ *
417
496
  * @public
418
497
  */
419
498
  export interface SchemaObjectField {
@@ -430,12 +509,42 @@ export interface SchemaObjectField {
430
509
  */
431
510
  name: string;
432
511
  /**
512
+ * The name of the field as returned by the API
513
+ * and inserted into the {@link Cache} if it differs
514
+ * from {@link SchemaObjectField.name}
515
+ *
516
+ * For instance, if the API returns:
517
+ *
518
+ * ```ts
519
+ * {
520
+ * attributes: {
521
+ * 'first-name': 'Chris'
522
+ * }
523
+ * }
524
+ * ```
525
+ *
526
+ * But the app desires to use `record.firstName; // 'Chris'`
527
+ *
528
+ * Then `name` would be set to `'firstName'` and
529
+ * `sourceKey` would be set to `'first-name'`.
530
+ *
531
+ * This option is only needed when the value differs from name.
532
+ */
533
+ sourceKey?: string;
534
+ /**
535
+ * If the field is not polymorphic:
536
+ *
433
537
  * The name of the ObjectSchema that describes the
434
538
  * structure of the object.
435
539
  *
540
+ * If the field is polymorphic:
541
+ *
542
+ * The name of the hashFn to use to extract
543
+ * the type from the contained value or null.
544
+ *
436
545
  * @public
437
546
  */
438
- type: string;
547
+ type: string | null;
439
548
  /**
440
549
  * Options for configuring the behavior of the
441
550
  * SchemaObject.
@@ -446,6 +555,15 @@ export interface SchemaObjectField {
446
555
  * @public
447
556
  */
448
557
  options?: {
558
+ /**
559
+ * If true, if no value for this field exists in the cache,
560
+ * an empty `{}` will be used as the source for a new SchemaObject
561
+ * of the associated schema type, as opposed to the field's
562
+ * value being `null`.
563
+ *
564
+ * If `polymorphic` is `true`, defaultValue will be considered `false`.
565
+ */
566
+ defaultValue?: boolean;
449
567
  /**
450
568
  * ::: warning ⚠️ Dangerous Feature Ahead
451
569
  * :::
@@ -472,7 +590,15 @@ export interface SchemaObjectField {
472
590
  * If the SchemaObject is Polymorphic, the key on the raw cache data to use
473
591
  * as the "resource-type" value for the schema-object.
474
592
  *
475
- * Defaults to "type".
593
+ * The default is `'type'`.
594
+ *
595
+ * Valid options are:
596
+ *
597
+ * - `'@hash'` : will lookup the `@hash` function specified by
598
+ * SchemaObjectField.type and use it to calculate the type for each value.
599
+ * - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
600
+ * Are valid field names for this purpose. The cache state without transforms applied will be
601
+ * used when comparing values.
476
602
  *
477
603
  * @public
478
604
  */
@@ -502,6 +628,29 @@ export interface ArrayField {
502
628
  */
503
629
  name: string;
504
630
  /**
631
+ * The name of the field as returned by the API
632
+ * and inserted into the {@link Cache} if it differs
633
+ * from {@link ArrayField.name}
634
+ *
635
+ * For instance, if the API returns:
636
+ *
637
+ * ```ts
638
+ * {
639
+ * attributes: {
640
+ * 'first-name': 'Chris'
641
+ * }
642
+ * }
643
+ * ```
644
+ *
645
+ * But the app desires to use `record.firstName; // 'Chris'`
646
+ *
647
+ * Then `name` would be set to `'firstName'` and
648
+ * `sourceKey` would be set to `'first-name'`.
649
+ *
650
+ * This option is only needed when the value differs from name.
651
+ */
652
+ sourceKey?: string;
653
+ /**
505
654
  * The name of a transform to pass each item
506
655
  * in the array through before displaying or
507
656
  * or serializing it.
@@ -558,12 +707,42 @@ export interface SchemaArrayField {
558
707
  */
559
708
  name: string;
560
709
  /**
710
+ * The name of the field as returned by the API
711
+ * and inserted into the {@link Cache} if it differs
712
+ * from {@link SchemaArrayField.name}
713
+ *
714
+ * For instance, if the API returns:
715
+ *
716
+ * ```ts
717
+ * {
718
+ * attributes: {
719
+ * 'first-name': 'Chris'
720
+ * }
721
+ * }
722
+ * ```
723
+ *
724
+ * But the app desires to use `record.firstName; // 'Chris'`
725
+ *
726
+ * Then `name` would be set to `'firstName'` and
727
+ * `sourceKey` would be set to `'first-name'`.
728
+ *
729
+ * This option is only needed when the value differs from name.
730
+ */
731
+ sourceKey?: string;
732
+ /**
733
+ * If the SchemaArray is not polymorphic:
734
+ *
561
735
  * The name of the ObjectSchema that describes the
562
736
  * structure of the objects in the array.
563
737
  *
738
+ * If the SchemaArray is polymorphic:
739
+ *
740
+ * The name of the hashFn to use to extract
741
+ * the type from contained members or null.
742
+ *
564
743
  * @public
565
744
  */
566
- type: string;
745
+ type: string | null;
567
746
  /**
568
747
  * Options for configuring the behavior of the
569
748
  * SchemaArray.
@@ -577,13 +756,13 @@ export interface SchemaArrayField {
577
756
  *
578
757
  * Valid options are:
579
758
  *
580
- * - `'@identity'` (default) : the cached object's referential identity will be used.
759
+ * - `'@identity'`(default) : the cached object's referential identity will be used.
581
760
  * This may result in significant instability when resource data is updated from the API
582
761
  * - `'@index'` : the cached object's index in the array will be used.
583
762
  * This is only a good choice for arrays that rarely if ever change membership
584
763
  * - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for
585
764
  * The contained schema-object and use the computed result to determine and compare identity.
586
- * - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
765
+ * - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
587
766
  * Are valid field names for this purpose. The cache state without transforms applied will be
588
767
  * used when comparing values. The field value should be unique enough to guarantee two schema-objects
589
768
  * of the same type will not collide.
@@ -594,6 +773,13 @@ export interface SchemaArrayField {
594
773
  * @public
595
774
  */
596
775
  options?: {
776
+ /**
777
+ * If true, if no value for this field exists in the cache,
778
+ * an empty `[]` will be used as the value of the field,
779
+ * as opposed to the field's value being `null`.
780
+ *
781
+ */
782
+ defaultValue?: boolean;
597
783
  /**
598
784
  * ::: warning ⚠️ Dangerous Feature Ahead
599
785
  * :::
@@ -655,8 +841,15 @@ export interface SchemaArrayField {
655
841
  * If the SchemaArray is Polymorphic, the key on the raw cache data to use
656
842
  * as the "resource-type" value for the schema-object.
657
843
  *
658
- * Defaults to "type".
844
+ * The default is `'type'`.
845
+ *
846
+ * Valid options are:
659
847
  *
848
+ * - `'@hash'` : will lookup the `@hash` function specified by
849
+ * SchemaArrayField.type and use it to calculate the type for each value.
850
+ * - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
851
+ * Are valid field names for this purpose. The cache state without transforms applied will be
852
+ * used when comparing values.
660
853
  */
661
854
  type?: string;
662
855
  };
@@ -743,6 +936,29 @@ export interface ResourceField {
743
936
  */
744
937
  name: string;
745
938
  /**
939
+ * The name of the field as returned by the API
940
+ * and inserted into the {@link Cache} if it differs
941
+ * from {@link ResourceField.name}
942
+ *
943
+ * For instance, if the API returns:
944
+ *
945
+ * ```ts
946
+ * {
947
+ * attributes: {
948
+ * 'first-name': 'Chris'
949
+ * }
950
+ * }
951
+ * ```
952
+ *
953
+ * But the app desires to use `record.firstName; // 'Chris'`
954
+ *
955
+ * Then `name` would be set to `'firstName'` and
956
+ * `sourceKey` would be set to `'first-name'`.
957
+ *
958
+ * This option is only needed when the value differs from name.
959
+ */
960
+ sourceKey?: string;
961
+ /**
746
962
  * The name of the resource that this field
747
963
  * refers to. In the case of a polymorphic
748
964
  * relationship, this should be the trait
@@ -825,6 +1041,29 @@ export interface CollectionField {
825
1041
  */
826
1042
  name: string;
827
1043
  /**
1044
+ * The name of the field as returned by the API
1045
+ * and inserted into the {@link Cache} if it differs
1046
+ * from {@link CollectionField.name}
1047
+ *
1048
+ * For instance, if the API returns:
1049
+ *
1050
+ * ```ts
1051
+ * {
1052
+ * attributes: {
1053
+ * 'first-name': 'Chris'
1054
+ * }
1055
+ * }
1056
+ * ```
1057
+ *
1058
+ * But the app desires to use `record.firstName; // 'Chris'`
1059
+ *
1060
+ * Then `name` would be set to `'firstName'` and
1061
+ * `sourceKey` would be set to `'first-name'`.
1062
+ *
1063
+ * This option is only needed when the value differs from name.
1064
+ */
1065
+ sourceKey?: string;
1066
+ /**
828
1067
  * The name of the resource that this field
829
1068
  * refers to. In the case of a polymorphic
830
1069
  * relationship, this should be the trait
@@ -925,6 +1164,29 @@ export interface LegacyAttributeField {
925
1164
  */
926
1165
  name: string;
927
1166
  /**
1167
+ * The name of the field as returned by the API
1168
+ * and inserted into the {@link Cache} if it differs
1169
+ * from {@link LegacyAttributeField.name}
1170
+ *
1171
+ * For instance, if the API returns:
1172
+ *
1173
+ * ```ts
1174
+ * {
1175
+ * attributes: {
1176
+ * 'first-name': 'Chris'
1177
+ * }
1178
+ * }
1179
+ * ```
1180
+ *
1181
+ * But the app desires to use `record.firstName; // 'Chris'`
1182
+ *
1183
+ * Then `name` would be set to `'firstName'` and
1184
+ * `sourceKey` would be set to `'first-name'`.
1185
+ *
1186
+ * This option is only needed when the value differs from name.
1187
+ */
1188
+ sourceKey?: string;
1189
+ /**
928
1190
  * The name of the transform to use, if any
929
1191
  *
930
1192
  * @public
@@ -936,8 +1198,9 @@ export interface LegacyAttributeField {
936
1198
  * Must comply to the specific transform's options
937
1199
  * schema.
938
1200
  *
1201
+ * See {@link AttrOptions} for more info.
939
1202
  */
940
- options?: ObjectValue;
1203
+ options?: AttrOptions;
941
1204
  }
942
1205
  /**
943
1206
  * > [!CAUTION]
@@ -964,6 +1227,29 @@ export interface LegacyBelongsToField {
964
1227
  */
965
1228
  name: string;
966
1229
  /**
1230
+ * The name of the field as returned by the API
1231
+ * and inserted into the {@link Cache} if it differs
1232
+ * from {@link LegacyBelongsToField.name}
1233
+ *
1234
+ * For instance, if the API returns:
1235
+ *
1236
+ * ```ts
1237
+ * {
1238
+ * attributes: {
1239
+ * 'first-name': 'Chris'
1240
+ * }
1241
+ * }
1242
+ * ```
1243
+ *
1244
+ * But the app desires to use `record.firstName; // 'Chris'`
1245
+ *
1246
+ * Then `name` would be set to `'firstName'` and
1247
+ * `sourceKey` would be set to `'first-name'`.
1248
+ *
1249
+ * This option is only needed when the value differs from name.
1250
+ */
1251
+ sourceKey?: string;
1252
+ /**
967
1253
  * The name of the resource that this field
968
1254
  * refers to. In the case of a polymorphic
969
1255
  * relationship, this should be the trait
@@ -1094,6 +1380,29 @@ export interface LinksModeBelongsToField {
1094
1380
  */
1095
1381
  name: string;
1096
1382
  /**
1383
+ * The name of the field as returned by the API
1384
+ * and inserted into the {@link Cache} if it differs
1385
+ * from {@link LinksModeBelongsToField.name}
1386
+ *
1387
+ * For instance, if the API returns:
1388
+ *
1389
+ * ```ts
1390
+ * {
1391
+ * attributes: {
1392
+ * 'first-name': 'Chris'
1393
+ * }
1394
+ * }
1395
+ * ```
1396
+ *
1397
+ * But the app desires to use `record.firstName; // 'Chris'`
1398
+ *
1399
+ * Then `name` would be set to `'firstName'` and
1400
+ * `sourceKey` would be set to `'first-name'`.
1401
+ *
1402
+ * This option is only needed when the value differs from name.
1403
+ */
1404
+ sourceKey?: string;
1405
+ /**
1097
1406
  * The name of the resource that this field
1098
1407
  * refers to. In the case of a polymorphic
1099
1408
  * relationship, this should be the trait
@@ -1219,6 +1528,29 @@ export interface LegacyHasManyField {
1219
1528
  */
1220
1529
  name: string;
1221
1530
  /**
1531
+ * The name of the field as returned by the API
1532
+ * and inserted into the {@link Cache} if it differs
1533
+ * from {@link LegacyHasManyField.name}
1534
+ *
1535
+ * For instance, if the API returns:
1536
+ *
1537
+ * ```ts
1538
+ * {
1539
+ * attributes: {
1540
+ * 'first-name': 'Chris'
1541
+ * }
1542
+ * }
1543
+ * ```
1544
+ *
1545
+ * But the app desires to use `record.firstName; // 'Chris'`
1546
+ *
1547
+ * Then `name` would be set to `'firstName'` and
1548
+ * `sourceKey` would be set to `'first-name'`.
1549
+ *
1550
+ * This option is only needed when the value differs from name.
1551
+ */
1552
+ sourceKey?: string;
1553
+ /**
1222
1554
  * the name of the resource that this field
1223
1555
  * refers to. In the case of a polymorphic
1224
1556
  * relationship, this should be the trait
@@ -1367,6 +1699,29 @@ export interface LinksModeHasManyField {
1367
1699
  */
1368
1700
  name: string;
1369
1701
  /**
1702
+ * The name of the field as returned by the API
1703
+ * and inserted into the {@link Cache} if it differs
1704
+ * from {@link LinksModeHasManyField.name}
1705
+ *
1706
+ * For instance, if the API returns:
1707
+ *
1708
+ * ```ts
1709
+ * {
1710
+ * attributes: {
1711
+ * 'first-name': 'Chris'
1712
+ * }
1713
+ * }
1714
+ * ```
1715
+ *
1716
+ * But the app desires to use `record.firstName; // 'Chris'`
1717
+ *
1718
+ * Then `name` would be set to `'firstName'` and
1719
+ * `sourceKey` would be set to `'first-name'`.
1720
+ *
1721
+ * This option is only needed when the value differs from name.
1722
+ */
1723
+ sourceKey?: string;
1724
+ /**
1370
1725
  * the name of the resource that this field
1371
1726
  * refers to. In the case of a polymorphic
1372
1727
  * relationship, this should be the trait
@@ -1548,12 +1903,23 @@ export type PolarisModeFieldSchema = GenericField | PolarisAliasField | LocalFie
1548
1903
  */
1549
1904
  export type FieldSchema = GenericField | LegacyAliasField | PolarisAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | ResourceField | CollectionField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
1550
1905
  /**
1906
+ * A union of all possible LegacyMode and PolarisMode
1907
+ * field schemas that represent data that could be in
1908
+ * the cache.
1909
+ *
1910
+ * In other words this will not include types like alias
1911
+ * fields, local fields, or derived fields.
1912
+ *
1913
+ * @public
1914
+ */
1915
+ export type CacheableFieldSchema = IdentityField | GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | ResourceField | CollectionField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
1916
+ /**
1551
1917
  * A union of all possible field schemas that can be
1552
1918
  * used in an ObjectSchema.
1553
1919
  *
1554
1920
  * @public
1555
1921
  */
1556
- export type ObjectFieldSchema = GenericField | ObjectAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField;
1922
+ export type ObjectFieldSchema = LegacyAttributeField | GenericField | ObjectAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField;
1557
1923
  /**
1558
1924
  * Represents a schema for a primary resource in PolarisMode.
1559
1925
  *
@@ -1570,8 +1936,6 @@ export interface PolarisResourceSchema {
1570
1936
  *
1571
1937
  * for schema-objects, this should be either a HashField or null
1572
1938
  *
1573
- * @property identity
1574
- * @type {IdentityField}
1575
1939
  * @public
1576
1940
  */
1577
1941
  identity: IdentityField;
@@ -1,5 +1,5 @@
1
1
  import { deprecate, warn } from '@ember/debug';
2
- import { p as peekCache } from "../request-state-CejVJgdj.js";
2
+ import { p as peekCache } from "../request-state-CeN66aML.js";
3
3
  import '../types/request.js';
4
4
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
5
5
  import '../utils/string.js';
@@ -1,4 +1,4 @@
1
- import { K as ReactiveDocument } from "./request-state-CejVJgdj.js";
1
+ import { K as ReactiveDocument } from "./request-state-CeN66aML.js";
2
2
  import { SkipCache, EnableHydration } from './types/request.js';
3
3
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
4
  const MUTATION_OPS = new Set(['createRecord', 'updateRecord', 'deleteRecord']);