@warp-drive/core 5.7.0-alpha.3 → 5.7.0-alpha.4

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 (33) hide show
  1. package/declarations/reactive/-private/default-mode.d.ts +71 -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 +9 -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 +5 -1
  22. package/declarations/store/-types/q/schema-service.d.ts +19 -31
  23. package/declarations/types/schema/fields.d.ts +309 -3
  24. package/dist/graph/-private.js +1 -1
  25. package/dist/{handler-D2jjnIA-.js → handler-Gm-q2q05.js} +1 -1
  26. package/dist/index.js +2 -2
  27. package/dist/reactive.js +1000 -530
  28. package/dist/{request-state-CejVJgdj.js → request-state-Bj0zUw2r.js} +5 -0
  29. package/dist/store/-private.js +2 -2
  30. package/dist/types/-private.js +1 -1
  31. package/dist/types/schema/fields.js +13 -0
  32. package/package.json +3 -3
  33. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
@@ -29,6 +29,29 @@ export interface GenericField {
29
29
  */
30
30
  name: string;
31
31
  /**
32
+ * The name of the field as returned by the API
33
+ * and inserted into the {@link Cache} if it differs
34
+ * from {@link GenericField.name}
35
+ *
36
+ * For instance, if the API returns:
37
+ *
38
+ * ```ts
39
+ * {
40
+ * attributes: {
41
+ * 'first-name': 'Chris'
42
+ * }
43
+ * }
44
+ * ```
45
+ *
46
+ * But the app desires to use `record.firstName; // 'Chris'`
47
+ *
48
+ * Then `name` would be set to `'firstName'` and
49
+ * `sourceKey` would be set to `'first-name'`.
50
+ *
51
+ * This option is only needed when the value differs from name.
52
+ */
53
+ sourceKey?: string;
54
+ /**
32
55
  * the name of the transform to use, if any
33
56
  *
34
57
  * @public
@@ -234,6 +257,27 @@ export interface IdentityField {
234
257
  * @public
235
258
  */
236
259
  name: string;
260
+ /**
261
+ * The name of the field as returned by the API
262
+ * and inserted into the {@link Cache} if it differs
263
+ * from {@link IdentityField.name}
264
+ *
265
+ * For instance, if the API returns:
266
+ *
267
+ * ```ts
268
+ * {
269
+ * entityUrn: '324523-sadf34-345'
270
+ * }
271
+ * ```
272
+ *
273
+ * But the app desires to use `record.id; // '324523-sadf34-345'`
274
+ *
275
+ * Then `name` would be set to `'id'` and
276
+ * `sourceKey` would be set to `'entityUrn'`.
277
+ *
278
+ * This option is only needed when the value differs from name.
279
+ */
280
+ sourceKey?: string;
237
281
  }
238
282
  /**
239
283
  * Represents a specialized field whose computed value
@@ -374,6 +418,29 @@ export interface ObjectField {
374
418
  */
375
419
  name: string;
376
420
  /**
421
+ * The name of the field as returned by the API
422
+ * and inserted into the {@link Cache} if it differs
423
+ * from {@link ObjectField.name}
424
+ *
425
+ * For instance, if the API returns:
426
+ *
427
+ * ```ts
428
+ * {
429
+ * attributes: {
430
+ * 'first-name': 'Chris'
431
+ * }
432
+ * }
433
+ * ```
434
+ *
435
+ * But the app desires to use `record.firstName; // 'Chris'`
436
+ *
437
+ * Then `name` would be set to `'firstName'` and
438
+ * `sourceKey` would be set to `'first-name'`.
439
+ *
440
+ * This option is only needed when the value differs from name.
441
+ */
442
+ sourceKey?: string;
443
+ /**
377
444
  * The name of a transform to pass the entire object
378
445
  * through before displaying or serializing it.
379
446
  *
@@ -430,6 +497,29 @@ export interface SchemaObjectField {
430
497
  */
431
498
  name: string;
432
499
  /**
500
+ * The name of the field as returned by the API
501
+ * and inserted into the {@link Cache} if it differs
502
+ * from {@link SchemaObjectField.name}
503
+ *
504
+ * For instance, if the API returns:
505
+ *
506
+ * ```ts
507
+ * {
508
+ * attributes: {
509
+ * 'first-name': 'Chris'
510
+ * }
511
+ * }
512
+ * ```
513
+ *
514
+ * But the app desires to use `record.firstName; // 'Chris'`
515
+ *
516
+ * Then `name` would be set to `'firstName'` and
517
+ * `sourceKey` would be set to `'first-name'`.
518
+ *
519
+ * This option is only needed when the value differs from name.
520
+ */
521
+ sourceKey?: string;
522
+ /**
433
523
  * The name of the ObjectSchema that describes the
434
524
  * structure of the object.
435
525
  *
@@ -502,6 +592,29 @@ export interface ArrayField {
502
592
  */
503
593
  name: string;
504
594
  /**
595
+ * The name of the field as returned by the API
596
+ * and inserted into the {@link Cache} if it differs
597
+ * from {@link ArrayField.name}
598
+ *
599
+ * For instance, if the API returns:
600
+ *
601
+ * ```ts
602
+ * {
603
+ * attributes: {
604
+ * 'first-name': 'Chris'
605
+ * }
606
+ * }
607
+ * ```
608
+ *
609
+ * But the app desires to use `record.firstName; // 'Chris'`
610
+ *
611
+ * Then `name` would be set to `'firstName'` and
612
+ * `sourceKey` would be set to `'first-name'`.
613
+ *
614
+ * This option is only needed when the value differs from name.
615
+ */
616
+ sourceKey?: string;
617
+ /**
505
618
  * The name of a transform to pass each item
506
619
  * in the array through before displaying or
507
620
  * or serializing it.
@@ -558,6 +671,29 @@ export interface SchemaArrayField {
558
671
  */
559
672
  name: string;
560
673
  /**
674
+ * The name of the field as returned by the API
675
+ * and inserted into the {@link Cache} if it differs
676
+ * from {@link SchemaArrayField.name}
677
+ *
678
+ * For instance, if the API returns:
679
+ *
680
+ * ```ts
681
+ * {
682
+ * attributes: {
683
+ * 'first-name': 'Chris'
684
+ * }
685
+ * }
686
+ * ```
687
+ *
688
+ * But the app desires to use `record.firstName; // 'Chris'`
689
+ *
690
+ * Then `name` would be set to `'firstName'` and
691
+ * `sourceKey` would be set to `'first-name'`.
692
+ *
693
+ * This option is only needed when the value differs from name.
694
+ */
695
+ sourceKey?: string;
696
+ /**
561
697
  * The name of the ObjectSchema that describes the
562
698
  * structure of the objects in the array.
563
699
  *
@@ -743,6 +879,29 @@ export interface ResourceField {
743
879
  */
744
880
  name: string;
745
881
  /**
882
+ * The name of the field as returned by the API
883
+ * and inserted into the {@link Cache} if it differs
884
+ * from {@link ResourceField.name}
885
+ *
886
+ * For instance, if the API returns:
887
+ *
888
+ * ```ts
889
+ * {
890
+ * attributes: {
891
+ * 'first-name': 'Chris'
892
+ * }
893
+ * }
894
+ * ```
895
+ *
896
+ * But the app desires to use `record.firstName; // 'Chris'`
897
+ *
898
+ * Then `name` would be set to `'firstName'` and
899
+ * `sourceKey` would be set to `'first-name'`.
900
+ *
901
+ * This option is only needed when the value differs from name.
902
+ */
903
+ sourceKey?: string;
904
+ /**
746
905
  * The name of the resource that this field
747
906
  * refers to. In the case of a polymorphic
748
907
  * relationship, this should be the trait
@@ -825,6 +984,29 @@ export interface CollectionField {
825
984
  */
826
985
  name: string;
827
986
  /**
987
+ * The name of the field as returned by the API
988
+ * and inserted into the {@link Cache} if it differs
989
+ * from {@link CollectionField.name}
990
+ *
991
+ * For instance, if the API returns:
992
+ *
993
+ * ```ts
994
+ * {
995
+ * attributes: {
996
+ * 'first-name': 'Chris'
997
+ * }
998
+ * }
999
+ * ```
1000
+ *
1001
+ * But the app desires to use `record.firstName; // 'Chris'`
1002
+ *
1003
+ * Then `name` would be set to `'firstName'` and
1004
+ * `sourceKey` would be set to `'first-name'`.
1005
+ *
1006
+ * This option is only needed when the value differs from name.
1007
+ */
1008
+ sourceKey?: string;
1009
+ /**
828
1010
  * The name of the resource that this field
829
1011
  * refers to. In the case of a polymorphic
830
1012
  * relationship, this should be the trait
@@ -925,6 +1107,29 @@ export interface LegacyAttributeField {
925
1107
  */
926
1108
  name: string;
927
1109
  /**
1110
+ * The name of the field as returned by the API
1111
+ * and inserted into the {@link Cache} if it differs
1112
+ * from {@link LegacyAttributeField.name}
1113
+ *
1114
+ * For instance, if the API returns:
1115
+ *
1116
+ * ```ts
1117
+ * {
1118
+ * attributes: {
1119
+ * 'first-name': 'Chris'
1120
+ * }
1121
+ * }
1122
+ * ```
1123
+ *
1124
+ * But the app desires to use `record.firstName; // 'Chris'`
1125
+ *
1126
+ * Then `name` would be set to `'firstName'` and
1127
+ * `sourceKey` would be set to `'first-name'`.
1128
+ *
1129
+ * This option is only needed when the value differs from name.
1130
+ */
1131
+ sourceKey?: string;
1132
+ /**
928
1133
  * The name of the transform to use, if any
929
1134
  *
930
1135
  * @public
@@ -964,6 +1169,29 @@ export interface LegacyBelongsToField {
964
1169
  */
965
1170
  name: string;
966
1171
  /**
1172
+ * The name of the field as returned by the API
1173
+ * and inserted into the {@link Cache} if it differs
1174
+ * from {@link LegacyBelongsToField.name}
1175
+ *
1176
+ * For instance, if the API returns:
1177
+ *
1178
+ * ```ts
1179
+ * {
1180
+ * attributes: {
1181
+ * 'first-name': 'Chris'
1182
+ * }
1183
+ * }
1184
+ * ```
1185
+ *
1186
+ * But the app desires to use `record.firstName; // 'Chris'`
1187
+ *
1188
+ * Then `name` would be set to `'firstName'` and
1189
+ * `sourceKey` would be set to `'first-name'`.
1190
+ *
1191
+ * This option is only needed when the value differs from name.
1192
+ */
1193
+ sourceKey?: string;
1194
+ /**
967
1195
  * The name of the resource that this field
968
1196
  * refers to. In the case of a polymorphic
969
1197
  * relationship, this should be the trait
@@ -1094,6 +1322,29 @@ export interface LinksModeBelongsToField {
1094
1322
  */
1095
1323
  name: string;
1096
1324
  /**
1325
+ * The name of the field as returned by the API
1326
+ * and inserted into the {@link Cache} if it differs
1327
+ * from {@link LinksModeBelongsToField.name}
1328
+ *
1329
+ * For instance, if the API returns:
1330
+ *
1331
+ * ```ts
1332
+ * {
1333
+ * attributes: {
1334
+ * 'first-name': 'Chris'
1335
+ * }
1336
+ * }
1337
+ * ```
1338
+ *
1339
+ * But the app desires to use `record.firstName; // 'Chris'`
1340
+ *
1341
+ * Then `name` would be set to `'firstName'` and
1342
+ * `sourceKey` would be set to `'first-name'`.
1343
+ *
1344
+ * This option is only needed when the value differs from name.
1345
+ */
1346
+ sourceKey?: string;
1347
+ /**
1097
1348
  * The name of the resource that this field
1098
1349
  * refers to. In the case of a polymorphic
1099
1350
  * relationship, this should be the trait
@@ -1219,6 +1470,29 @@ export interface LegacyHasManyField {
1219
1470
  */
1220
1471
  name: string;
1221
1472
  /**
1473
+ * The name of the field as returned by the API
1474
+ * and inserted into the {@link Cache} if it differs
1475
+ * from {@link LegacyHasManyField.name}
1476
+ *
1477
+ * For instance, if the API returns:
1478
+ *
1479
+ * ```ts
1480
+ * {
1481
+ * attributes: {
1482
+ * 'first-name': 'Chris'
1483
+ * }
1484
+ * }
1485
+ * ```
1486
+ *
1487
+ * But the app desires to use `record.firstName; // 'Chris'`
1488
+ *
1489
+ * Then `name` would be set to `'firstName'` and
1490
+ * `sourceKey` would be set to `'first-name'`.
1491
+ *
1492
+ * This option is only needed when the value differs from name.
1493
+ */
1494
+ sourceKey?: string;
1495
+ /**
1222
1496
  * the name of the resource that this field
1223
1497
  * refers to. In the case of a polymorphic
1224
1498
  * relationship, this should be the trait
@@ -1367,6 +1641,29 @@ export interface LinksModeHasManyField {
1367
1641
  */
1368
1642
  name: string;
1369
1643
  /**
1644
+ * The name of the field as returned by the API
1645
+ * and inserted into the {@link Cache} if it differs
1646
+ * from {@link LinksModeHasManyField.name}
1647
+ *
1648
+ * For instance, if the API returns:
1649
+ *
1650
+ * ```ts
1651
+ * {
1652
+ * attributes: {
1653
+ * 'first-name': 'Chris'
1654
+ * }
1655
+ * }
1656
+ * ```
1657
+ *
1658
+ * But the app desires to use `record.firstName; // 'Chris'`
1659
+ *
1660
+ * Then `name` would be set to `'firstName'` and
1661
+ * `sourceKey` would be set to `'first-name'`.
1662
+ *
1663
+ * This option is only needed when the value differs from name.
1664
+ */
1665
+ sourceKey?: string;
1666
+ /**
1370
1667
  * the name of the resource that this field
1371
1668
  * refers to. In the case of a polymorphic
1372
1669
  * relationship, this should be the trait
@@ -1548,12 +1845,23 @@ export type PolarisModeFieldSchema = GenericField | PolarisAliasField | LocalFie
1548
1845
  */
1549
1846
  export type FieldSchema = GenericField | LegacyAliasField | PolarisAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | ResourceField | CollectionField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
1550
1847
  /**
1848
+ * A union of all possible LegacyMode and PolarisMode
1849
+ * field schemas that represent data that could be in
1850
+ * the cache.
1851
+ *
1852
+ * In other words this will not include types like alias
1853
+ * fields, local fields, or derived fields.
1854
+ *
1855
+ * @public
1856
+ */
1857
+ export type CacheableFieldSchema = IdentityField | GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | ResourceField | CollectionField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
1858
+ /**
1551
1859
  * A union of all possible field schemas that can be
1552
1860
  * used in an ObjectSchema.
1553
1861
  *
1554
1862
  * @public
1555
1863
  */
1556
- export type ObjectFieldSchema = GenericField | ObjectAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField;
1864
+ export type ObjectFieldSchema = LegacyAttributeField | GenericField | ObjectAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField;
1557
1865
  /**
1558
1866
  * Represents a schema for a primary resource in PolarisMode.
1559
1867
  *
@@ -1570,8 +1878,6 @@ export interface PolarisResourceSchema {
1570
1878
  *
1571
1879
  * for schema-objects, this should be either a HashField or null
1572
1880
  *
1573
- * @property identity
1574
- * @type {IdentityField}
1575
1881
  * @public
1576
1882
  */
1577
1883
  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-Bj0zUw2r.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-Bj0zUw2r.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']);
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import { a as cloneResponseProperties, I as IS_CACHE_HANDLER, b as assertValidRe
3
3
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
4
  import { w as waitFor } from "./configure-B48bFHOl.js";
5
5
  import { peekUniversalTransient, setUniversalTransient } from './types/-private.js';
6
- export { S as Store, r as recordIdentifierFor, O as setIdentifierForgetMethod, L as setIdentifierGenerationMethod, P as setIdentifierResetMethod, N as setIdentifierUpdateMethod, Q as setKeyInfoForResource, s as storeFor } from "./request-state-CejVJgdj.js";
7
- export { C as CacheHandler } from "./handler-D2jjnIA-.js";
6
+ export { S as Store, r as recordIdentifierFor, O as setIdentifierForgetMethod, L as setIdentifierGenerationMethod, P as setIdentifierResetMethod, N as setIdentifierUpdateMethod, Q as setKeyInfoForResource, s as storeFor } from "./request-state-Bj0zUw2r.js";
7
+ export { C as CacheHandler } from "./handler-Gm-q2q05.js";
8
8
  import '@ember/debug';
9
9
  import './utils/string.js';
10
10